Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) { return &Events{ MemPool: mempool.NewEvents(), } })
NewEvents contains the constructor of the Events object (it is generated by a generic factory).
Functions ¶
This section is empty.
Types ¶
type Events ¶
type Events struct {
// MemPool contains all mempool related events.
MemPool *mempool.Events
event.Group[Events, *Events]
}
Events is a container that acts as a dictionary for the existing events of a MemPool.
type Ledger ¶
type Ledger interface {
// Events is a dictionary for Ledger related events.
Events() *Events
// MemPool returns the MemPool implementation used by this ledger.
MemPool() mempool.MemPool
// UnspentOutputs returns the unspent outputs of the ledger state.
UnspentOutputs() UnspentOutputs
// StateDiffs returns the state diffs of the ledger state.
StateDiffs() StateDiffs
// ApplyStateDiff applies the state diff of the given slot index.
ApplyStateDiff(slot.Index) error
// Import imports the ledger state from the given reader.
Import(io.ReadSeeker) error
// Export exports the ledger state to the given writer.
Export(io.WriteSeeker, slot.Index) error
// Interface embeds the required methods of the module.Interface.
module.Interface
}
Ledger is an engine module that provides access to the persistent ledger state.
type StateDiffs ¶
type StateDiffs interface {
// StreamCreatedOutputs streams the created outputs of the given slot index.
StreamCreatedOutputs(slot.Index, func(*mempool.OutputWithMetadata) error) error
// StreamSpentOutputs streams the spent outputs of the given slot index.
StreamSpentOutputs(slot.Index, func(*mempool.OutputWithMetadata) error) error
}
StateDiffs is a submodule that provides access to the state diffs of the ledger state.
type UnspentOutputs ¶
type UnspentOutputs interface {
// IDs returns the IDs of the unspent outputs.
IDs() *ads.Set[utxo.OutputID, *utxo.OutputID]
// Subscribe subscribes to changes in the unspent outputs.
Subscribe(UnspentOutputsSubscriber)
// Unsubscribe unsubscribes from changes in the unspent outputs.
Unsubscribe(UnspentOutputsSubscriber)
// ApplyCreatedOutput applies the given output to the unspent outputs.
ApplyCreatedOutput(*mempool.OutputWithMetadata) error
// BatchCommittable embeds the required methods of the BatchCommittable trait.
traits.BatchCommittable
// Interface embeds the required methods of the module.Interface.
module.Interface
}
UnspentOutputs is a submodule that provides access to the unspent outputs of the ledger state.
type UnspentOutputsSubscriber ¶
type UnspentOutputsSubscriber interface {
// ApplyCreatedOutput is called when an output is created.
ApplyCreatedOutput(*mempool.OutputWithMetadata) error
// ApplySpentOutput is called when an output is spent.
ApplySpentOutput(*mempool.OutputWithMetadata) error
// RollbackCreatedOutput is called when a created output is rolled back.
RollbackCreatedOutput(*mempool.OutputWithMetadata) error
// RollbackSpentOutput is called when a spent output is rolled back.
RollbackSpentOutput(*mempool.OutputWithMetadata) error
// BeginBatchedStateTransition is called when a batched state transition is started.
BeginBatchedStateTransition(slot.Index) (currentSlot slot.Index, err error)
// CommitBatchedStateTransition is called when a batched state transition is committed.
CommitBatchedStateTransition() context.Context
}
UnspentOutputsSubscriber is an interface that allows to subscribe to changes in the unspent outputs.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.