genesis

package
v1.0.108 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MetaBlockFileName = "metaBlock"

MetaBlockFileName is the constant which defines the export/import filename for metaBlock

View Source
const MiniBlocksFileName = "miniBlocks"

MiniBlocksFileName is the constant which defines the export/import filename for miniBlocks

View Source
const TransactionsFileName = "transactions"

TransactionsFileName is the constant which defines the export/import filename for transactions

View Source
const TrieFileName = "trie"

TrieFileName is the constant which defines the export/import filename for tries

Variables

View Source
var SupportedAccountTypes = []Type{UserAccount, ValidatorAccount, DataTrie}

SupportedAccountTypes is the list to describe the possible account types in the accounts DB

Functions

func AddRootHashToIdentifier

func AddRootHashToIdentifier(identifier string, hash string) string

AddRootHashToIdentifier adds the roothash to the current identifier

func CreateAccountKey

func CreateAccountKey(accType Type, shId uint32, address string) string

CreateAccountKey creates a key for an account according to its type, shard ID and address

func CreateMiniBlockKey

func CreateMiniBlockKey(key string) string

CreateMiniBlockKey returns a miniblock key

func CreateRootHashKey

func CreateRootHashKey(trieIdentifier string) string

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

func CreateTrieIdentifier(shID uint32, accountType Type) string

CreateTrieIdentifier creates a trie identifier according to trie type and shard id

func CreateVersionKey

func CreateVersionKey(meta *block.MetaBlock, hash []byte) string

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 NewObject

func NewObject(objType Type) (interface{}, error)

NewObject creates an object 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

func GetKeyTypeAndHash(key string) (Type, []byte, error)

GetKeyTypeAndHash returns the type of the key by splitting it up and deciphering it

func GetTrieTypeAndShId

func GetTrieTypeAndShId(key string) (Type, uint32, error)

GetTrieTypeAndShId returns the type and shard Id for a given account according to the saved key

Jump to

Keyboard shortcuts

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