snapshot

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 9 Imported by: 6

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                 zsw.AccountName
	PermissionObject     FreeObjectUsage
	SharedKey            FreeObjectUsage
	PermissionLevel      FreeObjectUsage
	Wait                 FreeObjectUsage
	PermissionLinkObject FreeObjectUsage
}

type AccountMetadataObject

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

type AccountObject

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

type AccountRAMCorrectionObject

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

type ActivatedProtocolFeature

type ActivatedProtocolFeature struct {
	FeatureDigest      zsw.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                   *zsw.ProducerAuthoritySchedule `json:"active_schedule"`
	BlockrootMerkle                  *zsw.MerkleRoot                `json:"blockroot_merkle"`
	ProducerToLastProduced           []zsw.PairAccountNameBlockNum  `json:"producer_to_last_produced"`
	ProducerToLastImpliedIrb         []zsw.PairAccountNameBlockNum  `json:"producer_to_last_implied_irb"`
	BlockSigningKey                  *zsw.BlockSigningAuthority     `json:"block_signing_key"`
	ConfirmCount                     []uint8                        `json:"confirm_count"`

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

type BlockSummary

type BlockSummary struct {
	BlockID zsw.Checksum256
}

type ChainConfig

type ChainConfig struct {
	MaxBlockNetUsage               zsw.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       zsw.Checksum256 //< code_hash should not be changed within a chainbase modifier lambda
	Code           zsw.HexBytes
	CodeRefCount   zsw.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 zsw.Uint64
}

type ElasticLimitParameters

type ElasticLimitParameters struct {
	Target  zsw.Uint64 // the desired usage
	Max     zsw.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  zsw.Uint64 // the rate at which a congested resource contracts its limit
	ExpandRate    zsw.Uint64 // the rate at which an uncongested resource expands its limits
}

type FreeObjectUsage

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

type GeneratedTransactionObject

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

type GenesisState

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

type GlobalPropertyObject

type GlobalPropertyObject struct {
	ProposedScheduleBlockNum uint32 `eos:"optional"`
	ProposedSchedule         *zsw.ProducerAuthoritySchedule
	Configuration            ChainConfig
	ChainID                  zsw.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 zsw.Uint128
}

type Index256Object

type Index256Object struct {
	ContractRow
	SecondaryKey zsw.Checksum256
}

type Index64Object

type Index64Object struct {
	ContractRow
	SecondaryKey zsw.Name
}

type IndexDoubleObject

type IndexDoubleObject struct {
	ContractRow
	SecondaryKey zsw.Float64
}

type IndexLongDoubleObject

type IndexLongDoubleObject struct {
	ContractRow
	SecondaryKey zsw.Float128
}

type KeyValueObject

type KeyValueObject struct {
	ContractRow
	Value zsw.HexBytes
}

type PermissionLinkObject

type PermissionLinkObject struct {
	/// The account which is defining its permission requirements
	Account zsw.AccountName
	/// The contract which account requires @ref required_permission to invoke
	Code zsw.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 zsw.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 zsw.PermissionName
}

type PermissionObject

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

type ProtocolStateObject

type ProtocolStateObject struct {
	ActivatedProtocolFeatures    []*ActivatedProtocolFeature
	PreactivatedProtocolFeatures []zsw.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 zsw.AccountName //<  should not be changed within a chainbase modifier lambda

	NetWeight zsw.Int64
	CPUWeight zsw.Int64
	RAMBytes  zsw.Int64
}

type ResourceLimitsStateObject

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

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

	PendingNetUsage zsw.Uint64
	PendingCPUUsage zsw.Uint64

	TotalNetWeight zsw.Uint64
	TotalCPUWeight zsw.Uint64
	TotalRAMBytes  zsw.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 zsw.Uint64

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

type ResourceUsageObject

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

	NetUsage UsageAccumulator
	CPUUsage UsageAccumulator

	RAMUsage zsw.Uint64
}

type ScheduleInfo

type ScheduleInfo struct {
	ScheduleLIBNum uint32                         `json:"schedule_lib_num"`
	ScheduleHash   zsw.Checksum256                `json:"schedule_hash"`
	Schedule       *zsw.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 zsw.TimePointSec
	TrxID      zsw.Checksum256 //< trx_id shou
}

type UsageAccumulator

type UsageAccumulator struct {
	LastOrdinal uint32     ///< The ordinal of the last period which has contributed to the average
	ValueEx     zsw.Uint64 ///< The current average pre-multiplied by Precision
	Consumed    zsw.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