Documentation
¶
Overview ¶
Package keyvalue contains an implementation of the channel persister interface using a keyvalue database interface.
Index ¶
- type ChannelIterator
- type PersistRestorer
- func (pr *PersistRestorer) ActivePeers(ctx context.Context) ([]map[wallet.BackendID]wire.Address, error)
- func (pr *PersistRestorer) ChannelCreated(_ context.Context, s channel.Source, peers []map[wallet.BackendID]wire.Address, ...) error
- func (pr *PersistRestorer) ChannelRemoved(ctx context.Context, id channel.ID) error
- func (pr *PersistRestorer) Close() error
- func (pr *PersistRestorer) Enabled(_ context.Context, s channel.Source) error
- func (pr *PersistRestorer) PhaseChanged(_ context.Context, s channel.Source) error
- func (pr *PersistRestorer) RestoreAll() (persistence.ChannelIterator, error)
- func (pr *PersistRestorer) RestoreChannel(ctx context.Context, id channel.ID) (*persistence.Channel, error)
- func (pr *PersistRestorer) RestorePeer(addr map[wallet.BackendID]wire.Address) (persistence.ChannelIterator, error)
- func (pr *PersistRestorer) SigAdded(_ context.Context, s channel.Source, idx channel.Index) error
- func (pr *PersistRestorer) Staged(_ context.Context, s channel.Source) error
- type PersistedState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelIterator ¶
type ChannelIterator struct {
// contains filtered or unexported fields
}
ChannelIterator implements the persistence.ChannelIterator interface.
func (*ChannelIterator) Channel ¶
func (i *ChannelIterator) Channel() *persistence.Channel
Channel returns the iterator's current channel.
func (*ChannelIterator) Close ¶
func (i *ChannelIterator) Close() error
Close closes the iterator and releases its resources. It returns the last error that occurred when advancing the iterator.
type PersistRestorer ¶
type PersistRestorer struct {
// contains filtered or unexported fields
}
PersistRestorer implements both the persister and the restorer interface using a sorted key-value store.
func NewPersistRestorer ¶
func NewPersistRestorer(db sortedkv.Database) *PersistRestorer
NewPersistRestorer creates a new PersistRestorer for the supplied database.
func (*PersistRestorer) ActivePeers ¶
func (pr *PersistRestorer) ActivePeers(ctx context.Context) ([]map[wallet.BackendID]wire.Address, error)
ActivePeers returns a list of all peers with which a channel is persisted.
func (*PersistRestorer) ChannelCreated ¶
func (pr *PersistRestorer) ChannelCreated(_ context.Context, s channel.Source, peers []map[wallet.BackendID]wire.Address, parent *channel.ID) error
ChannelCreated inserts a channel into the database.
func (*PersistRestorer) ChannelRemoved ¶
ChannelRemoved deletes a channel from the database.
func (*PersistRestorer) Close ¶
func (pr *PersistRestorer) Close() error
Close closes the PersistRestorer and releases all resources it holds.
func (*PersistRestorer) Enabled ¶
Enabled persists the channel's staging and current transaction, and phase.
func (*PersistRestorer) PhaseChanged ¶
PhaseChanged persists the channel's phase.
func (*PersistRestorer) RestoreAll ¶
func (pr *PersistRestorer) RestoreAll() (persistence.ChannelIterator, error)
RestoreAll should return an iterator over all persisted channels.
func (*PersistRestorer) RestoreChannel ¶ added in v0.4.0
func (pr *PersistRestorer) RestoreChannel(ctx context.Context, id channel.ID) (*persistence.Channel, error)
RestoreChannel restores a single channel.
func (*PersistRestorer) RestorePeer ¶
func (pr *PersistRestorer) RestorePeer(addr map[wallet.BackendID]wire.Address) (persistence.ChannelIterator, error)
RestorePeer should return an iterator over all persisted channels which the given peer is a part of.
type PersistedState ¶ added in v0.4.0
PersistedState is a helper struct to allow for de-/encoding of empty states.