utxoledger

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixUnspentOutputsLatestCommittedIndex byte = iota
	PrefixUnspentOutputsIDs
)

Variables

This section is empty.

Functions

func WithMemPoolProvider

func WithMemPoolProvider(provider module.Provider[*engine.Engine, mempool.MemPool]) options.Option[UTXOLedger]

Types

type StateDiffs

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

func NewStateDiffs

func NewStateDiffs(e *engine.Engine) *StateDiffs

func (*StateDiffs) Delete

func (s *StateDiffs) Delete(index slot.Index) (err error)

func (*StateDiffs) DeleteCreatedOutput

func (s *StateDiffs) DeleteCreatedOutput(index slot.Index, outputID utxo.OutputID) (err error)

func (*StateDiffs) DeleteCreatedOutputs

func (s *StateDiffs) DeleteCreatedOutputs(index slot.Index, outputIDs utxo.OutputIDs) (err error)

func (*StateDiffs) DeleteSpentOutput

func (s *StateDiffs) DeleteSpentOutput(index slot.Index, outputID utxo.OutputID) (err error)

func (*StateDiffs) DeleteSpentOutputs

func (s *StateDiffs) DeleteSpentOutputs(index slot.Index, outputIDs utxo.OutputIDs) (err error)

func (*StateDiffs) Export

func (s *StateDiffs) Export(writer io.WriteSeeker, targetSlot slot.Index) (err error)

func (*StateDiffs) Import

func (s *StateDiffs) Import(reader io.ReadSeeker) (importedSlots []slot.Index, err error)

func (*StateDiffs) LoadCreatedOutput

func (s *StateDiffs) LoadCreatedOutput(index slot.Index, outputID utxo.OutputID) (outputWithMetadata *mempool.OutputWithMetadata, err error)

func (*StateDiffs) LoadSpentOutput

func (s *StateDiffs) LoadSpentOutput(index slot.Index, outputID utxo.OutputID) (outputWithMetadata *mempool.OutputWithMetadata, err error)

func (*StateDiffs) StoreCreatedOutput

func (s *StateDiffs) StoreCreatedOutput(outputWithMetadata *mempool.OutputWithMetadata) (err error)

func (*StateDiffs) StoreSpentOutput

func (s *StateDiffs) StoreSpentOutput(outputWithMetadata *mempool.OutputWithMetadata) (err error)

func (*StateDiffs) StreamCreatedOutputs

func (s *StateDiffs) StreamCreatedOutputs(index slot.Index, callback func(*mempool.OutputWithMetadata) error) (err error)

func (*StateDiffs) StreamSpentOutputs

func (s *StateDiffs) StreamSpentOutputs(index slot.Index, callback func(*mempool.OutputWithMetadata) error) (err error)

type UTXOLedger

type UTXOLedger struct {
	module.Module
	// contains filtered or unexported fields
}

UTXOLedger represents a ledger using the realities based mempool.

func (*UTXOLedger) ApplyStateDiff

func (l *UTXOLedger) ApplyStateDiff(index slot.Index) (err error)

ApplyStateDiff applies the state diff of the given slot to the ledger state.

func (*UTXOLedger) Events

func (l *UTXOLedger) Events() *ledger.Events

func (*UTXOLedger) Export

func (l *UTXOLedger) Export(writer io.WriteSeeker, targetSlot slot.Index) (err error)

Export exports the ledger state to the given writer.

func (*UTXOLedger) Import

func (l *UTXOLedger) Import(reader io.ReadSeeker) (err error)

Import imports the ledger state from the given reader.

func (*UTXOLedger) MemPool

func (l *UTXOLedger) MemPool() mempool.MemPool

func (*UTXOLedger) StateDiffs

func (l *UTXOLedger) StateDiffs() ledger.StateDiffs

func (*UTXOLedger) UnspentOutputs

func (l *UTXOLedger) UnspentOutputs() ledger.UnspentOutputs

type UnspentOutputs

type UnspentOutputs struct {
	traits.BatchCommittable
	module.Module
	// contains filtered or unexported fields
}

func NewUnspentOutputs

func NewUnspentOutputs(e *engine.Engine) (unspentOutputs *UnspentOutputs)

func (*UnspentOutputs) ApplyCreatedOutput

func (u *UnspentOutputs) ApplyCreatedOutput(output *mempool.OutputWithMetadata) (err error)

func (*UnspentOutputs) ApplySpentOutput

func (u *UnspentOutputs) ApplySpentOutput(output *mempool.OutputWithMetadata) (err error)

func (*UnspentOutputs) Begin

func (u *UnspentOutputs) Begin(newSlot slot.Index) (lastCommittedSlot slot.Index, err error)

func (*UnspentOutputs) Commit

func (u *UnspentOutputs) Commit() (ctx context.Context)

func (*UnspentOutputs) Consumers

func (u *UnspentOutputs) Consumers() (consumers []ledger.UnspentOutputsSubscriber)

func (*UnspentOutputs) Export

func (u *UnspentOutputs) Export(writer io.WriteSeeker) (err error)

func (*UnspentOutputs) IDs

func (*UnspentOutputs) Import

func (u *UnspentOutputs) Import(reader io.ReadSeeker, targetSlot slot.Index) (err error)

func (*UnspentOutputs) RollbackCreatedOutput

func (u *UnspentOutputs) RollbackCreatedOutput(output *mempool.OutputWithMetadata) (err error)

func (*UnspentOutputs) RollbackSpentOutput

func (u *UnspentOutputs) RollbackSpentOutput(output *mempool.OutputWithMetadata) (err error)

func (*UnspentOutputs) Subscribe

func (u *UnspentOutputs) Subscribe(consumer ledger.UnspentOutputsSubscriber)

func (*UnspentOutputs) Unsubscribe

func (u *UnspentOutputs) Unsubscribe(consumer ledger.UnspentOutputsSubscriber)

Jump to

Keyboard shortcuts

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