Documentation ¶
Overview ¶
Package store contains the interface for a go-nitro store.
Index ¶
- Constants
- type ConsensusChannelStore
- type DurableStore
- func (ds *DurableStore) Close() error
- func (ds *DurableStore) DestroyChannel(id types.Destination) error
- func (ds *DurableStore) DestroyConsensusChannel(id types.Destination) error
- func (ds *DurableStore) GetAddress() *types.Address
- func (ds *DurableStore) GetAllConsensusChannels() ([]*consensus_channel.ConsensusChannel, error)
- func (ds *DurableStore) GetChannelById(id types.Destination) (c *channel.Channel, ok bool)
- func (ds *DurableStore) GetChannelSecretKey() *[]byte
- func (ds *DurableStore) GetChannelsByAppDefinition(appDef types.Address) ([]*channel.Channel, error)
- func (ds *DurableStore) GetChannelsByIds(ids []types.Destination) ([]*channel.Channel, error)
- func (ds *DurableStore) GetChannelsByParticipant(participant types.Address) ([]*channel.Channel, error)
- func (ps *DurableStore) GetConsensusChannel(counterparty types.Address) (channel *consensus_channel.ConsensusChannel, ok bool)
- func (ds *DurableStore) GetConsensusChannelById(id types.Destination) (channel *consensus_channel.ConsensusChannel, err error)
- func (ds *DurableStore) GetLastBlockNumSeen() (uint64, error)
- func (ps *DurableStore) GetObjectiveByChannelId(channelId types.Destination) (protocols.Objective, bool)
- func (ds *DurableStore) GetObjectiveById(id protocols.ObjectiveId) (protocols.Objective, error)
- func (ds *DurableStore) GetVoucherInfo(channelId types.Destination) (*payments.VoucherInfo, error)
- func (ds *DurableStore) ReleaseChannelFromOwnership(channelId types.Destination) error
- func (ds *DurableStore) RemoveVoucherInfo(channelId types.Destination) error
- func (ds *DurableStore) SetChannel(ch *channel.Channel) error
- func (ps *DurableStore) SetConsensusChannel(ch *consensus_channel.ConsensusChannel) error
- func (ds *DurableStore) SetLastBlockNumSeen(blockNumber uint64) error
- func (ds *DurableStore) SetObjective(obj protocols.Objective) error
- func (ds *DurableStore) SetVoucherInfo(channelId types.Destination, v payments.VoucherInfo) error
- type MemStore
- func (ms *MemStore) Close() error
- func (ms *MemStore) DestroyChannel(id types.Destination) error
- func (ms *MemStore) DestroyConsensusChannel(id types.Destination) error
- func (ms *MemStore) GetAddress() *types.Address
- func (ms *MemStore) GetAllConsensusChannels() ([]*consensus_channel.ConsensusChannel, error)
- func (ms *MemStore) GetChannelById(id types.Destination) (c *channel.Channel, ok bool)
- func (ms *MemStore) GetChannelSecretKey() *[]byte
- func (ms *MemStore) GetChannelsByAppDefinition(appDef types.Address) ([]*channel.Channel, error)
- func (ms *MemStore) GetChannelsByIds(ids []types.Destination) ([]*channel.Channel, error)
- func (ms *MemStore) GetChannelsByParticipant(participant types.Address) ([]*channel.Channel, error)
- func (ms *MemStore) GetConsensusChannel(counterparty types.Address) (channel *consensus_channel.ConsensusChannel, ok bool)
- func (ms *MemStore) GetConsensusChannelById(id types.Destination) (channel *consensus_channel.ConsensusChannel, err error)
- func (ms *MemStore) GetLastBlockNumSeen() (uint64, error)
- func (ms *MemStore) GetObjectiveByChannelId(channelId types.Destination) (protocols.Objective, bool)
- func (ms *MemStore) GetObjectiveById(id protocols.ObjectiveId) (protocols.Objective, error)
- func (ms *MemStore) GetVoucherInfo(channelId types.Destination) (*payments.VoucherInfo, error)
- func (ms *MemStore) ReleaseChannelFromOwnership(channelId types.Destination) error
- func (ms *MemStore) RemoveVoucherInfo(channelId types.Destination) error
- func (ms *MemStore) SetChannel(ch *channel.Channel) error
- func (ms *MemStore) SetConsensusChannel(ch *consensus_channel.ConsensusChannel) error
- func (ms *MemStore) SetLastBlockNumSeen(blockNumber uint64) error
- func (ms *MemStore) SetObjective(obj protocols.Objective) error
- func (ms *MemStore) SetVoucherInfo(channelId types.Destination, v payments.VoucherInfo) error
- type Store
- type StoreOpts
Constants ¶
const ( ErrNoSuchObjective = types.ConstError("store: no such objective") ErrNoSuchChannel = types.ConstError("store: failed to find required channel data") ErrLoadVouchers = types.ConstError("store: could not load vouchers") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsensusChannelStore ¶
type ConsensusChannelStore interface { GetAllConsensusChannels() ([]*consensus_channel.ConsensusChannel, error) GetConsensusChannel(counterparty types.Address) (channel *consensus_channel.ConsensusChannel, ok bool) GetConsensusChannelById(id types.Destination) (channel *consensus_channel.ConsensusChannel, err error) SetConsensusChannel(*consensus_channel.ConsensusChannel) error DestroyConsensusChannel(id types.Destination) error }
type DurableStore ¶
type DurableStore struct {
// contains filtered or unexported fields
}
func (*DurableStore) Close ¶
func (ds *DurableStore) Close() error
func (*DurableStore) DestroyChannel ¶
func (ds *DurableStore) DestroyChannel(id types.Destination) error
DestroyChannel deletes the channel with id id.
func (*DurableStore) DestroyConsensusChannel ¶
func (ds *DurableStore) DestroyConsensusChannel(id types.Destination) error
DestroyChannel deletes the channel with id id.
func (*DurableStore) GetAddress ¶
func (ds *DurableStore) GetAddress() *types.Address
func (*DurableStore) GetAllConsensusChannels ¶
func (ds *DurableStore) GetAllConsensusChannels() ([]*consensus_channel.ConsensusChannel, error)
func (*DurableStore) GetChannelById ¶
func (ds *DurableStore) GetChannelById(id types.Destination) (c *channel.Channel, ok bool)
GetChannelById retrieves the channel with the supplied id, if it exists.
func (*DurableStore) GetChannelSecretKey ¶
func (ds *DurableStore) GetChannelSecretKey() *[]byte
func (*DurableStore) GetChannelsByAppDefinition ¶
func (ds *DurableStore) GetChannelsByAppDefinition(appDef types.Address) ([]*channel.Channel, error)
GetChannelsByAppDefinition returns any channels that include the given app definition
func (*DurableStore) GetChannelsByIds ¶
func (ds *DurableStore) GetChannelsByIds(ids []types.Destination) ([]*channel.Channel, error)
GetChannelsByIds returns any channels with ids in the supplied list.
func (*DurableStore) GetChannelsByParticipant ¶
func (ds *DurableStore) GetChannelsByParticipant(participant types.Address) ([]*channel.Channel, error)
GetChannelsByParticipant returns any channels that include the given participant
func (*DurableStore) GetConsensusChannel ¶
func (ps *DurableStore) GetConsensusChannel(counterparty types.Address) (channel *consensus_channel.ConsensusChannel, ok bool)
GetConsensusChannel returns a ConsensusChannel between the calling node and the supplied counterparty, if such channel exists
func (*DurableStore) GetConsensusChannelById ¶
func (ds *DurableStore) GetConsensusChannelById(id types.Destination) (channel *consensus_channel.ConsensusChannel, err error)
GetConsensusChannelById returns a ConsensusChannel with the given channel id
func (*DurableStore) GetLastBlockNumSeen ¶
func (ds *DurableStore) GetLastBlockNumSeen() (uint64, error)
GetLastBlockNumSeen retrieves the last blockchain block processed by this node
func (*DurableStore) GetObjectiveByChannelId ¶
func (ps *DurableStore) GetObjectiveByChannelId(channelId types.Destination) (protocols.Objective, bool)
func (*DurableStore) GetObjectiveById ¶
func (ds *DurableStore) GetObjectiveById(id protocols.ObjectiveId) (protocols.Objective, error)
func (*DurableStore) GetVoucherInfo ¶
func (ds *DurableStore) GetVoucherInfo(channelId types.Destination) (*payments.VoucherInfo, error)
func (*DurableStore) ReleaseChannelFromOwnership ¶
func (ds *DurableStore) ReleaseChannelFromOwnership(channelId types.Destination) error
func (*DurableStore) RemoveVoucherInfo ¶
func (ds *DurableStore) RemoveVoucherInfo(channelId types.Destination) error
func (*DurableStore) SetChannel ¶
func (ds *DurableStore) SetChannel(ch *channel.Channel) error
SetChannel sets the channel in the store.
func (*DurableStore) SetConsensusChannel ¶
func (ps *DurableStore) SetConsensusChannel(ch *consensus_channel.ConsensusChannel) error
SetConsensusChannel sets the channel in the store.
func (*DurableStore) SetLastBlockNumSeen ¶
func (ds *DurableStore) SetLastBlockNumSeen(blockNumber uint64) error
SetLastBlockNumSeen sets the last blockchain block processed by this node
func (*DurableStore) SetObjective ¶
func (ds *DurableStore) SetObjective(obj protocols.Objective) error
func (*DurableStore) SetVoucherInfo ¶
func (ds *DurableStore) SetVoucherInfo(channelId types.Destination, v payments.VoucherInfo) error
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
func (*MemStore) DestroyChannel ¶
func (ms *MemStore) DestroyChannel(id types.Destination) error
DestroyChannel deletes the channel with id id.
func (*MemStore) DestroyConsensusChannel ¶
func (ms *MemStore) DestroyConsensusChannel(id types.Destination) error
DestroyChannel deletes the channel with id id.
func (*MemStore) GetAddress ¶
func (*MemStore) GetAllConsensusChannels ¶
func (ms *MemStore) GetAllConsensusChannels() ([]*consensus_channel.ConsensusChannel, error)
func (*MemStore) GetChannelById ¶
GetChannelById retrieves the channel with the supplied id, if it exists.
func (*MemStore) GetChannelSecretKey ¶
func (*MemStore) GetChannelsByAppDefinition ¶
GetChannelsByAppDefinition returns any channels that include the given app definition
func (*MemStore) GetChannelsByIds ¶
GetChannelsByIds returns a collection of channels with the given ids
func (*MemStore) GetChannelsByParticipant ¶
GetChannelsByParticipant returns any channels that include the given participant
func (*MemStore) GetConsensusChannel ¶
func (ms *MemStore) GetConsensusChannel(counterparty types.Address) (channel *consensus_channel.ConsensusChannel, ok bool)
GetConsensusChannel returns a ConsensusChannel between the calling node and the supplied counterparty, if such channel exists
func (*MemStore) GetConsensusChannelById ¶
func (ms *MemStore) GetConsensusChannelById(id types.Destination) (channel *consensus_channel.ConsensusChannel, err error)
GetConsensusChannelById returns a ConsensusChannel with the given channel id
func (*MemStore) GetLastBlockNumSeen ¶
GetLastBlockNumSeen
func (*MemStore) GetObjectiveByChannelId ¶
func (*MemStore) GetObjectiveById ¶
func (*MemStore) GetVoucherInfo ¶
func (ms *MemStore) GetVoucherInfo(channelId types.Destination) (*payments.VoucherInfo, error)
func (*MemStore) ReleaseChannelFromOwnership ¶
func (ms *MemStore) ReleaseChannelFromOwnership(channelId types.Destination) error
func (*MemStore) RemoveVoucherInfo ¶
func (ms *MemStore) RemoveVoucherInfo(channelId types.Destination) error
func (*MemStore) SetChannel ¶
SetChannel sets the channel in the store.
func (*MemStore) SetConsensusChannel ¶
func (ms *MemStore) SetConsensusChannel(ch *consensus_channel.ConsensusChannel) error
SetConsensusChannel sets the channel in the store.
func (*MemStore) SetLastBlockNumSeen ¶
SetLastBlockNumSeen
func (*MemStore) SetVoucherInfo ¶
func (ms *MemStore) SetVoucherInfo(channelId types.Destination, v payments.VoucherInfo) error
type Store ¶
type Store interface { GetChannelSecretKey() *[]byte // Get a pointer to a secret key for signing channel updates GetAddress() *types.Address // Get the (Ethereum) address associated with the ChannelSecretKey GetObjectiveById(protocols.ObjectiveId) (protocols.Objective, error) // Read an existing objective GetObjectiveByChannelId(types.Destination) (obj protocols.Objective, ok bool) // Get the objective that currently owns the channel with the supplied ChannelId SetObjective(protocols.Objective) error // Write an objective GetChannelsByIds(ids []types.Destination) ([]*channel.Channel, error) // Returns a collection of channels with the given ids GetChannelById(id types.Destination) (c *channel.Channel, ok bool) GetChannelsByParticipant(participant types.Address) ([]*channel.Channel, error) // Returns any channels that includes the given participant SetChannel(*channel.Channel) error DestroyChannel(id types.Destination) error GetChannelsByAppDefinition(appDef types.Address) ([]*channel.Channel, error) // Returns any channels that includes the given app definition ReleaseChannelFromOwnership(types.Destination) error // Release channel from being owned by any objective GetLastBlockNumSeen() (uint64, error) SetLastBlockNumSeen(uint64) error ConsensusChannelStore payments.VoucherStore io.Closer }
Store is responsible for persisting objectives, objective metadata, states, signatures, private keys and blockchain data
func NewDurableStore ¶
NewDurableStore creates a new DurableStore that uses the given folder to store its data It will create the folder if it does not exist