Documentation ¶
Index ¶
- Constants
- Variables
- func AccountDataResources(ctx context.Context, accountData *basics.AccountData, rowid int64, ...) error
- func AccountHashBuilder(addr basics.Address, accountData basics.AccountData, encodedAccountData []byte) []byte
- func AccountHashBuilderV6(addr basics.Address, accountData *BaseAccountData, encodedAccountData []byte) []byte
- func BaseAccountDataMaxSize() (s int)
- func BaseOnlineAccountDataMaxSize() (s int)
- func BaseVotingDataMaxSize() (s int)
- func CatchpointFirstStageInfoMaxSize() (s int)
- func GetEmptyDirs(PathToScan string) ([]string, error)
- func KvHashBuilderV6(key string, value []byte) []byte
- func MakeCatchpointFilePath(round basics.Round) string
- func RemoveSingleCatchpointFileFromDisk(dbDirectory, fileToDelete string) (err error)
- func ResourceFlagsMaxSize() (s int)
- func ResourcesDataMaxSize() (s int)
- func ResourcesHashBuilderV6(rd *ResourcesData, addr basics.Address, cidx basics.CreatableIndex, ...) ([]byte, error)
- func TxTailRoundLeaseMaxSize() (s int)
- func TxTailRoundMaxSize() (s int)
- type AccountAddressHash
- type AccountRef
- type AccountsReader
- type AccountsReaderExt
- type AccountsReaderTestExt
- type AccountsReaderWriter
- type AccountsWriter
- type AccountsWriterExt
- type BaseAccountData
- func (_ *BaseAccountData) CanMarshalMsg(z interface{}) bool
- func (_ *BaseAccountData) CanUnmarshalMsg(z interface{}) bool
- func (ba *BaseAccountData) GetAccountData() basics.AccountData
- func (ba *BaseAccountData) GetLedgerCoreAccountBaseData() ledgercore.AccountBaseData
- func (ba *BaseAccountData) GetLedgerCoreAccountData() ledgercore.AccountData
- func (ba *BaseAccountData) GetLedgerCoreVotingData() basics.VotingData
- func (ba *BaseAccountData) IsEmpty() bool
- func (z *BaseAccountData) MarshalMsg(b []byte) (o []byte)
- func (z *BaseAccountData) MsgIsZero() bool
- func (z *BaseAccountData) Msgsize() (s int)
- func (ba *BaseAccountData) NormalizedOnlineBalance(proto config.ConsensusParams) uint64
- func (ba *BaseAccountData) SetAccountData(ad *basics.AccountData)
- func (ba *BaseAccountData) SetCoreAccountData(ad *ledgercore.AccountData)
- func (z *BaseAccountData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *BaseAccountData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type BaseOnlineAccountData
- func (_ *BaseOnlineAccountData) CanMarshalMsg(z interface{}) bool
- func (_ *BaseOnlineAccountData) CanUnmarshalMsg(z interface{}) bool
- func (bo *BaseOnlineAccountData) GetOnlineAccount(addr basics.Address, normBalance uint64) ledgercore.OnlineAccount
- func (bo *BaseOnlineAccountData) GetOnlineAccountData(proto config.ConsensusParams, rewardsLevel uint64) basics.OnlineAccountData
- func (bo *BaseOnlineAccountData) IsEmpty() bool
- func (bo *BaseOnlineAccountData) IsVotingEmpty() bool
- func (z *BaseOnlineAccountData) MarshalMsg(b []byte) (o []byte)
- func (z *BaseOnlineAccountData) MsgIsZero() bool
- func (z *BaseOnlineAccountData) Msgsize() (s int)
- func (bo *BaseOnlineAccountData) NormalizedOnlineBalance(proto config.ConsensusParams) uint64
- func (bo *BaseOnlineAccountData) SetCoreAccountData(ad *ledgercore.AccountData)
- func (z *BaseOnlineAccountData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *BaseOnlineAccountData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type BaseVotingData
- func (_ *BaseVotingData) CanMarshalMsg(z interface{}) bool
- func (_ *BaseVotingData) CanUnmarshalMsg(z interface{}) bool
- func (bv BaseVotingData) IsEmpty() bool
- func (z *BaseVotingData) MarshalMsg(b []byte) (o []byte)
- func (z *BaseVotingData) MsgIsZero() bool
- func (z *BaseVotingData) Msgsize() (s int)
- func (bv *BaseVotingData) SetCoreAccountData(ad *ledgercore.AccountData)
- func (z *BaseVotingData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *BaseVotingData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type Batch
- type BatchFn
- type BatchScope
- type Catchpoint
- type CatchpointFirstStageInfo
- func (_ *CatchpointFirstStageInfo) CanMarshalMsg(z interface{}) bool
- func (_ *CatchpointFirstStageInfo) CanUnmarshalMsg(z interface{}) bool
- func (z *CatchpointFirstStageInfo) MarshalMsg(b []byte) (o []byte)
- func (z *CatchpointFirstStageInfo) MsgIsZero() bool
- func (z *CatchpointFirstStageInfo) Msgsize() (s int)
- func (z *CatchpointFirstStageInfo) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *CatchpointFirstStageInfo) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type CatchpointPendingHashesIter
- type CatchpointReader
- type CatchpointReaderWriter
- type CatchpointState
- type CatchpointWriter
- type CreatableRef
- type EncodedAccountsBatchIter
- type ErrIoErr
- type HashKind
- type InitParams
- type KVsIter
- type MerkleCommitter
- type NormalizedAccountBalance
- type OnlineAccountRef
- type OnlineAccountsReader
- type OnlineAccountsWriter
- type OrderedAccountsIter
- type Params
- type PersistedAccountData
- type PersistedKVData
- type PersistedOnlineAccountData
- type PersistedResourcesData
- type PersistedResourcesDataWithCreator
- type Reader
- type ReaderWriter
- type ResourceFlags
- func (_ ResourceFlags) CanMarshalMsg(z interface{}) bool
- func (_ *ResourceFlags) CanUnmarshalMsg(z interface{}) bool
- func (z ResourceFlags) MarshalMsg(b []byte) (o []byte)
- func (z ResourceFlags) MsgIsZero() bool
- func (z ResourceFlags) Msgsize() (s int)
- func (z *ResourceFlags) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *ResourceFlags) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type ResourceRef
- type ResourcesData
- func (_ *ResourcesData) CanMarshalMsg(z interface{}) bool
- func (_ *ResourcesData) CanUnmarshalMsg(z interface{}) bool
- func (rd *ResourcesData) ClearAppLocalState()
- func (rd *ResourcesData) ClearAppParams()
- func (rd *ResourcesData) ClearAssetHolding()
- func (rd *ResourcesData) ClearAssetParams()
- func (rd *ResourcesData) GetAppLocalState() basics.AppLocalState
- func (rd *ResourcesData) GetAppParams() basics.AppParams
- func (rd *ResourcesData) GetAssetHolding() basics.AssetHolding
- func (rd *ResourcesData) GetAssetParams() basics.AssetParams
- func (rd *ResourcesData) IsApp() bool
- func (rd *ResourcesData) IsAsset() bool
- func (rd *ResourcesData) IsEmpty() bool
- func (rd *ResourcesData) IsEmptyAppFields() bool
- func (rd *ResourcesData) IsEmptyAssetFields() bool
- func (rd *ResourcesData) IsHolding() bool
- func (rd *ResourcesData) IsOwning() bool
- func (z *ResourcesData) MarshalMsg(b []byte) (o []byte)
- func (z *ResourcesData) MsgIsZero() bool
- func (z *ResourcesData) Msgsize() (s int)
- func (rd *ResourcesData) SetAppData(ap ledgercore.AppParamsDelta, al ledgercore.AppLocalStateDelta)
- func (rd *ResourcesData) SetAppLocalState(als basics.AppLocalState)
- func (rd *ResourcesData) SetAppParams(ap basics.AppParams, haveHoldings bool)
- func (rd *ResourcesData) SetAssetData(ap ledgercore.AssetParamsDelta, ah ledgercore.AssetHoldingDelta)
- func (rd *ResourcesData) SetAssetHolding(ah basics.AssetHolding)
- func (rd *ResourcesData) SetAssetParams(ap basics.AssetParams, haveHoldings bool)
- func (z *ResourcesData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *ResourcesData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type RetryClearFn
- type Snapshot
- type SnapshotFn
- type SnapshotScope
- type SpVerificationCtxReader
- type SpVerificationCtxReaderWriter
- type SpVerificationCtxWriter
- type Store
- type TableIterator
- type Transaction
- type TransactionFn
- type TransactionScope
- type TxTailRound
- func (_ *TxTailRound) CanMarshalMsg(z interface{}) bool
- func (_ *TxTailRound) CanUnmarshalMsg(z interface{}) bool
- func (t *TxTailRound) Encode() ([]byte, crypto.Digest)
- func (z *TxTailRound) MarshalMsg(b []byte) (o []byte)
- func (z *TxTailRound) MsgIsZero() bool
- func (z *TxTailRound) Msgsize() (s int)
- func (z *TxTailRound) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *TxTailRound) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type TxTailRoundLease
- func (_ *TxTailRoundLease) CanMarshalMsg(z interface{}) bool
- func (_ *TxTailRoundLease) CanUnmarshalMsg(z interface{}) bool
- func (z *TxTailRoundLease) MarshalMsg(b []byte) (o []byte)
- func (z *TxTailRoundLease) MsgIsZero() bool
- func (z *TxTailRoundLease) Msgsize() (s int)
- func (z *TxTailRoundLease) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *TxTailRoundLease) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type UnfinishedCatchpointRecord
- type Writer
- type WriterTestExt
Constants ¶
const ( // CatchpointStateLastCatchpoint is written by a node once a catchpoint label is created for a round CatchpointStateLastCatchpoint = CatchpointState("lastCatchpoint") // CatchpointStateWritingFirstStageInfo state variable is set to 1 if catchpoint's first stage is unfinished, // and is 0 otherwise. Used to clear / restart the first stage after a crash. // This key is set in the same db transaction as the account updates, so the // unfinished first stage corresponds to the current db round. CatchpointStateWritingFirstStageInfo = CatchpointState("writingFirstStageInfo") // CatchpointStateWritingCatchpoint if there is an unfinished catchpoint, this state variable is set to // the catchpoint's round. Otherwise, it is set to 0. // DEPRECATED. CatchpointStateWritingCatchpoint = CatchpointState("writingCatchpoint") // CatchpointStateCatchupState is the state of the catchup process. The variable is stored only during the catchpoint catchup process, and removed afterward. CatchpointStateCatchupState = CatchpointState("catchpointCatchupState") // CatchpointStateCatchupLabel is the label to which the currently catchpoint catchup process is trying to catchup to. CatchpointStateCatchupLabel = CatchpointState("catchpointCatchupLabel") // CatchpointStateCatchupBlockRound is the block round that is associated with the current running catchpoint catchup. CatchpointStateCatchupBlockRound = CatchpointState("catchpointCatchupBlockRound") // CatchpointStateCatchupBalancesRound is the balance round that is associated with the current running catchpoint catchup. Typically it would be // equal to CatchpointStateCatchupBlockRound - 320. CatchpointStateCatchupBalancesRound = CatchpointState("catchpointCatchupBalancesRound") // CatchpointStateCatchupHashRound is the round that is associated with the hash of the merkle trie. Normally, it's identical to CatchpointStateCatchupBalancesRound, // however, it could differ when we catchup from a catchpoint that was created using a different version : in this case, // we set it to zero in order to reset the merkle trie. This would force the merkle trie to be re-build on startup ( if needed ). CatchpointStateCatchupHashRound = CatchpointState("catchpointCatchupHashRound") // CatchpointStateCatchpointLookback is the number of rounds we keep catchpoints for CatchpointStateCatchpointLookback = CatchpointState("catchpointLookback") // CatchpointStateCatchupVersion is the catchpoint version which the currently catchpoint catchup process is trying to catchup to. CatchpointStateCatchupVersion = CatchpointState("catchpointCatchupVersion") )
const HashKindEncodingIndex = 4
HashKindEncodingIndex defines the []byte offset where the hash kind is encoded.
Variables ¶
var AccountDBVersion = int32(11)
AccountDBVersion is the database version that this binary would know how to support and how to upgrade to. details about the content of each of the versions can be found in the upgrade functions upgradeDatabaseSchemaXXXX and their descriptions.
var CatchpointDirName = "catchpoints"
CatchpointDirName represents the directory name in which all the catchpoints files are stored
var ErrNotFound = errors.New("trackerdb: not found")
ErrNotFound is returned when a record is not found.
var MerkleCommitterNodesPerPage = int64(116)
MerkleCommitterNodesPerPage controls how many nodes will be stored in a single page value was calibrated using BenchmarkCalibrateNodesPerPage
var TrieCachedNodesCount = 9000
TrieCachedNodesCount defines how many balances trie nodes we would like to keep around in memory. value was calibrated using BenchmarkCalibrateCacheNodeSize
var TrieMemoryConfig = merkletrie.MemoryConfig{ NodesCountPerPage: MerkleCommitterNodesPerPage, CachedNodesCount: TrieCachedNodesCount, PageFillFactor: 0.95, MaxChildrenPagesThreshold: 64, }
TrieMemoryConfig is the memory configuration setup used for the merkle trie.
Functions ¶
func AccountDataResources ¶
func AccountDataResources( ctx context.Context, accountData *basics.AccountData, rowid int64, outputResourceCb func(ctx context.Context, rowid int64, cidx basics.CreatableIndex, rd *ResourcesData) error, ) error
AccountDataResources calls outputResourceCb with the data resources for the specified account.
func AccountHashBuilder ¶
func AccountHashBuilder(addr basics.Address, accountData basics.AccountData, encodedAccountData []byte) []byte
AccountHashBuilder calculates the hash key used for the trie by combining the account address and the account data
func AccountHashBuilderV6 ¶
func AccountHashBuilderV6(addr basics.Address, accountData *BaseAccountData, encodedAccountData []byte) []byte
AccountHashBuilderV6 calculates the hash key used for the trie by combining the account address and the account data
func BaseAccountDataMaxSize ¶
func BaseAccountDataMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func BaseOnlineAccountDataMaxSize ¶
func BaseOnlineAccountDataMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func BaseVotingDataMaxSize ¶
func BaseVotingDataMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func CatchpointFirstStageInfoMaxSize ¶
func CatchpointFirstStageInfoMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func GetEmptyDirs ¶
GetEmptyDirs returns a slice of paths for empty directories which are located in PathToScan arg
func KvHashBuilderV6 ¶
KvHashBuilderV6 calculates the hash key used for the trie by combining the key and value
func MakeCatchpointFilePath ¶
MakeCatchpointFilePath builds the path of a catchpoint file.
func RemoveSingleCatchpointFileFromDisk ¶
RemoveSingleCatchpointFileFromDisk removes a single catchpoint file from the disk. this function does not leave empty directories
func ResourceFlagsMaxSize ¶
func ResourceFlagsMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func ResourcesDataMaxSize ¶
func ResourcesDataMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func ResourcesHashBuilderV6 ¶
func ResourcesHashBuilderV6(rd *ResourcesData, addr basics.Address, cidx basics.CreatableIndex, updateRound uint64, encodedResourceData []byte) ([]byte, error)
ResourcesHashBuilderV6 calculates the hash key used for the trie by combining the creatable's resource data and its index
func TxTailRoundLeaseMaxSize ¶
func TxTailRoundLeaseMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func TxTailRoundMaxSize ¶
func TxTailRoundMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
Types ¶
type AccountAddressHash ¶
type AccountAddressHash struct { AccountRef AccountRef Digest []byte }
AccountAddressHash is used by Next to return a single account address and the associated hash.
type AccountRef ¶
type AccountRef interface { AccountRefMarker() String() string }
AccountRef is an opaque ref to an account in the db.
type AccountsReader ¶
type AccountsReader interface { LookupAccount(addr basics.Address) (data PersistedAccountData, err error) LookupResources(addr basics.Address, aidx basics.CreatableIndex, ctype basics.CreatableType) (data PersistedResourcesData, err error) LookupAllResources(addr basics.Address) (data []PersistedResourcesData, rnd basics.Round, err error) LookupLimitedResources(addr basics.Address, minIdx basics.CreatableIndex, maxCreatables uint64, ctype basics.CreatableType) (data []PersistedResourcesDataWithCreator, rnd basics.Round, err error) LookupKeyValue(key string) (pv PersistedKVData, err error) LookupKeysByPrefix(prefix string, maxKeyNum uint64, results map[string]bool, resultCount uint64) (round basics.Round, err error) LookupCreator(cidx basics.CreatableIndex, ctype basics.CreatableType) (addr basics.Address, ok bool, dbRound basics.Round, err error) Close() }
AccountsReader is the "optimized" read interface for: - accounts, resources, app kvs, creatables
type AccountsReaderExt ¶
type AccountsReaderExt interface { AccountsTotals(ctx context.Context, catchpointStaging bool) (totals ledgercore.AccountTotals, err error) AccountsHashRound(ctx context.Context) (hashrnd basics.Round, err error) LookupAccountAddressFromAddressID(ctx context.Context, ref AccountRef) (address basics.Address, err error) LookupAccountRowID(basics.Address) (ref AccountRef, err error) LookupResourceDataByAddrID(accountRef AccountRef, aidx basics.CreatableIndex) (data []byte, err error) TotalResources(ctx context.Context) (total uint64, err error) TotalAccounts(ctx context.Context) (total uint64, err error) TotalKVs(ctx context.Context) (total uint64, err error) TotalOnlineAccountRows(ctx context.Context) (total uint64, err error) TotalOnlineRoundParams(ctx context.Context) (total uint64, err error) AccountsRound() (rnd basics.Round, err error) LookupOnlineAccountDataByAddress(addr basics.Address) (ref OnlineAccountRef, data []byte, err error) AccountsOnlineTop(rnd basics.Round, offset uint64, n uint64, proto config.ConsensusParams) (map[basics.Address]*ledgercore.OnlineAccount, error) AccountsOnlineRoundParams() (onlineRoundParamsData []ledgercore.OnlineRoundParamsData, endRound basics.Round, err error) ExpiredOnlineAccountsForRound(rnd, voteRnd basics.Round, proto config.ConsensusParams, rewardsLevel uint64) (map[basics.Address]*basics.OnlineAccountData, error) OnlineAccountsAll(maxAccounts uint64) ([]PersistedOnlineAccountData, error) LoadTxTail(ctx context.Context, dbRound basics.Round) (roundData []*TxTailRound, roundHash []crypto.Digest, baseRound basics.Round, err error) LoadAllFullAccounts(ctx context.Context, balancesTable string, resourcesTable string, acctCb func(basics.Address, basics.AccountData)) (count int, err error) // testing Testing() AccountsReaderTestExt }
AccountsReaderExt is the read interface for: - accounts, resources, app kvs, creatables
type AccountsReaderTestExt ¶
type AccountsReaderTestExt interface { AccountsAllTest() (bals map[basics.Address]basics.AccountData, err error) CheckCreatablesTest(t *testing.T, iteration int, expectedDbImage map[basics.CreatableIndex]ledgercore.ModifiedCreatable) }
AccountsReaderTestExt is an interface to extend AccountsReaderExt with test-only methods
type AccountsReaderWriter ¶
type AccountsReaderWriter interface { // AccountsReader // AccountsWriter AccountsWriterExt AccountsReaderExt }
AccountsReaderWriter is AccountsReader+AccountsWriter
type AccountsWriter ¶
type AccountsWriter interface { InsertAccount(addr basics.Address, normBalance uint64, data BaseAccountData) (ref AccountRef, err error) DeleteAccount(ref AccountRef) (rowsAffected int64, err error) UpdateAccount(ref AccountRef, normBalance uint64, data BaseAccountData) (rowsAffected int64, err error) InsertResource(accountRef AccountRef, aidx basics.CreatableIndex, data ResourcesData) (ref ResourceRef, err error) DeleteResource(accountRef AccountRef, aidx basics.CreatableIndex) (rowsAffected int64, err error) UpdateResource(accountRef AccountRef, aidx basics.CreatableIndex, data ResourcesData) (rowsAffected int64, err error) UpsertKvPair(key string, value []byte) error DeleteKvPair(key string) error InsertCreatable(cidx basics.CreatableIndex, ctype basics.CreatableType, creator []byte) (ref CreatableRef, err error) DeleteCreatable(cidx basics.CreatableIndex, ctype basics.CreatableType) (rowsAffected int64, err error) Close() }
AccountsWriter is the write interface for: - accounts, resources, app kvs, creatables
type AccountsWriterExt ¶
type AccountsWriterExt interface { AccountsReset(ctx context.Context) error ResetAccountHashes(ctx context.Context) (err error) TxtailNewRound(ctx context.Context, baseRound basics.Round, roundData [][]byte, forgetBeforeRound basics.Round) error UpdateAccountsRound(rnd basics.Round) (err error) UpdateAccountsHashRound(ctx context.Context, hashRound basics.Round) (err error) AccountsPutTotals(totals ledgercore.AccountTotals, catchpointStaging bool) error OnlineAccountsDelete(forgetBefore basics.Round) (err error) AccountsPutOnlineRoundParams(onlineRoundParamsData []ledgercore.OnlineRoundParamsData, startRound basics.Round) error AccountsPruneOnlineRoundParams(deleteBeforeRound basics.Round) error }
AccountsWriterExt is the write interface used inside transactions and batch operations.
type BaseAccountData ¶
type BaseAccountData struct { Status basics.Status `codec:"a"` MicroAlgos basics.MicroAlgos `codec:"b"` RewardsBase uint64 `codec:"c"` RewardedMicroAlgos basics.MicroAlgos `codec:"d"` AuthAddr basics.Address `codec:"e"` TotalAppSchemaNumUint uint64 `codec:"f"` TotalAppSchemaNumByteSlice uint64 `codec:"g"` TotalExtraAppPages uint32 `codec:"h"` TotalAssetParams uint64 `codec:"i"` TotalAssets uint64 `codec:"j"` TotalAppParams uint64 `codec:"k"` TotalAppLocalStates uint64 `codec:"l"` TotalBoxes uint64 `codec:"m"` TotalBoxBytes uint64 `codec:"n"` IncentiveEligible bool `codec:"o"` LastProposed basics.Round `codec:"p"` LastHeartbeat basics.Round `codec:"q"` BaseVotingData // UpdateRound is the round that modified this account data last. Since we want all the nodes to have the exact same // value for this field, we'll be setting the value of this field to zero *before* the EnableAccountDataResourceSeparation // consensus parameter is being set. Once the above consensus takes place, this field would be populated with the // correct round number. UpdateRound uint64 `codec:"z"` // contains filtered or unexported fields }
BaseAccountData is the base struct used to store account data
func (*BaseAccountData) CanMarshalMsg ¶
func (_ *BaseAccountData) CanMarshalMsg(z interface{}) bool
func (*BaseAccountData) CanUnmarshalMsg ¶
func (_ *BaseAccountData) CanUnmarshalMsg(z interface{}) bool
func (*BaseAccountData) GetAccountData ¶
func (ba *BaseAccountData) GetAccountData() basics.AccountData
GetAccountData getter for account data.
func (*BaseAccountData) GetLedgerCoreAccountBaseData ¶
func (ba *BaseAccountData) GetLedgerCoreAccountBaseData() ledgercore.AccountBaseData
GetLedgerCoreAccountBaseData getter for account base data.
func (*BaseAccountData) GetLedgerCoreAccountData ¶
func (ba *BaseAccountData) GetLedgerCoreAccountData() ledgercore.AccountData
GetLedgerCoreAccountData getter for account data.
func (*BaseAccountData) GetLedgerCoreVotingData ¶
func (ba *BaseAccountData) GetLedgerCoreVotingData() basics.VotingData
GetLedgerCoreVotingData getter for voting data.
func (*BaseAccountData) IsEmpty ¶
func (ba *BaseAccountData) IsEmpty() bool
IsEmpty return true if any of the fields other then the UpdateRound are non-zero.
func (*BaseAccountData) MarshalMsg ¶
func (z *BaseAccountData) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*BaseAccountData) MsgIsZero ¶
func (z *BaseAccountData) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*BaseAccountData) Msgsize ¶
func (z *BaseAccountData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BaseAccountData) NormalizedOnlineBalance ¶
func (ba *BaseAccountData) NormalizedOnlineBalance(proto config.ConsensusParams) uint64
NormalizedOnlineBalance getter for normalized online balance.
func (*BaseAccountData) SetAccountData ¶
func (ba *BaseAccountData) SetAccountData(ad *basics.AccountData)
SetAccountData setter for account data.
func (*BaseAccountData) SetCoreAccountData ¶
func (ba *BaseAccountData) SetCoreAccountData(ad *ledgercore.AccountData)
SetCoreAccountData setter for core account data.
func (*BaseAccountData) UnmarshalMsg ¶
func (z *BaseAccountData) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*BaseAccountData) UnmarshalMsgWithState ¶
func (z *BaseAccountData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type BaseOnlineAccountData ¶
type BaseOnlineAccountData struct { BaseVotingData LastProposed basics.Round `codec:"V"` LastHeartbeat basics.Round `codec:"W"` IncentiveEligible bool `codec:"X"` MicroAlgos basics.MicroAlgos `codec:"Y"` RewardsBase uint64 `codec:"Z"` // contains filtered or unexported fields }
BaseOnlineAccountData is the base struct used to store online account data
func (*BaseOnlineAccountData) CanMarshalMsg ¶
func (_ *BaseOnlineAccountData) CanMarshalMsg(z interface{}) bool
func (*BaseOnlineAccountData) CanUnmarshalMsg ¶
func (_ *BaseOnlineAccountData) CanUnmarshalMsg(z interface{}) bool
func (*BaseOnlineAccountData) GetOnlineAccount ¶
func (bo *BaseOnlineAccountData) GetOnlineAccount(addr basics.Address, normBalance uint64) ledgercore.OnlineAccount
GetOnlineAccount returns ledgercore.OnlineAccount for top online accounts / voters TODO: unify
func (*BaseOnlineAccountData) GetOnlineAccountData ¶
func (bo *BaseOnlineAccountData) GetOnlineAccountData(proto config.ConsensusParams, rewardsLevel uint64) basics.OnlineAccountData
GetOnlineAccountData returns basics.OnlineAccountData for lookup agreement TODO: unify with GetOnlineAccount/ledgercore.OnlineAccount
func (*BaseOnlineAccountData) IsEmpty ¶
func (bo *BaseOnlineAccountData) IsEmpty() bool
IsEmpty return true if all of the fields are zero.
func (*BaseOnlineAccountData) IsVotingEmpty ¶
func (bo *BaseOnlineAccountData) IsVotingEmpty() bool
IsVotingEmpty checks if voting data fields are empty
func (*BaseOnlineAccountData) MarshalMsg ¶
func (z *BaseOnlineAccountData) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*BaseOnlineAccountData) MsgIsZero ¶
func (z *BaseOnlineAccountData) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*BaseOnlineAccountData) Msgsize ¶
func (z *BaseOnlineAccountData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BaseOnlineAccountData) NormalizedOnlineBalance ¶
func (bo *BaseOnlineAccountData) NormalizedOnlineBalance(proto config.ConsensusParams) uint64
NormalizedOnlineBalance getter for normalized online balance.
func (*BaseOnlineAccountData) SetCoreAccountData ¶
func (bo *BaseOnlineAccountData) SetCoreAccountData(ad *ledgercore.AccountData)
SetCoreAccountData setter for core account data.
func (*BaseOnlineAccountData) UnmarshalMsg ¶
func (z *BaseOnlineAccountData) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*BaseOnlineAccountData) UnmarshalMsgWithState ¶
func (z *BaseOnlineAccountData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type BaseVotingData ¶
type BaseVotingData struct { VoteID crypto.OneTimeSignatureVerifier `codec:"A"` SelectionID crypto.VRFVerifier `codec:"B"` VoteFirstValid basics.Round `codec:"C"` VoteLastValid basics.Round `codec:"D"` VoteKeyDilution uint64 `codec:"E"` StateProofID merklesignature.Commitment `codec:"F"` // contains filtered or unexported fields }
BaseVotingData is the base struct used to store voting data
func (*BaseVotingData) CanMarshalMsg ¶
func (_ *BaseVotingData) CanMarshalMsg(z interface{}) bool
func (*BaseVotingData) CanUnmarshalMsg ¶
func (_ *BaseVotingData) CanUnmarshalMsg(z interface{}) bool
func (BaseVotingData) IsEmpty ¶
func (bv BaseVotingData) IsEmpty() bool
IsEmpty returns true if all of the fields are zero.
func (*BaseVotingData) MarshalMsg ¶
func (z *BaseVotingData) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*BaseVotingData) MsgIsZero ¶
func (z *BaseVotingData) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*BaseVotingData) Msgsize ¶
func (z *BaseVotingData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BaseVotingData) SetCoreAccountData ¶
func (bv *BaseVotingData) SetCoreAccountData(ad *ledgercore.AccountData)
SetCoreAccountData initializes baseVotingData from ledgercore.AccountData
func (*BaseVotingData) UnmarshalMsg ¶
func (z *BaseVotingData) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*BaseVotingData) UnmarshalMsgWithState ¶
func (z *BaseVotingData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Batch ¶
type Batch interface { BatchScope Commit() error Close() error }
Batch is an atomic write-only accecssor to the store.
type BatchFn ¶
type BatchFn func(ctx context.Context, tx BatchScope) error
BatchFn is the callback lambda used in `Batch`.
type BatchScope ¶
type BatchScope interface { Writer ResetTransactionWarnDeadline(ctx context.Context, deadline time.Time) (prevDeadline time.Time, err error) }
BatchScope is an atomic write-only scope to the store.
type Catchpoint ¶
type Catchpoint interface { // reader MakeOrderedAccountsIter(accountCount int) OrderedAccountsIter // writer MakeCatchpointWriter() (CatchpointWriter, error) // reader/writer MakeCatchpointReaderWriter() (CatchpointReaderWriter, error) MakeMerkleCommitter(staging bool) (MerkleCommitter, error) }
Catchpoint is currently holding most of the methods related to catchpoint.
TODO: we still need to do a refactoring pass on catchpoint
there are two distinct set of methods present: - read/write ops for managing catchpoint data - read/write ops on trackerdb to support building catchpoints we should split these two sets of methods into two separate interfaces
type CatchpointFirstStageInfo ¶
type CatchpointFirstStageInfo struct { Totals ledgercore.AccountTotals `codec:"accountTotals"` TrieBalancesHash crypto.Digest `codec:"trieBalancesHash"` // Total number of accounts in the catchpoint data file. Only set when catchpoint // data files are generated. TotalAccounts uint64 `codec:"accountsCount"` // Total number of accounts in the catchpoint data file. Only set when catchpoint // data files are generated. TotalKVs uint64 `codec:"kvsCount"` TotalOnlineAccounts uint64 `codec:"onlineAccountsCount"` TotalOnlineRoundParams uint64 `codec:"onlineRoundParamsCount"` // Total number of chunks in the catchpoint data file. Only set when catchpoint // data files are generated. TotalChunks uint64 `codec:"chunksCount"` // BiggestChunkLen is the size in the bytes of the largest chunk, used when re-packing. BiggestChunkLen uint64 `codec:"biggestChunk"` // StateProofVerificationHash is the hash of the state proof verification data contained in the catchpoint data file. StateProofVerificationHash crypto.Digest `codec:"spVerificationHash"` // OnlineAccountsHash and OnlineRoundParamsHash provide verification for these tables in the catchpoint data file. OnlineAccountsHash crypto.Digest `codec:"onlineAccountsHash"` OnlineRoundParamsHash crypto.Digest `codec:"onlineRoundParamsHash"` // contains filtered or unexported fields }
CatchpointFirstStageInfo For the `catchpointfirststageinfo` table.
func (*CatchpointFirstStageInfo) CanMarshalMsg ¶
func (_ *CatchpointFirstStageInfo) CanMarshalMsg(z interface{}) bool
func (*CatchpointFirstStageInfo) CanUnmarshalMsg ¶
func (_ *CatchpointFirstStageInfo) CanUnmarshalMsg(z interface{}) bool
func (*CatchpointFirstStageInfo) MarshalMsg ¶
func (z *CatchpointFirstStageInfo) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*CatchpointFirstStageInfo) MsgIsZero ¶
func (z *CatchpointFirstStageInfo) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*CatchpointFirstStageInfo) Msgsize ¶
func (z *CatchpointFirstStageInfo) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*CatchpointFirstStageInfo) UnmarshalMsg ¶
func (z *CatchpointFirstStageInfo) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*CatchpointFirstStageInfo) UnmarshalMsgWithState ¶
func (z *CatchpointFirstStageInfo) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type CatchpointPendingHashesIter ¶
type CatchpointPendingHashesIter interface { Next(ctx context.Context) (hashes [][]byte, err error) Close() }
CatchpointPendingHashesIter is an iterator for pending hashes.
type CatchpointReader ¶
type CatchpointReader interface { GetCatchpoint(ctx context.Context, round basics.Round) (fileName string, catchpoint string, fileSize int64, err error) GetOldestCatchpointFiles(ctx context.Context, fileCount int, filesToKeep int) (fileNames map[basics.Round]string, err error) ReadCatchpointStateUint64(ctx context.Context, stateName CatchpointState) (val uint64, err error) ReadCatchpointStateString(ctx context.Context, stateName CatchpointState) (val string, err error) SelectUnfinishedCatchpoints(ctx context.Context) ([]UnfinishedCatchpointRecord, error) SelectCatchpointFirstStageInfo(ctx context.Context, round basics.Round) (CatchpointFirstStageInfo, bool, error) SelectOldCatchpointFirstStageInfoRounds(ctx context.Context, maxRound basics.Round) ([]basics.Round, error) }
CatchpointReader is the read interface for: - catchpoints
type CatchpointReaderWriter ¶
type CatchpointReaderWriter interface { CatchpointReader CatchpointWriter }
CatchpointReaderWriter is CatchpointReader+CatchpointWriter
type CatchpointState ¶
type CatchpointState string
CatchpointState is used to store catchpoint related variables into the catchpointstate table.
type CatchpointWriter ¶
type CatchpointWriter interface { CreateCatchpointStagingHashesIndex(ctx context.Context) (err error) StoreCatchpoint(ctx context.Context, round basics.Round, fileName string, catchpoint string, fileSize int64) (err error) WriteCatchpointStateUint64(ctx context.Context, stateName CatchpointState, setValue uint64) (err error) WriteCatchpointStateString(ctx context.Context, stateName CatchpointState, setValue string) (err error) WriteCatchpointStagingBalances(ctx context.Context, bals []NormalizedAccountBalance) error WriteCatchpointStagingKVs(ctx context.Context, keys [][]byte, values [][]byte, hashes [][]byte) error WriteCatchpointStagingOnlineAccounts(context.Context, []encoded.OnlineAccountRecordV6) error WriteCatchpointStagingOnlineRoundParams(context.Context, []encoded.OnlineRoundParamsRecordV6) error WriteCatchpointStagingCreatable(ctx context.Context, bals []NormalizedAccountBalance) error WriteCatchpointStagingHashes(ctx context.Context, bals []NormalizedAccountBalance) error ApplyCatchpointStagingBalances(ctx context.Context, balancesRound basics.Round, merkleRootRound basics.Round) (err error) ApplyCatchpointStagingTablesV7(ctx context.Context) error ResetCatchpointStagingBalances(ctx context.Context, newCatchup bool) (err error) InsertUnfinishedCatchpoint(ctx context.Context, round basics.Round, blockHash crypto.Digest) error DeleteUnfinishedCatchpoint(ctx context.Context, round basics.Round) error DeleteOldCatchpointFirstStageInfo(ctx context.Context, maxRoundToDelete basics.Round) error InsertOrReplaceCatchpointFirstStageInfo(ctx context.Context, round basics.Round, info *CatchpointFirstStageInfo) error DeleteStoredCatchpoints(ctx context.Context, dbDirectory string) (err error) }
CatchpointWriter is the write interface for: - catchpoints
type CreatableRef ¶
type CreatableRef interface {
CreatableRefMarker()
}
CreatableRef is an opaque ref to a creatable in the db.
type EncodedAccountsBatchIter ¶
type EncodedAccountsBatchIter interface { Next(ctx context.Context, accountCount int, resourceCount int) (bals []encoded.BalanceRecordV6, numAccountsProcessed uint64, err error) Close() }
EncodedAccountsBatchIter is an iterator for a accounts.
type ErrIoErr ¶
type ErrIoErr struct {
InnerError error
}
ErrIoErr is returned when a Disk/IO error is encountered
type HashKind ¶
type HashKind byte
HashKind enumerates the possible data types hashed into a catchpoint merkle trie. Each merkle trie hash includes the HashKind byte at a known-offset. By encoding HashKind at a known-offset, it's possible for hash readers to disambiguate the hashed resource.
Defines known kinds of hashes. Changing an enum ordinal value is a breaking change.
type InitParams ¶
InitParams params used during db init
type MerkleCommitter ¶
type MerkleCommitter interface { StorePage(page uint64, content []byte) error LoadPage(page uint64) (content []byte, err error) }
MerkleCommitter allows storing and loading merkletrie pages from a sqlite database.
type NormalizedAccountBalance ¶
type NormalizedAccountBalance struct { // The public key address to which the account belongs. Address basics.Address // accountData contains the baseAccountData for that account. AccountData BaseAccountData // resources is a map, where the key is the creatable index, and the value is the resource data. Resources map[basics.CreatableIndex]ResourcesData // encodedAccountData contains the baseAccountData encoded bytes that are going to be written to the accountbase table. EncodedAccountData []byte // accountHashes contains a list of all the hashes that would need to be added to the merkle trie for that account. // on V6, we could have multiple hashes, since we have separate account/resource hashes. AccountHashes [][]byte // normalizedBalance contains the normalized balance for the account. NormalizedBalance uint64 // encodedResources provides the encoded form of the resources EncodedResources map[basics.CreatableIndex][]byte // partial balance indicates that the original account balance was split into multiple parts in catchpoint creation time PartialBalance bool }
NormalizedAccountBalance is a staging area for a catchpoint file account information before it's being added to the catchpoint staging tables.
type OnlineAccountRef ¶
type OnlineAccountRef interface {
OnlineAccountRefMarker()
}
OnlineAccountRef is an opaque ref to an "online" account in the db.
type OnlineAccountsReader ¶
type OnlineAccountsReader interface { LookupOnline(addr basics.Address, rnd basics.Round) (data PersistedOnlineAccountData, err error) LookupOnlineRoundParams(rnd basics.Round) (onlineRoundParamsData ledgercore.OnlineRoundParamsData, err error) LookupOnlineHistory(addr basics.Address) (result []PersistedOnlineAccountData, rnd basics.Round, err error) Close() }
OnlineAccountsReader is the read interface for: - online accounts
type OnlineAccountsWriter ¶
type OnlineAccountsWriter interface { InsertOnlineAccount(addr basics.Address, normBalance uint64, data BaseOnlineAccountData, updRound uint64, voteLastValid uint64) (ref OnlineAccountRef, err error) Close() }
OnlineAccountsWriter is the write interface for: - online accounts
type OrderedAccountsIter ¶
type OrderedAccountsIter interface { Next(ctx context.Context) (acct []AccountAddressHash, processedRecords int, err error) Close(ctx context.Context) (err error) }
OrderedAccountsIter is an iterator for Ordered Accounts.
type Params ¶
type Params struct { InitAccounts map[basics.Address]basics.AccountData InitProto protocol.ConsensusVersion GenesisHash crypto.Digest FromCatchpoint bool CatchpointEnabled bool DbPathPrefix string BlockDb db.Pair }
Params contains parameters for initializing trackerDB
type PersistedAccountData ¶
type PersistedAccountData struct { // The address of the account. In contrasts to maps, having this value explicitly here allows us to use this // data structure in queues directly, without "attaching" the address as the address as the map key. Addr basics.Address // The underlaying account data AccountData BaseAccountData // The reference to the stored object, when available. If the entry was loaded from the disk, then we have the ref for it. Entries // that dont have ref ( hence, ref == nil ) represent either deleted accounts or non-existing accounts. Ref AccountRef // the round number that is associated with the accountData. This field is needed so that we can maintain a correct // lruAccounts cache. We use it to ensure that the entries on the lruAccounts.accountsList are the latest ones. // this becomes an issue since while we attempt to write an update to disk, we might be reading an entry and placing // it on the lruAccounts.pendingAccounts; The commitRound doesn't attempt to flush the pending accounts, but rather // just write the latest ( which is correct ) to the lruAccounts.accountsList. later on, during on newBlockImpl, we // want to ensure that the "real" written value isn't being overridden by the value from the pending accounts. Round basics.Round }
PersistedAccountData is used for representing a single account stored on the disk. In addition to the basics.AccountData, it also stores complete referencing information used to maintain the base accounts list.
func (*PersistedAccountData) Before ¶
func (pac *PersistedAccountData) Before(other *PersistedAccountData) bool
Before compares the round numbers of two persistedAccountData and determines if the current persistedAccountData happened before the other.
type PersistedKVData ¶
type PersistedKVData struct { // kv value Value []byte // the round number that is associated with the kv value. This field is the corresponding one to the round field // in persistedAccountData, and serves the same purpose. Round basics.Round }
PersistedKVData represents the stored entry behind a application boxed key/value.
func (PersistedKVData) Before ¶
func (prd PersistedKVData) Before(other *PersistedKVData) bool
Before compares the round numbers of two persistedKVData and determines if the current persistedKVData happened before the other.
type PersistedOnlineAccountData ¶
type PersistedOnlineAccountData struct { Addr basics.Address AccountData BaseOnlineAccountData Ref OnlineAccountRef // the round number that is associated with the baseOnlineAccountData. This field is the corresponding one to the round field // in persistedAccountData, and serves the same purpose. This value comes from account rounds table and correspond to // the last trackers db commit round. Round basics.Round // the round number that the online account is for, i.e. account state change round. UpdRound basics.Round }
PersistedOnlineAccountData is exported view of persistedOnlineAccountData
func (*PersistedOnlineAccountData) Before ¶
func (pac *PersistedOnlineAccountData) Before(other *PersistedOnlineAccountData) bool
Before compares the round numbers of two persistedAccountData and determines if the current persistedAccountData happened before the other.
type PersistedResourcesData ¶
type PersistedResourcesData struct { // AcctRef is the stored object reference of the account address that holds this resource. // it is used in update/delete operations so must be filled for existing records. // resolution is a multi stage process: // - baseResources cache might have valid entries // - baseAccount cache might have an entry for the address with rowid set // - when loading non-cached resources in resourcesLoadOld // - when creating new accounts in accountsNewRound AcctRef AccountRef // creatable index Aidx basics.CreatableIndex // actual resource data Data ResourcesData // the round number that is associated with the resourcesData. This field is the corresponding one to the round field // in persistedAccountData, and serves the same purpose. Round basics.Round }
PersistedResourcesData is exported view of persistedResourcesData
func (*PersistedResourcesData) AccountResource ¶
func (prd *PersistedResourcesData) AccountResource() ledgercore.AccountResource
AccountResource returns the corresponding account resource data based on the type of resource.
func (*PersistedResourcesData) Before ¶
func (prd *PersistedResourcesData) Before(other *PersistedResourcesData) bool
Before compares the round numbers of two persistedResourcesData and determines if the current persistedResourcesData happened before the other.
type PersistedResourcesDataWithCreator ¶
type PersistedResourcesDataWithCreator struct { PersistedResourcesData // the address of the account that created this resource Creator basics.Address }
PersistedResourcesDataWithCreator is exported view of persistedResourcesData inclusive of creator
type Reader ¶
type Reader interface { MakeAccountsReader() (AccountsReaderExt, error) MakeAccountsOptimizedReader() (AccountsReader, error) MakeOnlineAccountsOptimizedReader() (OnlineAccountsReader, error) MakeSpVerificationCtxReader() SpVerificationCtxReader // catchpoint // Note: BuildMerkleTrie() needs this on the reader handle in sqlite to not get locked by write txns MakeCatchpointPendingHashesIterator(hashCount int) CatchpointPendingHashesIter // Note: Catchpoint tracker needs this on the reader handle in sqlite to not get locked by write txns MakeCatchpointReader() (CatchpointReader, error) MakeEncodedAccountsBatchIter() EncodedAccountsBatchIter MakeKVsIter(ctx context.Context) (KVsIter, error) MakeOnlineAccountsIter(ctx context.Context, useStaging bool) (TableIterator[*encoded.OnlineAccountRecordV6], error) MakeOnlineRoundParamsIter(ctx context.Context, useStaging bool) (TableIterator[*encoded.OnlineRoundParamsRecordV6], error) }
Reader is the interface for the trackerdb read operations.
type ReaderWriter ¶
type ReaderWriter interface { Reader Writer // init RunMigrations(ctx context.Context, params Params, log logging.Logger, targetVersion int32) (mgr InitParams, err error) // Note: at the moment, catchpoint methods are only accesible via reader/writer Catchpoint }
ReaderWriter is the interface for the trackerdb read/write operations.
Some of the operatiosn available here might not be present in neither the Reader nor the Writer interfaces. This is because some operations might require to be able to read and write at the same time.
type ResourceFlags ¶
type ResourceFlags uint8
ResourceFlags are bitmask used to indicate which portions ofa resources are used.
const ( // ResourceFlagsHolding indicates "Holding" ResourceFlagsHolding ResourceFlags = 0 // ResourceFlagsNotHolding indicates "Not Holding" ResourceFlagsNotHolding ResourceFlags = 1 // ResourceFlagsOwnership indicates "Ownerhip" ResourceFlagsOwnership ResourceFlags = 2 // ResourceFlagsEmptyAsset indicates "Empty Asset" ResourceFlagsEmptyAsset ResourceFlags = 4 // ResourceFlagsEmptyApp indicates "Empty App" ResourceFlagsEmptyApp ResourceFlags = 8 )
func (ResourceFlags) CanMarshalMsg ¶
func (_ ResourceFlags) CanMarshalMsg(z interface{}) bool
func (*ResourceFlags) CanUnmarshalMsg ¶
func (_ *ResourceFlags) CanUnmarshalMsg(z interface{}) bool
func (ResourceFlags) MarshalMsg ¶
func (z ResourceFlags) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (ResourceFlags) MsgIsZero ¶
func (z ResourceFlags) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (ResourceFlags) Msgsize ¶
func (z ResourceFlags) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ResourceFlags) UnmarshalMsg ¶
func (z *ResourceFlags) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*ResourceFlags) UnmarshalMsgWithState ¶
func (z *ResourceFlags) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ResourceRef ¶
type ResourceRef interface {
ResourceRefMarker()
}
ResourceRef is an opaque ref to a resource in the db.
type ResourcesData ¶
type ResourcesData struct { // asset parameters ( basics.AssetParams ) Total uint64 `codec:"a"` Decimals uint32 `codec:"b"` DefaultFrozen bool `codec:"c"` UnitName string `codec:"d"` AssetName string `codec:"e"` URL string `codec:"f"` MetadataHash [32]byte `codec:"g"` Manager basics.Address `codec:"h"` Reserve basics.Address `codec:"i"` Freeze basics.Address `codec:"j"` Clawback basics.Address `codec:"k"` // asset holding ( basics.AssetHolding ) Amount uint64 `codec:"l"` Frozen bool `codec:"m"` // application local state ( basics.AppLocalState ) SchemaNumUint uint64 `codec:"n"` SchemaNumByteSlice uint64 `codec:"o"` KeyValue basics.TealKeyValue `codec:"p"` // application global params ( basics.AppParams ) ApprovalProgram []byte `codec:"q,allocbound=config.MaxAvailableAppProgramLen"` ClearStateProgram []byte `codec:"r,allocbound=config.MaxAvailableAppProgramLen"` GlobalState basics.TealKeyValue `codec:"s"` LocalStateSchemaNumUint uint64 `codec:"t"` LocalStateSchemaNumByteSlice uint64 `codec:"u"` GlobalStateSchemaNumUint uint64 `codec:"v"` GlobalStateSchemaNumByteSlice uint64 `codec:"w"` ExtraProgramPages uint32 `codec:"x"` // ResourceFlags helps to identify which portions of this structure should be used; in particular, it // helps to provide a marker - i.e. whether the account was, for instance, opted-in for the asset compared // to just being the owner of the asset. A comparison against the empty structure doesn't work here - // since both the holdings and the parameters are allowed to be all at their default values. ResourceFlags ResourceFlags `codec:"y"` // UpdateRound is the round that modified this resource last. Since we want all the nodes to have the exact same // value for this field, we'll be setting the value of this field to zero *before* the EnableAccountDataResourceSeparation // consensus parameter is being set. Once the above consensus takes place, this field would be populated with the // correct round number. UpdateRound uint64 `codec:"z"` // contains filtered or unexported fields }
ResourcesData holds the resource data that will be stored.
func MakeResourcesData ¶
func MakeResourcesData(rnd uint64) ResourcesData
MakeResourcesData returns a new empty instance of resourcesData. Using this constructor method is necessary because of the ResourceFlags field. An optional rnd args sets UpdateRound
func (*ResourcesData) CanMarshalMsg ¶
func (_ *ResourcesData) CanMarshalMsg(z interface{}) bool
func (*ResourcesData) CanUnmarshalMsg ¶
func (_ *ResourcesData) CanUnmarshalMsg(z interface{}) bool
func (*ResourcesData) ClearAppLocalState ¶
func (rd *ResourcesData) ClearAppLocalState()
ClearAppLocalState clears app local state.
func (*ResourcesData) ClearAppParams ¶
func (rd *ResourcesData) ClearAppParams()
ClearAppParams clears the app params.
func (*ResourcesData) ClearAssetHolding ¶
func (rd *ResourcesData) ClearAssetHolding()
ClearAssetHolding clears asset holding.
func (*ResourcesData) ClearAssetParams ¶
func (rd *ResourcesData) ClearAssetParams()
ClearAssetParams clears the asset params.
func (*ResourcesData) GetAppLocalState ¶
func (rd *ResourcesData) GetAppLocalState() basics.AppLocalState
GetAppLocalState getter for app local state.
func (*ResourcesData) GetAppParams ¶
func (rd *ResourcesData) GetAppParams() basics.AppParams
GetAppParams getter for app params.
func (*ResourcesData) GetAssetHolding ¶
func (rd *ResourcesData) GetAssetHolding() basics.AssetHolding
GetAssetHolding getter for asset holding.
func (*ResourcesData) GetAssetParams ¶
func (rd *ResourcesData) GetAssetParams() basics.AssetParams
GetAssetParams getter for asset params.
func (*ResourcesData) IsApp ¶
func (rd *ResourcesData) IsApp() bool
IsApp returns true if the flag is ResourceFlagsEmptyApp and the fields are not empty.
func (*ResourcesData) IsAsset ¶
func (rd *ResourcesData) IsAsset() bool
IsAsset returns true if the flag is ResourceFlagsEmptyAsset and the fields are not empty.
func (*ResourcesData) IsEmpty ¶
func (rd *ResourcesData) IsEmpty() bool
IsEmpty returns true if the resource flag is not an app or asset.
func (*ResourcesData) IsEmptyAppFields ¶
func (rd *ResourcesData) IsEmptyAppFields() bool
IsEmptyAppFields returns true if the app fields are empty.
func (*ResourcesData) IsEmptyAssetFields ¶
func (rd *ResourcesData) IsEmptyAssetFields() bool
IsEmptyAssetFields returns true if the asset fields are empty.
func (*ResourcesData) IsHolding ¶
func (rd *ResourcesData) IsHolding() bool
IsHolding returns true if the resource flag is ResourceFlagsHolding
func (*ResourcesData) IsOwning ¶
func (rd *ResourcesData) IsOwning() bool
IsOwning returns true if the resource flag is ResourceFlagsOwnership
func (*ResourcesData) MarshalMsg ¶
func (z *ResourcesData) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*ResourcesData) MsgIsZero ¶
func (z *ResourcesData) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*ResourcesData) Msgsize ¶
func (z *ResourcesData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ResourcesData) SetAppData ¶
func (rd *ResourcesData) SetAppData(ap ledgercore.AppParamsDelta, al ledgercore.AppLocalStateDelta)
SetAppData setter for app data.
func (*ResourcesData) SetAppLocalState ¶
func (rd *ResourcesData) SetAppLocalState(als basics.AppLocalState)
SetAppLocalState setter for app local state.
func (*ResourcesData) SetAppParams ¶
func (rd *ResourcesData) SetAppParams(ap basics.AppParams, haveHoldings bool)
SetAppParams setter for app params.
func (*ResourcesData) SetAssetData ¶
func (rd *ResourcesData) SetAssetData(ap ledgercore.AssetParamsDelta, ah ledgercore.AssetHoldingDelta)
SetAssetData setter for asset data.
func (*ResourcesData) SetAssetHolding ¶
func (rd *ResourcesData) SetAssetHolding(ah basics.AssetHolding)
SetAssetHolding setter for asset holding.
func (*ResourcesData) SetAssetParams ¶
func (rd *ResourcesData) SetAssetParams(ap basics.AssetParams, haveHoldings bool)
SetAssetParams setter for asset params.
func (*ResourcesData) UnmarshalMsg ¶
func (z *ResourcesData) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*ResourcesData) UnmarshalMsgWithState ¶
func (z *ResourcesData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type RetryClearFn ¶
RetryClearFn is the rollback callback lambda used in `TransactionWithRetryClearFn`.
type Snapshot ¶
type Snapshot interface { SnapshotScope Close() error }
Snapshot is an atomic read-only accecssor to the store.
type SnapshotFn ¶
type SnapshotFn func(ctx context.Context, tx SnapshotScope) error
SnapshotFn is the callback lambda used in `Snapshot`.
type SnapshotScope ¶
type SnapshotScope interface { Reader ResetTransactionWarnDeadline(ctx context.Context, deadline time.Time) (prevDeadline time.Time, err error) }
SnapshotScope is an atomic read-only scope to the store.
type SpVerificationCtxReader ¶
type SpVerificationCtxReader interface { LookupSPContext(stateProofLastAttestedRound basics.Round) (*ledgercore.StateProofVerificationContext, error) GetAllSPContexts(ctx context.Context) ([]ledgercore.StateProofVerificationContext, error) GetAllSPContextsFromCatchpointTbl(ctx context.Context) ([]ledgercore.StateProofVerificationContext, error) }
SpVerificationCtxReader is a reader abstraction for stateproof verification tracker Use with SnapshotScope
type SpVerificationCtxReaderWriter ¶
type SpVerificationCtxReaderWriter interface { SpVerificationCtxReader SpVerificationCtxWriter }
SpVerificationCtxReaderWriter is SpVerificationCtxReader+SpVerificationCtxWriter Use with TransactionScope
type SpVerificationCtxWriter ¶
type SpVerificationCtxWriter interface { DeleteOldSPContexts(ctx context.Context, earliestLastAttestedRound basics.Round) error StoreSPContexts(ctx context.Context, verificationContext []*ledgercore.StateProofVerificationContext) error StoreSPContextsToCatchpointTbl(ctx context.Context, verificationContexts []ledgercore.StateProofVerificationContext) error }
SpVerificationCtxWriter is a writer abstraction for stateproof verification tracker Use with BatchScope
type Store ¶
type Store interface { ReaderWriter // settings SetSynchronousMode(ctx context.Context, mode db.SynchronousMode, fullfsync bool) (err error) // batch support Batch(fn BatchFn) (err error) BatchContext(ctx context.Context, fn BatchFn) (err error) BeginBatch(ctx context.Context) (Batch, error) // snapshot support Snapshot(fn SnapshotFn) (err error) SnapshotContext(ctx context.Context, fn SnapshotFn) (err error) BeginSnapshot(ctx context.Context) (Snapshot, error) // transaction support Transaction(fn TransactionFn) (err error) TransactionWithRetryClearFn(TransactionFn, RetryClearFn) (err error) TransactionContext(ctx context.Context, fn TransactionFn) (err error) TransactionContextWithRetryClearFn(context.Context, TransactionFn, RetryClearFn) (err error) BeginTransaction(ctx context.Context) (Transaction, error) // maintenance Vacuum(ctx context.Context) (stats db.VacuumStats, err error) // testing ResetToV6Test(ctx context.Context) error // cleanup Close() }
Store is the interface for the tracker db.
type TableIterator ¶
TableIterator is used to add online accounts and online round params to catchpoint files.
type Transaction ¶
type Transaction interface { TransactionScope Commit() error Close() error }
Transaction is an atomic read/write accecssor to the store.
type TransactionFn ¶
type TransactionFn func(ctx context.Context, tx TransactionScope) error
TransactionFn is the callback lambda used in `Transaction`.
type TransactionScope ¶
type TransactionScope interface { ReaderWriter ResetTransactionWarnDeadline(ctx context.Context, deadline time.Time) (prevDeadline time.Time, err error) }
TransactionScope is an atomic read/write scope to the store.
type TxTailRound ¶
type TxTailRound struct { TxnIDs []transactions.Txid `codec:"i,allocbound=-"` LastValid []basics.Round `codec:"v,allocbound=-"` Leases []TxTailRoundLease `codec:"l,allocbound=-"` Hdr bookkeeping.BlockHeader `codec:"h,allocbound=-"` // contains filtered or unexported fields }
TxTailRound contains the information about a single round of transactions. The TxnIDs and LastValid would both be of the same length, and are stored in that way for efficient message=pack encoding. The Leases would point to the respective transaction index. Note that this isn’t optimized for storing leases, as leases are extremely rare.
func TxTailRoundFromBlock ¶
func TxTailRoundFromBlock(blk bookkeeping.Block) (*TxTailRound, error)
TxTailRoundFromBlock creates a TxTailRound for the given block
func (*TxTailRound) CanMarshalMsg ¶
func (_ *TxTailRound) CanMarshalMsg(z interface{}) bool
func (*TxTailRound) CanUnmarshalMsg ¶
func (_ *TxTailRound) CanUnmarshalMsg(z interface{}) bool
func (*TxTailRound) Encode ¶
func (t *TxTailRound) Encode() ([]byte, crypto.Digest)
Encode the transaction tail data into a serialized form, and return the serialized data as well as the hash of the data.
func (*TxTailRound) MarshalMsg ¶
func (z *TxTailRound) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*TxTailRound) MsgIsZero ¶
func (z *TxTailRound) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*TxTailRound) Msgsize ¶
func (z *TxTailRound) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*TxTailRound) UnmarshalMsg ¶
func (z *TxTailRound) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*TxTailRound) UnmarshalMsgWithState ¶
func (z *TxTailRound) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type TxTailRoundLease ¶
type TxTailRoundLease struct { Sender basics.Address `codec:"s"` Lease [32]byte `codec:"l,allocbound=-"` TxnIdx uint64 `code:"i"` //!-- index of the entry in TxnIDs/LastValid // contains filtered or unexported fields }
TxTailRoundLease is used as part of txTailRound for storing a single lease.
func (*TxTailRoundLease) CanMarshalMsg ¶
func (_ *TxTailRoundLease) CanMarshalMsg(z interface{}) bool
func (*TxTailRoundLease) CanUnmarshalMsg ¶
func (_ *TxTailRoundLease) CanUnmarshalMsg(z interface{}) bool
func (*TxTailRoundLease) MarshalMsg ¶
func (z *TxTailRoundLease) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*TxTailRoundLease) MsgIsZero ¶
func (z *TxTailRoundLease) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*TxTailRoundLease) Msgsize ¶
func (z *TxTailRoundLease) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*TxTailRoundLease) UnmarshalMsg ¶
func (z *TxTailRoundLease) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*TxTailRoundLease) UnmarshalMsgWithState ¶
func (z *TxTailRoundLease) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type UnfinishedCatchpointRecord ¶
UnfinishedCatchpointRecord represents a stored record of an unfinished catchpoint.
type Writer ¶
type Writer interface { // trackerdb MakeAccountsWriter() (AccountsWriterExt, error) MakeAccountsOptimizedWriter(hasAccounts, hasResources, hasKvPairs, hasCreatables bool) (AccountsWriter, error) MakeOnlineAccountsOptimizedWriter(hasAccounts bool) (OnlineAccountsWriter, error) MakeSpVerificationCtxWriter() SpVerificationCtxWriter // testing Testing() WriterTestExt }
Writer is the interface for the trackerdb write operations.
type WriterTestExt ¶
type WriterTestExt interface { AccountsInitTest(tb testing.TB, initAccounts map[basics.Address]basics.AccountData, proto protocol.ConsensusVersion) (newDatabase bool) AccountsInitLightTest(tb testing.TB, initAccounts map[basics.Address]basics.AccountData, proto config.ConsensusParams) (newDatabase bool, err error) AccountsUpdateSchemaTest(ctx context.Context) (err error) ModifyAcctBaseTest() error }
WriterTestExt is an interface to extend Writer with test-only methods