snapshot

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 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                 roxe.AccountName
	PermissionObject     FreeObjectUsage
	SharedKey            FreeObjectUsage
	PermissionLevel      FreeObjectUsage
	Wait                 FreeObjectUsage
	PermissionLinkObject FreeObjectUsage
}

type AccountMetadataObject

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

type AccountObject

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

type AccountRAMCorrectionObject

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

type ActivatedProtocolFeature

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

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

type BlockSummary

type BlockSummary struct {
	BlockID roxe.Checksum256
}

type ChainConfig

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

type ElasticLimitParameters

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

type FreeObjectUsage

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

type GeneratedTransactionObject

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

type GenesisState

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

type GlobalPropertyObject

type GlobalPropertyObject struct {
	ProposedScheduleBlockNum uint32 `roxe:"optional"`
	ProposedSchedule         *roxe.ProducerAuthoritySchedule
	Configuration            ChainConfig
	ChainID                  roxe.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 roxe::chain::chain_snapshot_header which talks about the version of the contents of the snapshot file.

type Index128Object

type Index128Object struct {
	ContractRow
	SecondaryKey roxe.Uint128
}

type Index256Object

type Index256Object struct {
	ContractRow
	SecondaryKey roxe.Checksum256
}

type Index64Object

type Index64Object struct {
	ContractRow
	SecondaryKey roxe.Name
}

type IndexDoubleObject

type IndexDoubleObject struct {
	ContractRow
	SecondaryKey roxe.Float64
}

type IndexLongDoubleObject

type IndexLongDoubleObject struct {
	ContractRow
	SecondaryKey roxe.Float128
}

type KeyValueObject

type KeyValueObject struct {
	ContractRow
	Value roxe.HexBytes
}

type PermissionLinkObject

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

type PermissionObject

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

type ProtocolStateObject

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

	NetWeight roxe.Int64
	CPUWeight roxe.Int64
	RAMBytes  roxe.Int64
}

type ResourceLimitsStateObject

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

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

	PendingNetUsage roxe.Uint64
	PendingCPUUsage roxe.Uint64

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

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

type ResourceUsageObject

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

	NetUsage UsageAccumulator
	CPUUsage UsageAccumulator

	RAMUsage roxe.Uint64
}

type ScheduleInfo

type ScheduleInfo struct {
	ScheduleLIBNum uint32                          `json:"schedule_lib_num"`
	ScheduleHash   roxe.Checksum256                `json:"schedule_hash"`
	Schedule       *roxe.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 = "roxe::chain::chain_snapshot_header"
	SectionNameBlockState                  SectionName = "roxe::chain::block_state"
	SectionNameAccountObject               SectionName = "roxe::chain::account_object"
	SectionNameAccountMetadataObject       SectionName = "roxe::chain::account_metadata_object"
	SectionNameAccountRamCorrectionObject  SectionName = "roxe::chain::account_ram_correction_object"
	SectionNameGlobalPropertyObject        SectionName = "roxe::chain::global_property_object"
	SectionNameProtocolStateObject         SectionName = "roxe::chain::protocol_state_object"
	SectionNameDynamicGlobalPropertyObject SectionName = "roxe::chain::dynamic_global_property_object"
	SectionNameBlockSummaryObject          SectionName = "roxe::chain::block_summary_object"
	SectionNameTransactionObject           SectionName = "roxe::chain::transaction_object"
	SectionNameGeneratedTransactionObject  SectionName = "roxe::chain::generated_transaction_object"
	SectionNameCodeObject                  SectionName = "roxe::chain::code_object"
	SectionNameContractTables              SectionName = "contract_tables"
	SectionNamePermissionObject            SectionName = "roxe::chain::permission_object"
	SectionNamePermissionLinkObject        SectionName = "roxe::chain::permission_link_object"
	SectionNameResourceLimitsObject        SectionName = "roxe::chain::resource_limits::resource_limits_object"
	SectionNameResourceUsageObject         SectionName = "roxe::chain::resource_limits::resource_usage_object"
	SectionNameResourceLimitsStateObject   SectionName = "roxe::chain::resource_limits::resource_limits_state_object"
	SectionNameResourceLimitsConfigObject  SectionName = "roxe::chain::resource_limits::resource_limits_config_object"
	SectionNameGenesisState                SectionName = "roxe::chain::genesis_state"

	// Ultra Specific
	SectionAccountFreeActionsObject SectionName = "roxe::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 roxe.TimePointSec
	TrxID      roxe.Checksum256 //< trx_id shou
}

type UsageAccumulator

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