snapshot

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSectionHandlerNotFound = errors.New("section handler not found")
View Source
var SectionHandlerNotFound = ErrSectionHandlerNotFound

Deprecated: Use ErrSectionHandlerNotFound instead

Functions

This section is empty.

Types

type AccountFreeActionsObject

type AccountFreeActionsObject struct {
	Name                 eos.AccountName
	PermissionObject     FreeObjectUsage
	SharedKey            FreeObjectUsage
	PermissionLevel      FreeObjectUsage
	Wait                 FreeObjectUsage
	PermissionLinkObject FreeObjectUsage
}

type AccountMetadataObject

type AccountMetadataObject struct {
	Name           eos.AccountName //< name should not be changed within a chainbase modifier lambda
	RecvSequence   eos.Uint64
	AuthSequence   eos.Uint64
	CodeSequence   eos.Uint64
	ABISequence    eos.Uint64
	CodeHash       eos.Checksum256
	LastCodeUpdate eos.TimePoint
	Flags          uint32 // First flag means "privileged".
	VMType         byte
	VMVersion      byte
}

type AccountObject

type AccountObject struct {
	Name         eos.AccountName
	CreationDate eos.BlockTimestamp
	RawABI       []byte
}

type AccountRAMCorrectionObject

type AccountRAMCorrectionObject struct {
	Name          eos.AccountName
	RAMCorrection eos.Uint64
}

type ActivatedProtocolFeature

type ActivatedProtocolFeature struct {
	FeatureDigest      eos.Checksum256
	ActivationBlockNum uint32
}

type BlockState

type BlockState struct {
	/// from block_header_state_common
	BlockNum                         uint32                         `json:"block_num"`
	DposProposedIrreversibleBlocknum uint32                         `json:"dpos_proposed_irreversible_blocknum"`
	DposIrreversibleBlocknum         uint32                         `json:"dpos_irreversible_blocknum"`
	ActiveSchedule                   *eos.ProducerAuthoritySchedule `json:"active_schedule"`
	BlockrootMerkle                  *eos.MerkleRoot                `json:"blockroot_merkle"`
	ProducerToLastProduced           []eos.PairAccountNameBlockNum  `json:"producer_to_last_produced"`
	ProducerToLastImpliedIrb         []eos.PairAccountNameBlockNum  `json:"producer_to_last_implied_irb"`
	BlockSigningKey                  *eos.BlockSigningAuthority     `json:"block_signing_key"`
	ConfirmCount                     []uint8                        `json:"confirm_count"`

	// from block_header_state
	BlockID                   eos.Checksum256                   `json:"id"`
	Header                    *eos.SignedBlockHeader            `json:"header"`
	PendingSchedule           *ScheduleInfo                     `json:"pending_schedule"`
	ActivatedProtocolFeatures *eos.ProtocolFeatureActivationSet `json:"activated_protocol_features"`
}

type BlockSummary

type BlockSummary struct {
	BlockID eos.Checksum256
}

type ChainConfig

type ChainConfig struct {
	MaxBlockNetUsage               eos.Uint64 ///< the maxiumum net usage in instructions for a block
	TargetBlockNetUsagePct         uint32     ///< the target percent (1% == 100, 100%= 10,000) of maximum net usage; exceeding this triggers congestion handling
	MaxTransactionNetUsage         uint32     ///< the maximum objectively measured net usage that the chain will allow regardless of account limits
	BasePerTransactionNetUsage     uint32     ///< the base amount of net usage billed for a transaction to cover incidentals
	NetUsageLeeway                 uint32
	ContextFreeDiscountNetUsageNum uint32 ///< the numerator for the discount on net usage of context-free data
	ContextFreeDiscountNetUsageDen uint32 ///< the denominator for the discount on net usage of context-free data

	MaxBlockCpuUsage       uint32 ///< the maxiumum billable cpu usage (in microseconds) for a block
	TargetBlockCpuUsagePct uint32 ///< the target percent (1% == 100, 100%= 10,000) of maximum cpu usage; exceeding this triggers congestion handling
	MaxTransactionCpuUsage uint32 ///< the maximum billable cpu usage (in microseconds) that the chain will allow regardless of account limits
	MinTransactionCpuUsage uint32 ///< the minimum billable cpu usage (in microseconds) that the chain requires

	MaxTransactionLifetime      uint32 ///< the maximum number of seconds that an input transaction's expiration can be ahead of the time of the block in which it is first included
	DeferredTrxExpirationWindow uint32 ///< the number of seconds after the time a deferred transaction can first execute until it expires
	MaxTransactionDelay         uint32 ///< the maximum number of seconds that can be imposed as a delay requirement by authorization checks
	MaxInlineActionSize         uint32 ///< maximum allowed size (in bytes) of an inline action
	MaxInlineActionDepth        uint16 ///< recursion depth limit on sending inline actions
	MaxAuthorityDepth           uint16 ///< recursion depth limit for checking if an authority is satisfied
}

type ChainSnapshotHeader

type ChainSnapshotHeader struct {
	Version uint32
}

type CodeObject

type CodeObject struct {
	CodeHash       eos.Checksum256 //< code_hash should not be changed within a chainbase modifier lambda
	Code           eos.HexBytes
	CodeRefCount   eos.Uint64
	FirstBlockUsed uint32
	VMType         uint8 //< vm_type should not be changed within a chainbase modifier lambda
	VMVersion      uint8 //< vm_version should not be changed within a chainbase modifier lambda
}

type ContractRow

type ContractRow struct {
	PrimKey string
	Payer   string
}

type DynamicGlobalPropertyObject

type DynamicGlobalPropertyObject struct {
	GlobalActionSequence eos.Uint64
}

type ElasticLimitParameters

type ElasticLimitParameters struct {
	Target  eos.Uint64 // the desired usage
	Max     eos.Uint64 // the maximum usage
	Periods uint32     // the number of aggregation periods that contribute to the average usage

	MaxMultiplier uint32     // the multiplier by which virtual space can oversell usage when uncongested
	ContractRate  eos.Uint64 // the rate at which a congested resource contracts its limit
	ExpandRate    eos.Uint64 // the rate at which an uncongested resource expands its limits
}

type FreeObjectUsage

type FreeObjectUsage struct {
	UserSize   eos.Uint64
	UserCount  eos.Uint64
	UltraSize  eos.Uint64
	UltraCount eos.Uint64
}

type GeneratedTransactionObject

type GeneratedTransactionObject struct {
	TrxID      eos.Checksum256 //< trx_id should not be changed within a chainbase modifier lambda
	Sender     eos.AccountName //< sender should not be changed within a chainbase modifier lambda
	SenderID   eos.Uint128     /// ID given this transaction by the sender (should not be changed within a chainbase modifier lambda)
	Payer      eos.AccountName
	DelayUntil eos.TimePoint /// this generated transaction will not be applied until the specified time
	Expiration eos.TimePoint /// this generated transaction will not be applied after  time
	Published  eos.TimePoint
	PackedTrx  eos.HexBytes
}

type GenesisState

type GenesisState struct {
	//InitialConfiguration ChainConfig //eos.ChainConfig
	InitialTimestamp eos.TimePoint
	InitialKey       ecc.PublicKey
}

type GlobalPropertyObject

type GlobalPropertyObject struct {
	ProposedScheduleBlockNum uint32 `eos:"optional"`
	ProposedSchedule         *eos.ProducerAuthoritySchedule
	Configuration            ChainConfig
	ChainID                  eos.Checksum256
}
type Header struct {
	Version uint32
}

Header is the top-most header, which determines the file format.

It is not to be confused with the eosio::chain::chain_snapshot_header which talks about the version of the contents of the snapshot file.

type Index128Object

type Index128Object struct {
	ContractRow
	SecondaryKey eos.Uint128
}

type Index256Object

type Index256Object struct {
	ContractRow
	SecondaryKey eos.Checksum256
}

type Index64Object

type Index64Object struct {
	ContractRow
	SecondaryKey eos.Name
}

type IndexDoubleObject

type IndexDoubleObject struct {
	ContractRow
	SecondaryKey eos.Float64
}

type IndexLongDoubleObject

type IndexLongDoubleObject struct {
	ContractRow
	SecondaryKey eos.Float128
}

type KeyValueObject

type KeyValueObject struct {
	ContractRow
	Value eos.HexBytes
}

type PermissionLinkObject

type PermissionLinkObject struct {
	/// The account which is defining its permission requirements
	Account eos.AccountName
	/// The contract which account requires @ref required_permission to invoke
	Code eos.AccountName
	/// The message type which account requires @ref required_permission to invoke
	/// May be empty; if so, it sets a default @ref required_permission for all messages to @ref code
	MessageType eos.ActionName
	/// The permission level which @ref account requires for the specified message types
	/// all of the above fields should not be changed within a chainbase modifier lambda
	RequiredPermission eos.PermissionName
}

type PermissionObject

type PermissionObject struct {
	Parent      eos.PermissionName ///< parent permission
	Owner       eos.AccountName    ///< the account this permission belongs to
	Name        eos.PermissionName ///< human-readable name for the permission
	LastUpdated eos.TimePoint      ///< the last time this authority was updated
	LastUsed    eos.TimePoint      ///< when this permission was last used
	Auth        eos.Authority      ///< authority required to execute this permission
}

type ProtocolStateObject

type ProtocolStateObject struct {
	ActivatedProtocolFeatures    []*ActivatedProtocolFeature
	PreactivatedProtocolFeatures []eos.Checksum256
	WhitelistedIntrinsics        []string
	NumSupportedKeyTypes         uint32
}

type Reader

type Reader struct {
	Header         *Header
	CurrentSection *Section
	// contains filtered or unexported fields
}

func NewDefaultReader

func NewDefaultReader(filename string) (r *Reader, err error)

func NewReader

func NewReader(filename string) (r *Reader, err error)

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) HasSectionHandler

func (r *Reader) HasSectionHandler(s *Section) bool

func (*Reader) NextSection

func (r *Reader) NextSection() error

Next retrieves the next section.

func (*Reader) ProcessCurrentSection

func (r *Reader) ProcessCurrentSection(f sectionCallbackFunc) error

func (*Reader) RegisterSectionHandler

func (r *Reader) RegisterSectionHandler(s SectionName, h sectionHandlerFunc)

type ResourceLimitsConfigObject

type ResourceLimitsConfigObject struct {
	CPULimitParameters ElasticLimitParameters
	NetLimitParameters ElasticLimitParameters

	AccountCPUUsageAverageWindow uint32
	AccountNetUsageAverageWindow uint32
}

type ResourceLimitsObject

type ResourceLimitsObject struct {
	Owner eos.AccountName //<  should not be changed within a chainbase modifier lambda

	NetWeight eos.Int64
	CPUWeight eos.Int64
	RAMBytes  eos.Int64
}

type ResourceLimitsStateObject

type ResourceLimitsStateObject struct {
	/**
	 * Track the average netusage for blocks
	 */
	AverageBlockNetUsage UsageAccumulator

	/**
	 * Track the average cpu usage for blocks
	 */
	AverageBlockCPUUsage UsageAccumulator

	PendingNetUsage eos.Uint64
	PendingCPUUsage eos.Uint64

	TotalNetWeight eos.Uint64
	TotalCPUWeight eos.Uint64
	TotalRAMBytes  eos.Uint64

	/**
	 * The virtual number of bytes that would be consumed over blocksize_average_window_ms
	 * if all blocks were at their maximum virtual size. This is virtual because the
	 * real maximum block is less, this virtual number is only used for rate limiting users.
	 *
	 * It's lowest possible value is max_block_size * blocksize_average_window_ms / block_interval
	 * It's highest possible value is config::maximum_elastic_resource_multiplier (1000) times its lowest possible value
	 *
	 * This means that the most an account can consume during idle periods is 1000x the bandwidth
	 * it is gauranteed under congestion.
	 *
	 * Increases when average_block_size < target_block_size, decreases when
	 * average_block_size > target_block_size, with a cap at 1000x max_block_size
	 * and a floor at max_block_size;
	 **/
	VirtualNetLimit eos.Uint64

	/**
	 *  Increases when average_bloc
	 */
	VirtualCPULimit eos.Uint64
}

type ResourceUsageObject

type ResourceUsageObject struct {
	Owner eos.AccountName //< owner should not be changed within a chainbase modifier lambda

	NetUsage UsageAccumulator
	CPUUsage UsageAccumulator

	RAMUsage eos.Uint64
}

type ScheduleInfo

type ScheduleInfo struct {
	ScheduleLIBNum uint32                         `json:"schedule_lib_num"`
	ScheduleHash   eos.Checksum256                `json:"schedule_hash"`
	Schedule       *eos.ProducerAuthoritySchedule `json:"schedule"`
}

type Section

type Section struct {
	Name       SectionName
	Offset     uint64
	Size       uint64 // This includes the section name and row count
	BufferSize uint64 // This represents the bytes that are following the section header
	RowCount   uint64 // This is a count of rows packed in `Buffer`
	Buffer     io.Reader
}

type SectionName

type SectionName string
const (
	SectionNameChainSnapshotHeader         SectionName = "eosio::chain::chain_snapshot_header"
	SectionNameBlockState                  SectionName = "eosio::chain::block_state"
	SectionNameAccountObject               SectionName = "eosio::chain::account_object"
	SectionNameAccountMetadataObject       SectionName = "eosio::chain::account_metadata_object"
	SectionNameAccountRamCorrectionObject  SectionName = "eosio::chain::account_ram_correction_object"
	SectionNameGlobalPropertyObject        SectionName = "eosio::chain::global_property_object"
	SectionNameProtocolStateObject         SectionName = "eosio::chain::protocol_state_object"
	SectionNameDynamicGlobalPropertyObject SectionName = "eosio::chain::dynamic_global_property_object"
	SectionNameBlockSummaryObject          SectionName = "eosio::chain::block_summary_object"
	SectionNameTransactionObject           SectionName = "eosio::chain::transaction_object"
	SectionNameGeneratedTransactionObject  SectionName = "eosio::chain::generated_transaction_object"
	SectionNameCodeObject                  SectionName = "eosio::chain::code_object"
	SectionNameContractTables              SectionName = "contract_tables"
	SectionNamePermissionObject            SectionName = "eosio::chain::permission_object"
	SectionNamePermissionLinkObject        SectionName = "eosio::chain::permission_link_object"
	SectionNameResourceLimitsObject        SectionName = "eosio::chain::resource_limits::resource_limits_object"
	SectionNameResourceUsageObject         SectionName = "eosio::chain::resource_limits::resource_usage_object"
	SectionNameResourceLimitsStateObject   SectionName = "eosio::chain::resource_limits::resource_limits_state_object"
	SectionNameResourceLimitsConfigObject  SectionName = "eosio::chain::resource_limits::resource_limits_config_object"
	SectionNameGenesisState                SectionName = "eosio::chain::genesis_state"

	// Ultra Specific
	SectionAccountFreeActionsObject SectionName = "eosio::chain::account_free_actions_object"
)

type TableIDObject

type TableIDObject struct {
	Code      string
	Scope     string
	TableName string
	Payer     string
	Count     uint32 // represents the number of rows & indices for a given table
}

type TransactionObject

type TransactionObject struct {
	Expiration eos.TimePointSec
	TrxID      eos.Checksum256 //< trx_id shou
}

type UsageAccumulator

type UsageAccumulator struct {
	LastOrdinal uint32     ///< The ordinal of the last period which has contributed to the average
	ValueEx     eos.Uint64 ///< The current average pre-multiplied by Precision
	Consumed    eos.Uint64 ///< The last periods average + the current periods contribution so far
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL