data

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidBodyType = errors.New("invalid body type")

ErrInvalidBodyType signals an invalid header pointer was provided

View Source
var ErrInvalidHeaderType = errors.New("invalid header type")

ErrInvalidHeaderType signals an invalid header pointer was provided

View Source
var ErrMiniBlockEmpty = errors.New("mini block is empty")

ErrMiniBlockEmpty signals that mini block is empty

View Source
var ErrNilBlockBody = errors.New("nil block body")

ErrNilBlockBody signals that block body is nil

View Source
var ErrNilCacher = errors.New("nil cacher")

ErrNilCacher signals that a nil cache has been provided

View Source
var ErrNilHeadersDataPool = errors.New("nil headers data pool")

ErrNilHeadersDataPool signals that a nil header pool has been provided

View Source
var ErrNilHeadersNoncesDataPool = errors.New("nil headers nonces cache")

ErrNilHeadersNoncesDataPool signals that a nil header - nonce cache

View Source
var ErrNilMetaBlockPool = errors.New("nil meta block data pool")

ErrNilMetaBlockPool signals that a nil meta block data pool was provided

View Source
var ErrNilMiniBlockHashesPool = errors.New("nil meta block mini block hashes data pool")

ErrNilMiniBlockHashesPool signals that a nil meta block data pool was provided

View Source
var ErrNilNonceConverter = errors.New("nil nonce converter")

ErrNilNonceConverter signals that a nil nonce-byte slice converter has been provided

View Source
var ErrNilPeerChangeBlockDataPool = errors.New("nil peer change block data pool")

ErrNilPeerChangeBlockDataPool signals that a nil peer change pool has been provided

View Source
var ErrNilShardHeaderPool = errors.New("nil meta block shard header data pool")

ErrNilShardHeaderPool signals that a nil meta block data pool was provided

View Source
var ErrNilTxBlockDataPool = errors.New("nil tx block data pool")

ErrNilTxBlockDataPool signals that a nil tx block body pool has been provided

View Source
var ErrNilTxDataPool = errors.New("nil transaction data pool")

ErrNilTxDataPool signals that a nil transaction pool has been provided

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals that wrong type was provided

Functions

This section is empty.

Types

type BodyHandler

type BodyHandler interface {
	// IntegrityAndValidity checks the integrity and validity of the block
	IntegrityAndValidity() error
}

BodyHandler interface for a block body

type CapnpHelper added in v1.0.3

type CapnpHelper interface {
	// Save saves the serialized data of the implementer type into a stream through Capnp protocol
	Save(w io.Writer) error
	// Load loads the data from the stream into a go structure through Capnp protocol
	Load(r io.Reader) error
}

CapnpHelper is an interface that defines methods needed for serializing and deserializing Capnp structures into Go structures and viceversa

type ChainHandler

type ChainHandler interface {
	GetGenesisHeader() HeaderHandler
	SetGenesisHeader(gb HeaderHandler) error
	GetGenesisHeaderHash() []byte
	SetGenesisHeaderHash(hash []byte)
	GetCurrentBlockHeader() HeaderHandler
	SetCurrentBlockHeader(bh HeaderHandler) error
	GetCurrentBlockHeaderHash() []byte
	SetCurrentBlockHeaderHash(hash []byte)
	GetCurrentBlockBody() BodyHandler
	SetCurrentBlockBody(body BodyHandler) error
	GetLocalHeight() int64
	SetLocalHeight(height int64)
	GetNetworkHeight() int64
	SetNetworkHeight(height int64)
	HasBadBlock(blockHash []byte) bool
	PutBadBlock(blockHash []byte)
}

ChainHandler is the interface defining the functionality a blockchain should implement

type DBWriteCacher

type DBWriteCacher interface {
	Put(key, val []byte) error
	Get(key []byte) ([]byte, error)
}

DBWriteCacher is used to cache changes made to the trie, and only write to the database when it's needed

type HeaderHandler

type HeaderHandler interface {
	GetShardID() uint32
	GetNonce() uint64
	GetEpoch() uint32
	GetRound() uint32
	GetRootHash() []byte
	GetPrevHash() []byte
	GetPrevRandSeed() []byte
	GetRandSeed() []byte
	GetPubKeysBitmap() []byte
	GetSignature() []byte
	GetTimeStamp() uint64
	GetTxCount() uint32

	SetNonce(n uint64)
	SetEpoch(e uint32)
	SetRound(r uint32)
	SetTimeStamp(ts uint64)
	SetRootHash(rHash []byte)
	SetPrevHash(pvHash []byte)
	SetPrevRandSeed(pvRandSeed []byte)
	SetRandSeed(randSeed []byte)
	SetPubKeysBitmap(pkbm []byte)
	SetSignature(sg []byte)
	SetTxCount(txCount uint32)

	GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32
	GetMiniBlockProcessed(hash []byte) bool
	SetMiniBlockProcessed(hash []byte, processed bool)

	IsInterfaceNil() bool
}

HeaderHandler defines getters and setters for header data holder

type TransactionHandler

type TransactionHandler interface {
	IsInterfaceNil() bool

	GetValue() *big.Int
	GetData() []byte
	GetRecvAddress() []byte
	GetSndAddress() []byte

	SetValue(*big.Int)
	SetData([]byte)
	SetRecvAddress([]byte)
	SetSndAddress([]byte)
}

type Trie

type Trie interface {
	Get(key []byte) ([]byte, error)
	Update(key, value []byte) error
	Delete(key []byte) error
	Root() ([]byte, error)
	Prove(key []byte) ([][]byte, error)
	VerifyProof(proofs [][]byte, key []byte) (bool, error)
	Commit() error
	Recreate(root []byte) (Trie, error)
}

Trie is an interface for Merkle Trees implementations

Directories

Path Synopsis
TODO: remove this file once we completely migrate to Elrond Trie implementation crypto_test.go needs to be removed as well as the sha3 folder
TODO: remove this file once we completely migrate to Elrond Trie implementation crypto_test.go needs to be removed as well as the sha3 folder
sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.

Jump to

Keyboard shortcuts

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