Documentation
¶
Index ¶
- Constants
- Variables
- func BlockUpdatesInfoFromProto(blockInfoProto *g.BlockInfo) (proto.BlockUpdatesInfo, error)
- func BlockUpdatesInfoToProto(blockInfo proto.BlockUpdatesInfo, scheme proto.Scheme) (*g.BlockInfo, error)
- func CompareBUpdatesInfo(current, previous proto.BUpdatesInfo, scheme proto.Scheme) (bool, proto.BUpdatesInfo, error)
- func ConcatenateContractTopics(contractAddress string) string
- func DeserializeConstantKeys(data []byte) ([]string, error)
- func HandleRollback(ctx context.Context, be *BUpdatesExtensionState, updates proto.BUpdatesInfo, ...) proto.BUpdatesInfo
- func L2ContractDataEntriesFromProto(protoDataEntries *g.L2ContractDataEntries, scheme proto.Scheme) (proto.L2ContractDataEntries, error)
- func L2ContractDataEntriesToProto(contractData proto.L2ContractDataEntries) *g.L2ContractDataEntries
- func PublishBlockUpdates(updates proto.BUpdatesInfo, nc *nats.Conn, scheme proto.Scheme) error
- func PublishContractUpdates(ctx context.Context, contractUpdates proto.L2ContractDataEntries, ...) error
- func SerializeConstantKeys(constantKeys []string) ([]byte, error)
- type BUpdatesExtensionState
- func (bu *BUpdatesExtensionState) AddEntriesToHistoryJournalAndCache(updates proto.BUpdatesInfo)
- func (bu *BUpdatesExtensionState) BuildPatch(keysForPatch []string, targetHeight uint64) (proto.DataEntries, proto.BlockUpdatesInfo, error)
- func (bu *BUpdatesExtensionState) CleanRecordsAfterRollback(latestHeightFromHistory uint64, heightAfterRollback uint64) error
- func (bu *BUpdatesExtensionState) GeneratePatch(latestUpdates proto.BUpdatesInfo) (proto.BUpdatesInfo, error)
- func (bu *BUpdatesExtensionState) HasStateChanged() (bool, proto.BUpdatesInfo, error)
- func (bu *BUpdatesExtensionState) IsKeyConstant(keyDataEntry string) bool
- func (bu *BUpdatesExtensionState) RollbackHappened(updates proto.BUpdatesInfo, previousState proto.BUpdatesInfo) bool
- func (bu *BUpdatesExtensionState) SetPreviousState(updates proto.BUpdatesInfo)
- func (bu *BUpdatesExtensionState) StatesEqual(scheme proto.Scheme) (bool, proto.BUpdatesInfo, error)
- type BlockMeta
- type BlockchainUpdatesExtension
- func (e *BlockchainUpdatesExtension) ClearPreviousState()
- func (e *BlockchainUpdatesExtension) L2ContractAddress() proto.WavesAddress
- func (e *BlockchainUpdatesExtension) MarkExtensionReady()
- func (e *BlockchainUpdatesExtension) RunBlockchainUpdatesPublisher(ctx context.Context, scheme proto.Scheme, ...) error
- type HistoryEntry
- type HistoryJournal
- func (hj *HistoryJournal) CleanAfterRollback(latestHeightFromHistory uint64, heightAfterRollback uint64) error
- func (hj *HistoryJournal) FetchKeysUntilBlockID(blockID proto.BlockID) ([]string, bool)
- func (hj *HistoryJournal) Pop() (HistoryEntry, error)
- func (hj *HistoryJournal) Push(v HistoryEntry)
- func (hj *HistoryJournal) SearchByBlockID(blockID proto.BlockID) (HistoryEntry, bool)
- func (hj *HistoryJournal) SetStateCache(stateCache *StateCache)
- func (hj *HistoryJournal) TopHeight() (uint64, error)
- type StateCache
- func (sc *StateCache) AddCacheRecord(height uint64, dataEntries []proto.DataEntry, blockInfo proto.BlockUpdatesInfo)
- func (sc *StateCache) RemoveCacheRecord(targetHeight uint64)
- func (sc *StateCache) SearchBlockInfo(height uint64) (proto.BlockUpdatesInfo, error)
- func (sc *StateCache) SearchValue(key string, height uint64) (proto.DataEntry, bool)
- type StateCacheRecord
- type UpdatesPublisher
- type UpdatesPublisherInterface
Constants ¶
View Source
const ( BlockUpdates = "block_topic" ContractUpdates = "contract_topic" ConstantKeys = "constant_keys" )
View Source
const ( StartPaging = iota EndPaging NoPaging )
View Source
const ( RootHashSize = 32 HistoryJournalLengthMax = 100 )
View Source
const L2RequestsTopic = "l2_requests_topic"
View Source
const NatsConnectionsTimeoutDefault = 10 * server.AUTH_TIMEOUT
View Source
const RequestRestartSubTopic = "restart"
View Source
const StoreBlocksLimit = 200
View Source
const UpdatesBufferedChannelSize = 256
Variables ¶
View Source
var ErrNotInCache = errors.New("the target height is not in cache")
Functions ¶
func BlockUpdatesInfoFromProto ¶
func BlockUpdatesInfoFromProto(blockInfoProto *g.BlockInfo) (proto.BlockUpdatesInfo, error)
func BlockUpdatesInfoToProto ¶
func CompareBUpdatesInfo ¶
func CompareBUpdatesInfo(current, previous proto.BUpdatesInfo, scheme proto.Scheme) (bool, proto.BUpdatesInfo, error)
func DeserializeConstantKeys ¶
func HandleRollback ¶
func HandleRollback(ctx context.Context, be *BUpdatesExtensionState, updates proto.BUpdatesInfo, updatesPublisher UpdatesPublisherInterface, nc *nats.Conn, scheme proto.Scheme) proto.BUpdatesInfo
func L2ContractDataEntriesFromProto ¶
func L2ContractDataEntriesFromProto( protoDataEntries *g.L2ContractDataEntries, scheme proto.Scheme, ) (proto.L2ContractDataEntries, error)
func L2ContractDataEntriesToProto ¶
func L2ContractDataEntriesToProto(contractData proto.L2ContractDataEntries) *g.L2ContractDataEntries
func PublishBlockUpdates ¶
func PublishContractUpdates ¶
func SerializeConstantKeys ¶
Types ¶
type BUpdatesExtensionState ¶
type BUpdatesExtensionState struct {
CurrentState *proto.BUpdatesInfo
PreviousState *proto.BUpdatesInfo // this information is what was just published
Limit uint64
Scheme proto.Scheme
L2ContractAddress string
HistoryJournal *HistoryJournal
St state.State
// contains filtered or unexported fields
}
func (*BUpdatesExtensionState) AddEntriesToHistoryJournalAndCache ¶
func (bu *BUpdatesExtensionState) AddEntriesToHistoryJournalAndCache(updates proto.BUpdatesInfo)
func (*BUpdatesExtensionState) BuildPatch ¶
func (bu *BUpdatesExtensionState) BuildPatch(keysForPatch []string, targetHeight uint64) (proto.DataEntries, proto.BlockUpdatesInfo, error)
func (*BUpdatesExtensionState) CleanRecordsAfterRollback ¶
func (bu *BUpdatesExtensionState) CleanRecordsAfterRollback(latestHeightFromHistory uint64, heightAfterRollback uint64) error
func (*BUpdatesExtensionState) GeneratePatch ¶
func (bu *BUpdatesExtensionState) GeneratePatch(latestUpdates proto.BUpdatesInfo) (proto.BUpdatesInfo, error)
func (*BUpdatesExtensionState) HasStateChanged ¶
func (bu *BUpdatesExtensionState) HasStateChanged() (bool, proto.BUpdatesInfo, error)
func (*BUpdatesExtensionState) IsKeyConstant ¶
func (bu *BUpdatesExtensionState) IsKeyConstant(keyDataEntry string) bool
func (*BUpdatesExtensionState) RollbackHappened ¶
func (bu *BUpdatesExtensionState) RollbackHappened(updates proto.BUpdatesInfo, previousState proto.BUpdatesInfo) bool
func (*BUpdatesExtensionState) SetPreviousState ¶
func (bu *BUpdatesExtensionState) SetPreviousState(updates proto.BUpdatesInfo)
func (*BUpdatesExtensionState) StatesEqual ¶
func (bu *BUpdatesExtensionState) StatesEqual(scheme proto.Scheme) (bool, proto.BUpdatesInfo, error)
type BlockMeta ¶
type BlockMeta struct {
BlockHeight int64 `json:"blockHeight"`
BlockEpoch int64 `json:"blockEpoch"`
BlockParent []byte `json:"blockParent"`
ChainID int64 `json:"chainId"`
E2CTransfersRootHash []byte `json:"e2cTransfersRootHash"`
LastC2ETransferIndex int64 `json:"lastC2ETransferIndex"`
}
func (*BlockMeta) UnmarshalBinary ¶
type BlockchainUpdatesExtension ¶
type BlockchainUpdatesExtension struct {
// contains filtered or unexported fields
}
func NewBlockchainUpdatesExtension ¶
func NewBlockchainUpdatesExtension( l2ContractAddress proto.WavesAddress, blockchainExtensionState *BUpdatesExtensionState, makeExtensionReadyFunc func(), obsolescencePeriod time.Duration, ntpTime types.Time, ) *BlockchainUpdatesExtension
func (*BlockchainUpdatesExtension) ClearPreviousState ¶
func (e *BlockchainUpdatesExtension) ClearPreviousState()
func (*BlockchainUpdatesExtension) L2ContractAddress ¶
func (e *BlockchainUpdatesExtension) L2ContractAddress() proto.WavesAddress
func (*BlockchainUpdatesExtension) MarkExtensionReady ¶
func (e *BlockchainUpdatesExtension) MarkExtensionReady()
func (*BlockchainUpdatesExtension) RunBlockchainUpdatesPublisher ¶
func (e *BlockchainUpdatesExtension) RunBlockchainUpdatesPublisher(ctx context.Context, scheme proto.Scheme, updatesChannel <-chan proto.BUpdatesInfo) error
type HistoryEntry ¶
type HistoryEntry struct {
Height uint64
BlockID proto.BlockID
VRF proto.B58Bytes
BlockHeader proto.BlockHeader
Entries proto.DataEntries
}
type HistoryJournal ¶
type HistoryJournal struct {
// contains filtered or unexported fields
}
func NewHistoryJournal ¶
func NewHistoryJournal() *HistoryJournal
func (*HistoryJournal) CleanAfterRollback ¶
func (hj *HistoryJournal) CleanAfterRollback(latestHeightFromHistory uint64, heightAfterRollback uint64) error
CleanAfterRollback TODO write tests.
func (*HistoryJournal) FetchKeysUntilBlockID ¶
func (hj *HistoryJournal) FetchKeysUntilBlockID(blockID proto.BlockID) ([]string, bool)
FetchKeysUntilBlockID TODO write tests. FetchKeysUntilBlockID goes from top to bottom and fetches all keys. If the blockID is found, it returns the keys up to and including that element and true. If the blockID is not found - nil and false.
func (*HistoryJournal) Pop ¶
func (hj *HistoryJournal) Pop() (HistoryEntry, error)
func (*HistoryJournal) Push ¶
func (hj *HistoryJournal) Push(v HistoryEntry)
func (*HistoryJournal) SearchByBlockID ¶
func (hj *HistoryJournal) SearchByBlockID(blockID proto.BlockID) (HistoryEntry, bool)
SearchByBlockID TODO write tests.
func (*HistoryJournal) SetStateCache ¶
func (hj *HistoryJournal) SetStateCache(stateCache *StateCache)
func (*HistoryJournal) TopHeight ¶
func (hj *HistoryJournal) TopHeight() (uint64, error)
SearchByBlockID TODO write tests.
type StateCache ¶
type StateCache struct {
// contains filtered or unexported fields
}
func NewStateCache ¶
func NewStateCache() *StateCache
func (*StateCache) AddCacheRecord ¶
func (sc *StateCache) AddCacheRecord(height uint64, dataEntries []proto.DataEntry, blockInfo proto.BlockUpdatesInfo)
func (*StateCache) RemoveCacheRecord ¶
func (sc *StateCache) RemoveCacheRecord(targetHeight uint64)
func (*StateCache) SearchBlockInfo ¶
func (sc *StateCache) SearchBlockInfo(height uint64) (proto.BlockUpdatesInfo, error)
func (*StateCache) SearchValue ¶
type StateCacheRecord ¶
type StateCacheRecord struct {
// contains filtered or unexported fields
}
func NewStateCacheRecord ¶
func NewStateCacheRecord(dataEntries []proto.DataEntry, blockInfo proto.BlockUpdatesInfo) StateCacheRecord
type UpdatesPublisher ¶
type UpdatesPublisher struct {
// contains filtered or unexported fields
}
func (*UpdatesPublisher) L2ContractAddress ¶
func (p *UpdatesPublisher) L2ContractAddress() string
func (*UpdatesPublisher) PublishUpdates ¶
Click to show internal directories.
Click to hide internal directories.