Documentation ¶
Index ¶
- Constants
- Variables
- func AddRootHashToIdentifier(identifier string, hash string) string
- func CreateAccountKey(accType Type, shId uint32, address string) string
- func CreateMiniBlockKey(key string) string
- func CreateRootHashKey(trieIdentifier string) string
- func CreateTransactionKey(key string, tx data.TransactionHandler) string
- func CreateTrieIdentifier(shID uint32, accountType Type) string
- func CreateVersionKey(meta *block.MetaBlock, hash []byte) string
- func NewEmptyAccount(accType Type) (state.AccountHandler, error)
- func NewObject(objType Type) (interface{}, error)
- func NewStateExporter(args ArgsNewStateExporter) (*stateExport, error)
- func NewStateImport(args ArgsNewStateImport) (*stateImport, error)
- type ArgsNewStateExporter
- type ArgsNewStateImport
- type Type
Constants ¶
const MetaBlockFileName = "metaBlock"
MetaBlockFileName is the constant which defines the export/import filename for metaBlock
const MiniBlocksFileName = "miniBlocks"
MiniBlocksFileName is the constant which defines the export/import filename for miniBlocks
const TransactionsFileName = "transactions"
TransactionsFileName is the constant which defines the export/import filename for transactions
const TrieFileName = "trie"
TrieFileName is the constant which defines the export/import filename for tries
Variables ¶
var SupportedAccountTypes = []Type{UserAccount, ValidatorAccount, DataTrie}
SupportedAccountTypes is the list to describe the possible account types in the accounts DB
Functions ¶
func AddRootHashToIdentifier ¶
AddRootHashToIdentifier adds the roothash to the current identifier
func CreateAccountKey ¶
CreateAccountKey creates a key for an account according to its type, shard ID and address
func CreateMiniBlockKey ¶
CreateMiniBlockKey returns a miniblock key
func CreateRootHashKey ¶
CreateRootHashKey creates a key of type roothash for a given trie identifier
func CreateTransactionKey ¶
func CreateTransactionKey(key string, tx data.TransactionHandler) string
CreateTransactionKey create a transaction key according to its type
func CreateTrieIdentifier ¶
CreateTrieIdentifier creates a trie identifier according to trie type and shard id
func CreateVersionKey ¶
CreateVersionKey creates a version key from the given metaBlock
func NewEmptyAccount ¶
func NewEmptyAccount(accType Type) (state.AccountHandler, error)
NewEmptyAccount returns a new account according to the given type
func NewStateExporter ¶
func NewStateExporter(args ArgsNewStateExporter) (*stateExport, error)
NewStateExporter exports all the data at a specific moment to a set of files
func NewStateImport ¶
func NewStateImport(args ArgsNewStateImport) (*stateImport, error)
NewStateImport creates an importer which reads all the files for a new start
Types ¶
type ArgsNewStateExporter ¶
type ArgsNewStateExporter struct { ShardCoordinator sharding.Coordinator StateSyncer update.StateSyncer Marshalizer marshal.Marshalizer Hasher hashing.Hasher Writer update.MultiFileWriter }
ArgsNewStateExporter defines the arguments needed to create new state exporter
type ArgsNewStateImport ¶
type ArgsNewStateImport struct { Reader update.MultiFileReader Hasher hashing.Hasher Marshalizer marshal.Marshalizer }
ArgsNewStateImport is the arguments structure to create a new state importer
type Type ¶
type Type uint8
Type identifies the type of the export / import
const ( // Unknown is an export/import type which is not known by the system Unknown Type = iota // Transaction is the export/import type for pending transactions Transaction // SmartContractResult is the export/import type for pending smart contract results SmartContractResult // RewardTransaction is the export/import type for pending reward transaction RewardTransaction // MiniBlock is the export/import type for pending miniBlock MiniBlock // Header is the export/import type for pending headers Header // MetaHeader is the export/import type for pending meta headers MetaHeader // RootHash is the export/import type for byte array which has to be treated as rootHash RootHash // UserAccount is the export/import type for an account of type user account UserAccount // PeerAccount is the export/import type for peer account ValidatorAccount // DataTrie identifies the data trie kept under a specific account DataTrie )
func GetKeyTypeAndHash ¶
GetKeyTypeAndHash returns the type of the key by splitting it up and deciphering it