Documentation ¶
Index ¶
- Constants
- Variables
- func WriteSlotDiffToSnapshotWriter(writer io.WriteSeeker, diff *SlotDiff) error
- type IterateOption
- type IterateOptions
- type LexicalOrderedOutputs
- type LexicalOrderedSpents
- type LookupKey
- type Manager
- func (m *Manager) AddGenesisUnspentOutput(unspentOutput *Output) error
- func (m *Manager) AddGenesisUnspentOutputWithoutLocking(unspentOutput *Output) error
- func (m *Manager) ApplyDiff(slot iotago.SlotIndex, newOutputs Outputs, newSpents Spents) (newStateTreeRoot iotago.Identifier, err error)
- func (m *Manager) ApplyDiffWithoutLocking(slot iotago.SlotIndex, newOutputs Outputs, newSpents Spents) (newStateTreeRoot iotago.Identifier, err error)
- func (m *Manager) CheckLedgerState(tokenSupply iotago.BaseToken) error
- func (m *Manager) CheckStateTree() bool
- func (m *Manager) ClearLedgerState() (err error)
- func (m *Manager) ComputeLedgerBalance(options ...IterateOption) (balance iotago.BaseToken, count int, err error)
- func (m *Manager) Export(writer io.WriteSeeker, targetIndex iotago.SlotIndex) error
- func (m *Manager) ForEachOutput(consumer OutputConsumer, options ...IterateOption) error
- func (m *Manager) ForEachSpentOutput(consumer SpentConsumer, options ...IterateOption) error
- func (m *Manager) ForEachUnspentOutput(consumer OutputConsumer, options ...IterateOption) error
- func (m *Manager) ForEachUnspentOutputID(consumer OutputIDConsumer, options ...IterateOption) error
- func (m *Manager) Import(reader io.ReadSeeker) error
- func (m *Manager) IsOutputIDUnspentWithoutLocking(outputID iotago.OutputID) (bool, error)
- func (m *Manager) IsOutputUnspentWithoutLocking(output *Output) (bool, error)
- func (m *Manager) KVStore() kvstore.KVStore
- func (m *Manager) LedgerStateSHA256Sum() ([]byte, error)
- func (m *Manager) PruneSlotIndexWithoutLocking(slot iotago.SlotIndex) error
- func (m *Manager) ReInitStateTreeWithLocking()
- func (m *Manager) ReadLedgerIndexWithoutLocking() (iotago.SlotIndex, error)
- func (m *Manager) ReadLedgerSlot() (iotago.SlotIndex, error)
- func (m *Manager) ReadLockLedger()
- func (m *Manager) ReadOutputByOutputID(outputID iotago.OutputID) (*Output, error)
- func (m *Manager) ReadOutputByOutputIDWithoutLocking(outputID iotago.OutputID) (*Output, error)
- func (m *Manager) ReadRawOutputBytesByOutputIDWithoutLocking(outputID iotago.OutputID) ([]byte, error)
- func (m *Manager) ReadSpentForOutputIDWithoutLocking(outputID iotago.OutputID) (*Spent, error)
- func (m *Manager) ReadUnlockLedger()
- func (m *Manager) Rollback(targetSlot iotago.SlotIndex) error
- func (m *Manager) RollbackDiff(slot iotago.SlotIndex, newOutputs Outputs, newSpents Spents) error
- func (m *Manager) RollbackDiffWithoutLocking(slot iotago.SlotIndex, newOutputs Outputs, newSpents Spents) error
- func (m *Manager) SlotDiff(index iotago.SlotIndex) (*SlotDiff, error)
- func (m *Manager) SlotDiffWithoutLocking(index iotago.SlotIndex) (*SlotDiff, error)
- func (m *Manager) SpentOutputs(options ...IterateOption) (Spents, error)
- func (m *Manager) StateTreeRoot() iotago.Identifier
- func (m *Manager) StoreLedgerIndex(slot iotago.SlotIndex) error
- func (m *Manager) StoreLedgerIndexWithoutLocking(slot iotago.SlotIndex) error
- func (m *Manager) UnspentOutputs(options ...IterateOption) (Outputs, error)
- func (m *Manager) UnspentOutputsIDs(options ...IterateOption) (iotago.OutputIDs, error)
- func (m *Manager) WriteLockLedger()
- func (m *Manager) WriteUnlockLedger()
- type Output
- func (o *Output) BaseTokenAmount() iotago.BaseToken
- func (o *Output) BlockID() iotago.BlockID
- func (o *Output) Bytes() []byte
- func (o *Output) CopyWithBlockIDAndSlotBooked(blockID iotago.BlockID, slotBooked iotago.SlotIndex) *Output
- func (o *Output) IsReadOnly() bool
- func (o *Output) KVStorableKey() (key []byte)
- func (o *Output) KVStorableValue() (value []byte)
- func (o *Output) MapKey() string
- func (o *Output) Output() iotago.Output
- func (o *Output) OutputID() iotago.OutputID
- func (o *Output) OutputIDProof() *iotago.OutputIDProof
- func (o *Output) OutputType() iotago.OutputType
- func (o *Output) ProofBytes() []byte
- func (o *Output) SlotBooked() iotago.SlotIndex
- func (o *Output) SlotCreated() iotago.SlotIndex
- func (o *Output) SnapshotBytes() []byte
- func (o *Output) StateID() iotago.Identifier
- func (o *Output) StoredMana() iotago.Mana
- func (o *Output) Type() mempool.StateType
- func (o *Output) UnspentLookupKey() LookupKey
- type OutputConsumer
- type OutputIDConsumer
- type Outputs
- type SlotDiff
- type Spent
- func (s *Spent) BaseTokenAmount() iotago.BaseToken
- func (s *Spent) BlockID() iotago.BlockID
- func (s *Spent) KVStorableKey() (key []byte)
- func (s *Spent) KVStorableValue() (value []byte)
- func (s *Spent) MapKey() string
- func (s *Spent) Output() *Output
- func (s *Spent) OutputID() iotago.OutputID
- func (s *Spent) OutputType() iotago.OutputType
- func (s *Spent) SlotSpent() iotago.SlotIndex
- func (s *Spent) SnapshotBytes() []byte
- func (s *Spent) TransactionIDSpent() iotago.TransactionID
- type SpentConsumer
- type Spents
Constants ¶
const ( StoreKeyPrefixLedgerSlotIndex byte = 0 // StoreKeyPrefixOutput defines the prefix for Output and Spent storage. StoreKeyPrefixOutput byte = 1 // StoreKeyPrefixOutputSpent defines the prefix for Track spent/unspent Outputs. StoreKeyPrefixOutputSpent byte = 2 StoreKeyPrefixOutputUnspent byte = 3 // StoreKeyPrefixSlotDiffs defines the prefix for Slot diffs. StoreKeyPrefixSlotDiffs byte = 4 StoreKeyPrefixStateTree byte = 5 )
Variables ¶
var ErrOutputsSumNotEqualTotalSupply = ierrors.New("accumulated output balance is not equal to total supply")
ErrOutputsSumNotEqualTotalSupply is returned if the sum of the output base token amounts is not equal the total supply of tokens.
Functions ¶
func WriteSlotDiffToSnapshotWriter ¶
func WriteSlotDiffToSnapshotWriter(writer io.WriteSeeker, diff *SlotDiff) error
Types ¶
type IterateOption ¶
type IterateOption func(*IterateOptions)
func ReadLockLedger ¶
func ReadLockLedger(lockLedger bool) IterateOption
type IterateOptions ¶
type IterateOptions struct {
// contains filtered or unexported fields
}
type LexicalOrderedOutputs ¶
type LexicalOrderedOutputs []*Output
LexicalOrderedOutputs are outputs ordered in lexical order by their outputID.
func (LexicalOrderedOutputs) Len ¶
func (l LexicalOrderedOutputs) Len() int
func (LexicalOrderedOutputs) Swap ¶
func (l LexicalOrderedOutputs) Swap(i int, j int)
type LexicalOrderedSpents ¶
type LexicalOrderedSpents []*Spent
LexicalOrderedSpents are spents ordered in lexical order by their outputID.
func (LexicalOrderedSpents) Len ¶
func (l LexicalOrderedSpents) Len() int
func (LexicalOrderedSpents) Swap ¶
func (l LexicalOrderedSpents) Swap(i int, j int)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) AddGenesisUnspentOutput ¶
func (*Manager) AddGenesisUnspentOutputWithoutLocking ¶
func (*Manager) ApplyDiffWithoutLocking ¶
func (*Manager) CheckLedgerState ¶
func (*Manager) CheckStateTree ¶
func (*Manager) ClearLedgerState ¶
ClearLedgerState removes all entries from the ledger (spent, unspent, diff).
func (*Manager) ComputeLedgerBalance ¶
func (*Manager) ForEachOutput ¶
func (m *Manager) ForEachOutput(consumer OutputConsumer, options ...IterateOption) error
func (*Manager) ForEachSpentOutput ¶
func (m *Manager) ForEachSpentOutput(consumer SpentConsumer, options ...IterateOption) error
func (*Manager) ForEachUnspentOutput ¶
func (m *Manager) ForEachUnspentOutput(consumer OutputConsumer, options ...IterateOption) error
func (*Manager) ForEachUnspentOutputID ¶
func (m *Manager) ForEachUnspentOutputID(consumer OutputIDConsumer, options ...IterateOption) error
func (*Manager) Import ¶
func (m *Manager) Import(reader io.ReadSeeker) error
Import imports the ledger state from the given reader.
func (*Manager) IsOutputIDUnspentWithoutLocking ¶
func (*Manager) IsOutputUnspentWithoutLocking ¶
func (*Manager) LedgerStateSHA256Sum ¶
func (*Manager) PruneSlotIndexWithoutLocking ¶
func (*Manager) ReInitStateTreeWithLocking ¶
func (m *Manager) ReInitStateTreeWithLocking()
func (*Manager) ReadLedgerIndexWithoutLocking ¶
func (*Manager) ReadLockLedger ¶
func (m *Manager) ReadLockLedger()
func (*Manager) ReadOutputByOutputID ¶
func (*Manager) ReadOutputByOutputIDWithoutLocking ¶
func (*Manager) ReadRawOutputBytesByOutputIDWithoutLocking ¶
func (*Manager) ReadSpentForOutputIDWithoutLocking ¶
func (*Manager) ReadUnlockLedger ¶
func (m *Manager) ReadUnlockLedger()
func (*Manager) RollbackDiff ¶
func (*Manager) RollbackDiffWithoutLocking ¶
func (*Manager) SlotDiffWithoutLocking ¶
func (*Manager) SpentOutputs ¶
func (m *Manager) SpentOutputs(options ...IterateOption) (Spents, error)
func (*Manager) StateTreeRoot ¶
func (m *Manager) StateTreeRoot() iotago.Identifier
func (*Manager) StoreLedgerIndexWithoutLocking ¶
func (*Manager) UnspentOutputs ¶
func (m *Manager) UnspentOutputs(options ...IterateOption) (Outputs, error)
func (*Manager) UnspentOutputsIDs ¶
func (m *Manager) UnspentOutputsIDs(options ...IterateOption) (iotago.OutputIDs, error)
func (*Manager) WriteLockLedger ¶
func (m *Manager) WriteLockLedger()
func (*Manager) WriteUnlockLedger ¶
func (m *Manager) WriteUnlockLedger()
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
func CreateOutput ¶
func OutputFromSnapshotReader ¶
func OutputFromSnapshotReader(reader io.ReadSeeker, apiProvider iotago.APIProvider) (*Output, error)
func (*Output) BaseTokenAmount ¶
func (*Output) CopyWithBlockIDAndSlotBooked ¶
func (*Output) IsReadOnly ¶
func (*Output) KVStorableKey ¶
func (*Output) KVStorableValue ¶
func (*Output) OutputIDProof ¶
func (o *Output) OutputIDProof() *iotago.OutputIDProof
func (*Output) OutputType ¶
func (o *Output) OutputType() iotago.OutputType
func (*Output) ProofBytes ¶
func (*Output) SlotBooked ¶
func (*Output) SlotCreated ¶
func (*Output) SnapshotBytes ¶
func (*Output) StateID ¶
func (o *Output) StateID() iotago.Identifier
func (*Output) StoredMana ¶
func (*Output) UnspentLookupKey ¶
type OutputConsumer ¶
OutputConsumer is a function that consumes an output. Returning false from this function indicates to abort the iteration.
type OutputIDConsumer ¶
OutputIDConsumer is a function that consumes an output ID. Returning false from this function indicates to abort the iteration.
type SlotDiff ¶
type SlotDiff struct { // The index of the slot. Slot iotago.SlotIndex // The outputs newly generated with this diff. Outputs Outputs // The outputs spent with this diff. Spents Spents }
SlotDiff represents the generated and spent outputs by a slot's confirmation.
func ReadSlotDiffToSnapshotReader ¶
func ReadSlotDiffToSnapshotReader(reader io.ReadSeeker, apiProvider iotago.APIProvider) (*SlotDiff, error)
func (*SlotDiff) KVStorableKey ¶
func (*SlotDiff) KVStorableValue ¶
type Spent ¶
type Spent struct {
// contains filtered or unexported fields
}
Spent are already spent TXOs (transaction outputs).
func SpentFromSnapshotReader ¶
func SpentFromSnapshotReader(reader io.ReadSeeker, apiProvider iotago.APIProvider, indexSpent iotago.SlotIndex) (*Spent, error)
func (*Spent) BaseTokenAmount ¶
func (*Spent) KVStorableKey ¶
func (*Spent) KVStorableValue ¶
func (*Spent) OutputType ¶
func (s *Spent) OutputType() iotago.OutputType
func (*Spent) SnapshotBytes ¶
func (*Spent) TransactionIDSpent ¶
func (s *Spent) TransactionIDSpent() iotago.TransactionID
TransactionIDSpent returns the ID of the transaction that spent the output.
type SpentConsumer ¶
SpentConsumer is a function that consumes a spent output. Returning false from this function indicates to abort the iteration.