dataRetriever

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: GPL-3.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const RewardTxPoolName = "rewardTxPool"

RewardTxPoolName defines the name of the reward transactions pool

View Source
const TxPoolNumSendersToPreemptivelyEvict = uint32(100)

TxPoolNumSendersToPreemptivelyEvict instructs tx pool eviction algorithm to remove this many senders when eviction takes place

View Source
const UnsignedTxPoolName = "uTxPool"

UnsignedTxPoolName defines the name of the unsigned transactions pool

View Source
const ValidatorsInfoPoolName = "validatorsInfoPool"

ValidatorsInfoPoolName defines the name of the validators info pool

Variables

View Source
var (
	ErrInvalidLengthRequestData        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRequestData          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRequestData = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrBadRequest = errors.New("request should not be done as it doesn't follow the protocol")

ErrBadRequest signals that the request should not have happened

View Source
var ErrCacheConfigInvalidEconomics = errors.New("cache-economics parameter is not valid")

ErrCacheConfigInvalidEconomics signals that an economics parameter required by the cache is invalid

View Source
var ErrCacheConfigInvalidSharding = errors.New("cache-sharding parameter is not valid")

ErrCacheConfigInvalidSharding signals that a sharding parameter required by the cache is invalid

View Source
var ErrCacheConfigInvalidShards = errors.New("cache parameter [shards] is not valid, it must be a positive number")

ErrCacheConfigInvalidShards signals that the cache parameter "shards" is invalid

View Source
var ErrCacheConfigInvalidSize = errors.New("cache parameter [size] is not valid, it must be a positive number")

ErrCacheConfigInvalidSize signals that the cache parameter "size" is invalid

View Source
var ErrCacheConfigInvalidSizeInBytes = errors.New("cache parameter [sizeInBytes] is not valid, it must be a positive, and large enough number")

ErrCacheConfigInvalidSizeInBytes signals that the cache parameter "sizeInBytes" is invalid

View Source
var ErrContainerKeyAlreadyExists = errors.New("provided key already exists in container")

ErrContainerKeyAlreadyExists signals that an element was already set in the container's map

View Source
var ErrEmptyString = errors.New("empty string")

ErrEmptyString signals that an empty string has been provided

View Source
var ErrInvalidContainerKey = errors.New("element does not exist in container")

ErrInvalidContainerKey signals that an element does not exist in the container's map

View Source
var ErrInvalidMaxTxRequest = errors.New("max tx request number is invalid")

ErrInvalidMaxTxRequest signals that max tx request is too small

View Source
var ErrInvalidNonceByteSlice = errors.New("invalid nonce byte slice")

ErrInvalidNonceByteSlice signals that an invalid byte slice has been provided and an uint64 can not be decoded from that byte slice

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value has been provided

View Source
var ErrLenMismatch = errors.New("lengths mismatch")

ErrLenMismatch signals that 2 or more slices have different lengths

View Source
var ErrMissingData = errors.New("missing data")

ErrMissingData signals that the required data is missing

View Source
var ErrNilAntifloodHandler = errors.New("nil antiflood handler")

ErrNilAntifloodHandler signals that a nil antiflood handler has been provided

View Source
var ErrNilConfig = errors.New("nil config provided")

ErrNilConfig signals that a nil config has been provided

View Source
var ErrNilContainerElement = errors.New("element cannot be nil")

ErrNilContainerElement signals when trying to add a nil element in the container

View Source
var ErrNilCurrBlockTxs = errors.New("nil current block txs holder")

ErrNilCurrBlockTxs signals that nil current block txs holder was provided

View Source
var ErrNilCurrentEpochValidatorInfo = errors.New("nil current epoch validator info holder")

ErrNilCurrentEpochValidatorInfo signals that nil current epoch validator info holder was provided

View Source
var ErrNilCurrentNetworkEpochProvider = errors.New("nil current network epoch provider")

ErrNilCurrentNetworkEpochProvider signals that a nil CurrentNetworkEpochProvider handler has been provided

View Source
var ErrNilDataPacker = errors.New("nil data packer provided")

ErrNilDataPacker signals that a nil data packer has been provided

View Source
var ErrNilDataPoolHolder = errors.New("nil data pool holder")

ErrNilDataPoolHolder signals that the data pool holder is nil

View Source
var ErrNilDataToProcess = errors.New("nil data to process")

ErrNilDataToProcess signals that nil data was provided

View Source
var ErrNilDebugHandler = errors.New("nil debug handler")

ErrNilDebugHandler signals that a nil debug handler has been provided

View Source
var ErrNilEconomicsData = errors.New("nil economics data provided")

ErrNilEconomicsData signals that a nil economics data handler has been provided

View Source
var ErrNilEpochHandler = errors.New("nil epoch handler")

ErrNilEpochHandler signals that epoch handler is nil

View Source
var ErrNilEpochNotifier = errors.New("nil EpochNotifier")

ErrNilEpochNotifier signals that the provided EpochNotifier is nil

View Source
var ErrNilGracefullyCloseChannel = errors.New("nil gracefully close channel")

ErrNilGracefullyCloseChannel signals that a nil gracefully close channel has been provided

View Source
var ErrNilHasher = errors.New("nil hasher")

ErrNilHasher signals that a nil hasher 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 ErrNilHeadersNoncesStorage = errors.New("nil headers nonces storage")

ErrNilHeadersNoncesStorage signals that a nil header-nonce storage has been provided

View Source
var ErrNilHeadersStorage = errors.New("nil headers storage")

ErrNilHeadersStorage signals that a nil header storage has been provided

View Source
var ErrNilHeartbeatPool = errors.New("nil heartbeat pool")

ErrNilHeartbeatPool signals that a nil heartbeat pool has been provided

View Source
var ErrNilManualEpochStartNotifier = errors.New("nil manual epoch start notifier")

ErrNilManualEpochStartNotifier signals that a nil manual epoch start notifier has been provided

View Source
var ErrNilMarshalizer = errors.New("nil Marshalizer")

ErrNilMarshalizer signals that an operation has been attempted to or with a nil Marshalizer implementation

View Source
var ErrNilMessage = errors.New("nil message")

ErrNilMessage signals that a nil message has been received

View Source
var ErrNilMessenger = errors.New("nil Messenger")

ErrNilMessenger signals that a nil Messenger object was provided

View Source
var ErrNilMiniblocksPool = errors.New("nil miniblocks pool")

ErrNilMiniblocksPool signals that a nil miniblocks pool has been provided

View Source
var ErrNilMiniblocksStorage = errors.New("nil miniblocks storage")

ErrNilMiniblocksStorage signals that a nil miniblocks storage has been provided

View Source
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")

ErrNilNodesCoordinator signals a nil nodes coordinator has been provided

View Source
var ErrNilPathManager = errors.New("nil path manager")

ErrNilPathManager signals that a nil path manager has been provided

View Source
var ErrNilPayloadValidator = errors.New("nil payload validator")

ErrNilPayloadValidator signals that a nil payload validator was provided

View Source
var ErrNilPeerAuthenticationPool = errors.New("nil peer authentication pool")

ErrNilPeerAuthenticationPool signals that a nil peer authentication pool 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 ErrNilPeerListCreator = errors.New("nil peer list creator provided")

ErrNilPeerListCreator signals that a nil peer list creator implementation has been provided

View Source
var ErrNilPeersRatingHandler = errors.New("nil peers rating handler")

ErrNilPeersRatingHandler signals that a nil peers rating handler implementation has been provided

View Source
var ErrNilPreferredPeersHolder = errors.New("nil preferred peers holder")

ErrNilPreferredPeersHolder signals that a nil preferred peers holder handler has been provided

View Source
var ErrNilRandomizer = errors.New("nil randomizer")

ErrNilRandomizer signals that a nil randomizer has been provided

View Source
var ErrNilRequestSender = errors.New("nil request sender")

ErrNilRequestSender signals that a nil request sender object has been provided

View Source
var ErrNilRequestedItemsHandler = errors.New("nil requested items handler")

ErrNilRequestedItemsHandler signals that a nil requested items handler was provided

View Source
var ErrNilRequestersContainer = errors.New("nil requesters container")

ErrNilRequestersContainer signals that a nil requesters container was provided

View Source
var ErrNilRequestersFinder = errors.New("nil requesters finder")

ErrNilRequestersFinder signals that a nil requesters finder has been provided

View Source
var ErrNilResolverContainer = errors.New("nil resolver container")

ErrNilResolverContainer signals that a nil resolver container was provided

View Source
var ErrNilResolverSender = errors.New("nil resolver sender")

ErrNilResolverSender signals that a nil resolver sender object has been provided

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

ErrNilRewardTransactionPool signals that a nil reward transactions pool has been provided

View Source
var ErrNilSelfShardIDProvider = errors.New("nil self shard ID provider")

ErrNilSelfShardIDProvider signals that a nil self shard ID provider has been provided

View Source
var ErrNilShardCoordinator = errors.New("nil shard coordinator")

ErrNilShardCoordinator signals that an operation has been attempted to or with a nil shard coordinator

View Source
var ErrNilSmartContractsPool = errors.New("nil smart contracts pool")

ErrNilSmartContractsPool signals that a nil smart contracts pool has been provided

View Source
var ErrNilStore = errors.New("nil data storage service")

ErrNilStore signals that the provided storage service is nil

View Source
var ErrNilThrottler = errors.New("nil throttler")

ErrNilThrottler signals that a nil throttler has been provided

View Source
var ErrNilTrieDataGetter = errors.New("nil trie data getter provided")

ErrNilTrieDataGetter signals that a nil trie data getter has been provided

View Source
var ErrNilTrieNodesChunksPool = errors.New("nil trie nodes chunks data pool")

ErrNilTrieNodesChunksPool signals that a nil trie nodes chunks data pool was provided

View Source
var ErrNilTrieNodesPool = errors.New("nil trie nodes data pool")

ErrNilTrieNodesPool signals that a nil trie nodes data pool was provided

View Source
var ErrNilTrieStorageManager = errors.New("nil trie storage manager")

ErrNilTrieStorageManager signals that a nil trie storage manager has been 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 ErrNilTxGasHandler = errors.New("nil tx gas handler provided")

ErrNilTxGasHandler signals that a nil tx gas handler was provided

View Source
var ErrNilTxStorage = errors.New("nil transaction storage")

ErrNilTxStorage signals that a nil transaction storage has been provided

View Source
var ErrNilUint64ByteSliceConverter = errors.New("nil byte slice converter")

ErrNilUint64ByteSliceConverter signals that a nil byte slice converter was provided

View Source
var ErrNilUnsignedTransactionPool = errors.New("nil unsigned transactions data pool")

ErrNilUnsignedTransactionPool signals that a nil unsigned transactions pool has been provided

View Source
var ErrNilValidatorInfoPool = errors.New("nil validator info pool")

ErrNilValidatorInfoPool signals that a nil validator info pool has been provided

View Source
var ErrNilValidatorInfoStorage = errors.New("nil validator info storage")

ErrNilValidatorInfoStorage signals that a nil validator info storage has been provided

View Source
var ErrNilValue = errors.New("nil value")

ErrNilValue signals the value is nil

View Source
var ErrNilWhiteListHandler = errors.New("nil white list handler")

ErrNilWhiteListHandler signals that white list handler is nil

View Source
var ErrNoSuchStorageUnit = errors.New("no such unit type")

ErrNoSuchStorageUnit defines the error for using an invalid storage unit

View Source
var ErrPeerAuthNotFound = errors.New("peer authentication not found")

ErrPeerAuthNotFound signals that no peer authentication found

View Source
var ErrRequestIntervalTooSmall = errors.New("request interval is too small")

ErrRequestIntervalTooSmall signals that request interval is too small

View Source
var ErrRequestTypeNotImplemented = errors.New("request type is not implemented")

ErrRequestTypeNotImplemented signals that a not implemented type of request has been received

View Source
var ErrResolveTypeUnknown = errors.New("unknown resolve type")

ErrResolveTypeUnknown signals that an unknown resolve type was provided

View Source
var ErrSendRequest = errors.New("cannot send request: peer list is empty or errors during the sending")

ErrSendRequest signals that the connected peers list is empty or errors appeared when sending requests

View Source
var ErrStorerNotFound = errors.New("storer not found")

ErrStorerNotFound signals that the storer was not found

View Source
var ErrSystemBusy = errors.New("system busy")

ErrSystemBusy signals that the system is busy and can not process more requests

View Source
var ErrTxNotFoundInBlockPool = errors.New("transaction was not found in the current block pool")

ErrTxNotFoundInBlockPool signals that transaction was not found in the current block pool

View Source
var ErrValidatorInfoNotFound = errors.New("validator info not found")

ErrValidatorInfoNotFound signals that no validator info was found

View Source
var ErrValidatorInfoNotFoundInEpochPool = errors.New("validator info was not found in the current epoch pool")

ErrValidatorInfoNotFoundInEpochPool signals that validator info was not found in the current epoch pool

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

ErrWrongTypeAssertion signals that a type assertion failed

View Source
var ErrWrongTypeInContainer = errors.New("wrong type of object inside container")

ErrWrongTypeInContainer signals that a wrong type of object was found in container

View Source
var RequestDataType_name = map[int32]string{
	0: "InvalidType",
	1: "HashType",
	2: "HashArrayType",
	3: "NonceType",
	4: "EpochType",
	5: "ChunkType",
}
View Source
var RequestDataType_value = map[string]int32{
	"InvalidType":   0,
	"HashType":      1,
	"HashArrayType": 2,
	"NonceType":     3,
	"EpochType":     4,
	"ChunkType":     5,
}

Functions

func SetEpochHandlerToHdrRequester added in v1.6.0

func SetEpochHandlerToHdrRequester(
	requestersContainer RequestersContainer,
	epochHandler EpochHandler,
) error

SetEpochHandlerToHdrRequester sets the epoch handler to the metablock hdr requester

func SetEpochHandlerToHdrResolver

func SetEpochHandlerToHdrResolver(
	resolversContainer ResolversContainer,
	epochHandler EpochHandler,
) error

SetEpochHandlerToHdrResolver sets the epoch handler to the metablock hdr resolver

Types

type ChainStorer

type ChainStorer struct {
	// contains filtered or unexported fields
}

ChainStorer is a StorageService implementation that can hold multiple storages

grouped by storage unit type

func NewChainStorer

func NewChainStorer() *ChainStorer

NewChainStorer returns a new initialised ChainStorer

func (*ChainStorer) AddStorer

func (bc *ChainStorer) AddStorer(key UnitType, s storage.Storer)

AddStorer will add a new storer to the chain map

func (*ChainStorer) CloseAll

func (bc *ChainStorer) CloseAll() error

CloseAll will close all the active units

func (*ChainStorer) Destroy

func (bc *ChainStorer) Destroy() error

Destroy removes the underlying files/resources used by the storage service

func (*ChainStorer) Get

func (bc *ChainStorer) Get(unitType UnitType, key []byte) ([]byte, error)

Get returns the value for the given key if found in the selected storage unit, nil otherwise. It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

func (*ChainStorer) GetAll

func (bc *ChainStorer) GetAll(unitType UnitType, keys [][]byte) (map[string][]byte, error)

GetAll gets all the elements with keys in the keys array, from the selected storage unit It can report an error if the provided unit type is not supported, if there is a missing key in the unit, or if the underlying implementation of the storage unit reports an error.

func (*ChainStorer) GetAllStorers

func (bc *ChainStorer) GetAllStorers() map[UnitType]storage.Storer

GetAllStorers returns all the available storers

func (*ChainStorer) GetStorer

func (bc *ChainStorer) GetStorer(unitType UnitType) (storage.Storer, error)

GetStorer returns the storer from the chain map or nil if the storer was not found with error

func (*ChainStorer) Has

func (bc *ChainStorer) Has(unitType UnitType, key []byte) error

Has returns true if the key is found in the selected Unit or false otherwise It can return an error if the provided unit type is not supported or if the underlying implementation of the storage unit reports an error.

func (*ChainStorer) IsInterfaceNil

func (bc *ChainStorer) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ChainStorer) Put

func (bc *ChainStorer) Put(unitType UnitType, key []byte, value []byte) error

Put stores the key, value pair in the selected storage unit It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

func (*ChainStorer) SetEpochForPutOperation

func (bc *ChainStorer) SetEpochForPutOperation(epoch uint32)

SetEpochForPutOperation will set the epoch to be used in all persisters for the put operation

type CurrentNetworkEpochProviderHandler

type CurrentNetworkEpochProviderHandler interface {
	EpochIsActiveInNetwork(epoch uint32) bool
	EpochConfirmed(newEpoch uint32, newTimestamp uint64)
	IsInterfaceNil() bool
}

CurrentNetworkEpochProviderHandler is an interface able to compute if the provided epoch is active on the network or not

type DataPacker

type DataPacker interface {
	PackDataInChunks(data [][]byte, limit int) ([][]byte, error)
	IsInterfaceNil() bool
}

DataPacker can split a large slice of byte slices in smaller packets

type DebugHandler added in v1.6.0

type DebugHandler interface {
	LogRequestedData(topic string, hashes [][]byte, numReqIntra int, numReqCross int)
	LogFailedToResolveData(topic string, hash []byte, err error)
	LogSucceededToResolveData(topic string, hash []byte)
	IsInterfaceNil() bool
}

DebugHandler defines an interface for debugging the requested-resolved data

type EpochHandler

type EpochHandler interface {
	MetaEpoch() uint32
	IsInterfaceNil() bool
}

EpochHandler defines the functionality to get the current epoch

type HeaderRequester added in v1.6.0

type HeaderRequester interface {
	Requester
	SetEpochHandler(epochHandler EpochHandler) error
}

HeaderRequester defines what a block header requester should do

type HeaderResolver

type HeaderResolver interface {
	Resolver
	SetEpochHandler(epochHandler EpochHandler) error
}

HeaderResolver defines what a block header resolver should do

type HeadersPool

type HeadersPool interface {
	Clear()
	AddHeader(headerHash []byte, header data.HeaderHandler)
	RemoveHeaderByHash(headerHash []byte)
	RemoveHeaderByNonceAndShardId(headerNonce uint64, shardId uint32)
	GetHeadersByNonceAndShardId(headerNonce uint64, shardId uint32) ([]data.HeaderHandler, [][]byte, error)
	GetHeaderByHash(hash []byte) (data.HeaderHandler, error)
	RegisterHandler(handler func(headerHandler data.HeaderHandler, headerHash []byte))
	Nonces(shardId uint32) []uint64
	Len() int
	MaxSize() int
	IsInterfaceNil() bool
	GetNumHeaders(shardId uint32) int
}

HeadersPool defines what a headers pool structure can perform

type IntRandomizer

type IntRandomizer interface {
	Intn(n int) int
	IsInterfaceNil() bool
}

IntRandomizer interface provides functionality over generating integer numbers

type ManualEpochStartNotifier

type ManualEpochStartNotifier interface {
	NewEpoch(epoch uint32)
	CurrentEpoch() uint32
	IsInterfaceNil() bool
}

ManualEpochStartNotifier can manually notify an epoch change

type MessageHandler

type MessageHandler interface {
	ConnectedPeersOnTopic(topic string) []core.PeerID
	SendToConnectedPeer(topic string, buff []byte, peerID core.PeerID) error
	ID() core.PeerID
	ConnectedPeers() []core.PeerID
	IsConnected(peerID core.PeerID) bool
	IsInterfaceNil() bool
}

MessageHandler defines the functionality needed by structs to send data to other peers

type NodesCoordinator

type NodesCoordinator interface {
	GetAllEligibleValidatorsPublicKeys(epoch uint32) (map[uint32][][]byte, error)
	IsInterfaceNil() bool
}

NodesCoordinator provides Validator methods needed for the peer processing

type P2PAntifloodHandler

type P2PAntifloodHandler interface {
	CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, _ uint64, sequence []byte) error
	BlacklistPeer(peer core.PeerID, reason string, duration time.Duration)
	IsInterfaceNil() bool
}

P2PAntifloodHandler defines the behavior of a component able to signal that the system is too busy (or flooded) processing p2p messages

type PeerAuthenticationPayloadValidator

type PeerAuthenticationPayloadValidator interface {
	ValidateTimestamp(payloadTimestamp int64) error
	IsInterfaceNil() bool
}

PeerAuthenticationPayloadValidator defines the operations supported by an entity able to validate timestamps found in peer authentication messages

type PeerListCreator

type PeerListCreator interface {
	CrossShardPeerList() []core.PeerID
	IntraShardPeerList() []core.PeerID
	IsInterfaceNil() bool
}

PeerListCreator is used to create a peer list

type PeersRatingHandler

type PeersRatingHandler interface {
	IncreaseRating(pid core.PeerID)
	DecreaseRating(pid core.PeerID)
	GetTopRatedPeersFromList(peers []core.PeerID, minNumOfPeersExpected int) []core.PeerID
	IsInterfaceNil() bool
}

PeersRatingHandler represent an entity able to handle peers ratings

type PoolsHolder

type PoolsHolder interface {
	Transactions() ShardedDataCacherNotifier
	UnsignedTransactions() ShardedDataCacherNotifier
	RewardTransactions() ShardedDataCacherNotifier
	Headers() HeadersPool
	MiniBlocks() storage.Cacher
	PeerChangesBlocks() storage.Cacher
	TrieNodes() storage.Cacher
	TrieNodesChunks() storage.Cacher
	SmartContracts() storage.Cacher
	CurrentBlockTxs() TransactionCacher
	CurrentEpochValidatorInfo() ValidatorInfoCacher
	PeerAuthentications() storage.Cacher
	Heartbeats() storage.Cacher
	ValidatorsInfo() ShardedDataCacherNotifier
	Close() error
	IsInterfaceNil() bool
}

PoolsHolder defines getters for data pools

type PreferredPeersHolderHandler

type PreferredPeersHolderHandler interface {
	Get() map[uint32][]core.PeerID
	Contains(peerID core.PeerID) bool
	IsInterfaceNil() bool
}

PreferredPeersHolderHandler defines the behavior of a component able to handle preferred peers operations

type RequestData

type RequestData struct {
	Type       RequestDataType `protobuf:"varint,1,opt,name=Type,proto3,enum=proto.RequestDataType" json:"type"`
	Value      []byte          `protobuf:"bytes,2,opt,name=Value,proto3" json:"value"`
	Epoch      uint32          `protobuf:"varint,3,opt,name=Epoch,proto3" json:"epoch"`
	ChunkIndex uint32          `protobuf:"varint,4,opt,name=ChunkIndex,proto3" json:"chunkIndex"`
}

RequestData holds the requested data This struct will be serialized and sent to the other peers

func (*RequestData) Descriptor

func (*RequestData) Descriptor() ([]byte, []int)

func (*RequestData) Equal

func (this *RequestData) Equal(that interface{}) bool

func (*RequestData) GetChunkIndex

func (m *RequestData) GetChunkIndex() uint32

func (*RequestData) GetEpoch

func (m *RequestData) GetEpoch() uint32

func (*RequestData) GetType

func (m *RequestData) GetType() RequestDataType

func (*RequestData) GetValue

func (m *RequestData) GetValue() []byte

func (*RequestData) GoString

func (this *RequestData) GoString() string

func (*RequestData) Marshal

func (m *RequestData) Marshal() (dAtA []byte, err error)

func (*RequestData) MarshalTo

func (m *RequestData) MarshalTo(dAtA []byte) (int, error)

func (*RequestData) MarshalToSizedBuffer

func (m *RequestData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RequestData) ProtoMessage

func (*RequestData) ProtoMessage()

func (*RequestData) Reset

func (m *RequestData) Reset()

func (*RequestData) Size

func (m *RequestData) Size() (n int)

func (*RequestData) String

func (this *RequestData) String() string

func (*RequestData) Unmarshal

func (m *RequestData) Unmarshal(dAtA []byte) error

func (*RequestData) UnmarshalWith

func (rd *RequestData) UnmarshalWith(marshalizer marshal.Marshalizer, message p2p.MessageP2P) error

UnmarshalWith sets the fields according to p2p.MessageP2P.Data() contents Errors if something went wrong

func (*RequestData) XXX_DiscardUnknown

func (m *RequestData) XXX_DiscardUnknown()

func (*RequestData) XXX_Marshal

func (m *RequestData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RequestData) XXX_Merge

func (m *RequestData) XXX_Merge(src proto.Message)

func (*RequestData) XXX_Size

func (m *RequestData) XXX_Size() int

func (*RequestData) XXX_Unmarshal

func (m *RequestData) XXX_Unmarshal(b []byte) error

type RequestDataType

type RequestDataType int32

RequestDataType represents the data type for the requested data

const (
	// Invalid
	InvalidType RequestDataType = 0
	// HashType indicates that the request data object is of type hash
	HashType RequestDataType = 1
	// HashArrayType that the request data object contains a serialised array of hashes
	HashArrayType RequestDataType = 2
	// NonceType indicates that the request data object is of type nonce (uint64)
	NonceType RequestDataType = 3
	// EpochType indicates that the request data object is of type epoch
	EpochType RequestDataType = 4
	// ChunkType indicates that the request data object is of type chunk
	ChunkType RequestDataType = 5
)

func (RequestDataType) EnumDescriptor

func (RequestDataType) EnumDescriptor() ([]byte, []int)

func (RequestDataType) String

func (x RequestDataType) String() string

type RequestedItemsHandler

type RequestedItemsHandler interface {
	Add(key string) error
	Has(key string) bool
	Sweep()
	IsInterfaceNil() bool
}

RequestedItemsHandler can determine if a certain key has or not been requested

type Requester added in v1.6.0

type Requester interface {
	RequestDataFromHash(hash []byte, epoch uint32) error
	SetNumPeersToQuery(intra int, cross int)
	NumPeersToQuery() (int, int)
	SetDebugHandler(handler DebugHandler) error
	IsInterfaceNil() bool
}

Requester defines what a data requester should do

type RequestersContainer added in v1.6.0

type RequestersContainer interface {
	Get(key string) (Requester, error)
	Add(key string, val Requester) error
	AddMultiple(keys []string, requesters []Requester) error
	Replace(key string, val Requester) error
	Remove(key string)
	Len() int
	RequesterKeys() string
	Iterate(handler func(key string, requester Requester) bool)
	Close() error
	IsInterfaceNil() bool
}

RequestersContainer defines a requesters holder data type with basic functionality

type RequestersContainerFactory added in v1.6.0

type RequestersContainerFactory interface {
	Create() (RequestersContainer, error)
	IsInterfaceNil() bool
}

RequestersContainerFactory defines the functionality to create a requesters container

type RequestersFinder added in v1.6.0

type RequestersFinder interface {
	RequestersContainer
	IntraShardRequester(baseTopic string) (Requester, error)
	MetaChainRequester(baseTopic string) (Requester, error)
	CrossShardRequester(baseTopic string, crossShard uint32) (Requester, error)
	MetaCrossShardRequester(baseTopic string, crossShard uint32) (Requester, error)
}

RequestersFinder extends a requesters container

type Resolver

type Resolver interface {
	ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID, source p2p.MessageHandler) error
	SetDebugHandler(handler DebugHandler) error
	Close() error
	IsInterfaceNil() bool
}

Resolver defines what a data resolver should do

type ResolverThrottler

type ResolverThrottler interface {
	CanProcess() bool
	StartProcessing()
	EndProcessing()
	IsInterfaceNil() bool
}

ResolverThrottler can monitor the number of the currently running resolver go routines

type ResolversContainer

type ResolversContainer interface {
	Get(key string) (Resolver, error)
	Add(key string, val Resolver) error
	AddMultiple(keys []string, resolvers []Resolver) error
	Replace(key string, val Resolver) error
	Remove(key string)
	Len() int
	ResolverKeys() string
	Iterate(handler func(key string, resolver Resolver) bool)
	Close() error
	IsInterfaceNil() bool
}

ResolversContainer defines a resolvers holder data type with basic functionality

type ResolversContainerFactory

type ResolversContainerFactory interface {
	Create() (ResolversContainer, error)
	IsInterfaceNil() bool
}

ResolversContainerFactory defines the functionality to create a resolvers container

type SelfShardIDProvider

type SelfShardIDProvider interface {
	SelfId() uint32
	IsInterfaceNil() bool
}

SelfShardIDProvider defines the behavior of a component able to provide the self shard ID

type ShardIdHashMap

type ShardIdHashMap interface {
	Load(shardId uint32) ([]byte, bool)
	Store(shardId uint32, hash []byte)
	Range(f func(shardId uint32, hash []byte) bool)
	Delete(shardId uint32)
	IsInterfaceNil() bool
}

ShardIdHashMap represents a map for shardId and hash

type ShardedDataCacherNotifier

type ShardedDataCacherNotifier interface {
	RegisterOnAdded(func(key []byte, value interface{}))
	ShardDataStore(cacheId string) (c storage.Cacher)
	AddData(key []byte, data interface{}, sizeInBytes int, cacheId string)
	SearchFirstData(key []byte) (value interface{}, ok bool)
	RemoveData(key []byte, cacheId string)
	RemoveSetOfDataFromPool(keys [][]byte, cacheId string)
	ImmunizeSetOfDataAgainstEviction(keys [][]byte, cacheId string)
	RemoveDataFromAllShards(key []byte)
	MergeShardStores(sourceCacheID, destCacheID string)
	Clear()
	ClearShardStore(cacheId string)
	GetCounts() counting.CountsWithSize
	Keys() [][]byte
	IsInterfaceNil() bool
}

ShardedDataCacherNotifier defines what a sharded-data structure can perform

type StorageService

type StorageService interface {
	// GetStorer returns the storer from the chain map
	// If the unit is missing, it returns an error
	GetStorer(unitType UnitType) (storage.Storer, error)
	// AddStorer will add a new storer to the chain map
	AddStorer(key UnitType, s storage.Storer)
	// Has returns true if the key is found in the selected Unit or false otherwise
	Has(unitType UnitType, key []byte) error
	// Get returns the value for the given key if found in the selected storage unit, nil otherwise
	Get(unitType UnitType, key []byte) ([]byte, error)
	// Put stores the key, value pair in the selected storage unit
	Put(unitType UnitType, key []byte, value []byte) error
	// SetEpochForPutOperation will set the epoch which will be used for the put operation
	SetEpochForPutOperation(epoch uint32)
	// GetAll gets all the elements with keys in the keys array, from the selected storage unit
	// If there is a missing key in the unit, it returns an error
	GetAll(unitType UnitType, keys [][]byte) (map[string][]byte, error)
	// GetAllStorers returns all the storers
	GetAllStorers() map[UnitType]storage.Storer
	// Destroy removes the underlying files/resources used by the storage service
	Destroy() error
	// CloseAll will close all the units
	CloseAll() error
	// IsInterfaceNil returns true if there is no value under the interface
	IsInterfaceNil() bool
}

StorageService is the interface for data storage unit provided services

type StorageType

type StorageType uint8

StorageType defines the storage levels on a node

type TopicHandler

type TopicHandler interface {
	HasTopic(name string) bool
	CreateTopic(name string, createChannelForTopic bool) error
	RegisterMessageProcessor(topic string, identifier string, handler p2p.MessageProcessor) error
}

TopicHandler defines the functionality needed by structs to manage topics and message processors

type TopicRequestSender added in v1.6.0

type TopicRequestSender interface {
	SendOnRequestTopic(rd *RequestData, originalHashes [][]byte) error
	SetNumPeersToQuery(intra int, cross int)
	NumPeersToQuery() (int, int)
	RequestTopic() string
	TargetShardID() uint32
	SetDebugHandler(handler DebugHandler) error
	DebugHandler() DebugHandler
	IsInterfaceNil() bool
}

TopicRequestSender defines what sending operations are allowed for a topic requester

type TopicResolverSender

type TopicResolverSender interface {
	Send(buff []byte, peer core.PeerID, destination p2p.MessageHandler) error
	RequestTopic() string
	TargetShardID() uint32
	SetDebugHandler(handler DebugHandler) error
	DebugHandler() DebugHandler
	IsInterfaceNil() bool
}

TopicResolverSender defines what sending operations are allowed for a topic resolver

type TransactionCacher

type TransactionCacher interface {
	Clean()
	GetTx(txHash []byte) (data.TransactionHandler, error)
	AddTx(txHash []byte, tx data.TransactionHandler)
	IsInterfaceNil() bool
}

TransactionCacher defines the methods for the local transaction cacher, needed for the current block

type TrieDataGetter

type TrieDataGetter interface {
	GetSerializedNodes([]byte, uint64) ([][]byte, uint64, error)
	GetSerializedNode([]byte) ([]byte, error)
	IsInterfaceNil() bool
}

TrieDataGetter returns requested data from the trie

type UnitType

type UnitType uint8

UnitType is the type for Storage unit identifiers

const (
	// TransactionUnit is the transactions storage unit identifier
	TransactionUnit UnitType = 0
	// MiniBlockUnit is the transaction block body storage unit identifier
	MiniBlockUnit UnitType = 1
	// PeerChangesUnit is the peer change block body storage unit identifier
	PeerChangesUnit UnitType = 2
	// BlockHeaderUnit is the Block Headers Storage unit identifier
	BlockHeaderUnit UnitType = 3
	// MetaBlockUnit is the metachain blocks storage unit identifier
	MetaBlockUnit UnitType = 4
	// UnsignedTransactionUnit is the unsigned transaction unit identifier
	UnsignedTransactionUnit UnitType = 5
	// RewardTransactionUnit is the reward transaction unit identifier
	RewardTransactionUnit UnitType = 6
	// MetaHdrNonceHashDataUnit is the meta header nonce-hash pair data unit identifier
	MetaHdrNonceHashDataUnit UnitType = 7
	// HeartbeatUnit is the heartbeat storage unit identifier
	HeartbeatUnit UnitType = 8
	// BootstrapUnit is the bootstrap storage unit identifier
	BootstrapUnit UnitType = 9
	//StatusMetricsUnit is the status metrics storage unit identifier
	StatusMetricsUnit UnitType = 10
	// TxLogsUnit is the transactions logs storage unit identifier
	TxLogsUnit UnitType = 11
	// MiniblocksMetadataUnit is the miniblocks metadata storage unit identifier
	MiniblocksMetadataUnit UnitType = 12
	// EpochByHashUnit is the epoch by hash storage unit identifier
	EpochByHashUnit UnitType = 13
	// MiniblockHashByTxHashUnit is the miniblocks hash by tx hash storage unit identifier
	MiniblockHashByTxHashUnit UnitType = 14
	// ReceiptsUnit is the receipts storage unit identifier
	ReceiptsUnit UnitType = 15
	// ResultsHashesByTxHashUnit is the results hashes by transaction storage unit identifier
	ResultsHashesByTxHashUnit UnitType = 16
	// TrieEpochRootHashUnit is the trie epoch <-> root hash storage unit identifier
	TrieEpochRootHashUnit UnitType = 17
	// ESDTSuppliesUnit is the ESDT supplies storage unit identifier
	ESDTSuppliesUnit UnitType = 18
	// RoundHdrHashDataUnit is the round- block header hash storage data unit identifier
	RoundHdrHashDataUnit UnitType = 19
	// UserAccountsUnit is the user accounts storage unit identifier
	UserAccountsUnit UnitType = 20
	// UserAccountsCheckpointsUnit is the user accounts checkpoints storage unit identifier
	UserAccountsCheckpointsUnit UnitType = 21
	// PeerAccountsUnit is the peer accounts storage unit identifier
	PeerAccountsUnit UnitType = 22
	// PeerAccountsCheckpointsUnit is the peer accounts checkpoints storage unit identifier
	PeerAccountsCheckpointsUnit UnitType = 23
	// ScheduledSCRsUnit is the scheduled SCRs storage unit identifier
	ScheduledSCRsUnit UnitType = 24

	// ShardHdrNonceHashDataUnit is the header nonce-hash pair data unit identifier
	//TODO: Add only unit types lower than 100
	ShardHdrNonceHashDataUnit UnitType = 100
)

func GetHdrNonceHashDataUnit

func GetHdrNonceHashDataUnit(shard uint32) UnitType

GetHdrNonceHashDataUnit gets the HdrNonceHashDataUnit by shard

func GetHeadersDataUnit

func GetHeadersDataUnit(shard uint32) UnitType

GetHeadersDataUnit gets the unit for block headers, by shard

func (UnitType) String

func (ut UnitType) String() string

String returns the friendly name of the unit

type ValidatorInfoCacher

type ValidatorInfoCacher interface {
	Clean()
	GetValidatorInfo(validatorInfoHash []byte) (*state.ShardValidatorInfo, error)
	AddValidatorInfo(validatorInfoHash []byte, validatorInfo *state.ShardValidatorInfo)
	IsInterfaceNil() bool
}

ValidatorInfoCacher defines the methods for the local validator info cacher, needed for the current epoch

type WhiteListHandler

type WhiteListHandler interface {
	Remove(keys [][]byte)
	Add(keys [][]byte)
	IsInterfaceNil() bool
}

WhiteListHandler is the interface needed to add whitelisted data

Jump to

Keyboard shortcuts

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