Documentation ¶
Index ¶
- type Opts
- type PaychStore
- type PaychStoreImpl
- func (s *PaychStoreImpl) ListCurrencyIDs(ctx context.Context) (<-chan byte, <-chan error)
- func (s *PaychStoreImpl) ListPaychsByPeer(ctx context.Context, currencyID byte, peerAddr string) (<-chan string, <-chan error)
- func (s *PaychStoreImpl) ListPeers(ctx context.Context, currencyID byte) (<-chan string, <-chan error)
- func (s *PaychStoreImpl) Read(ctx context.Context, currencyID byte, peerAddr string, chAddr string) (paychstate.State, error)
- func (s *PaychStoreImpl) Remove(currencyID byte, peerAddr string, chAddr string)
- func (s *PaychStoreImpl) Shutdown()
- func (s *PaychStoreImpl) Upsert(state paychstate.State)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct { // The datastore path of the paychstore. Path string // Timeout for DS operation. DSTimeout time.Duration // Retry for DS operation. DSRetry uint64 }
Opts is the options for the paychstore.
type PaychStore ¶
type PaychStore interface { // Upsert is used to update or insert a channel state. // // @input - channel state. Upsert(state paychstate.State) // Remove is used to remove a channel state. // // @input - currency id, peer address, channel address. Remove(currencyID byte, peerAddr string, chAddr string) // Read is used to read a channel state. // // @input - context, currency id, peer address, channel address. // // @output - channel state, error. Read(ctx context.Context, currencyID byte, peerAddr string, chAddr string) (paychstate.State, error) // ListCurrencyIDs is used to list all currencies. // // @input - context. // // @output - currency id chan out, error chan out. ListCurrencyIDs(ctx context.Context) (<-chan byte, <-chan error) // ListPeers is used to list all peers. // // @input - context, currency id. // // @output - peer address chan out, error chan out. ListPeers(ctx context.Context, currencyID byte) (<-chan string, <-chan error) // List channels by peer. // // @input - context, currency id, peer address. // // @output - channel address chan out, error chan out. ListPaychsByPeer(ctx context.Context, currencyID byte, peerAddr string) (<-chan string, <-chan error) }
PaychStore is the interface for a storage storing all payment channels.
type PaychStoreImpl ¶
type PaychStoreImpl struct {
// contains filtered or unexported fields
}
PaychStoreImpl is the implementation of the PaychStore interface.
func NewPaychStoreImpl ¶
func NewPaychStoreImpl(ctx context.Context, active bool, outbound bool, opts Opts) (*PaychStoreImpl, error)
NewPaychStoreImpl creates a new PaychStoreImpl.
@input - context, if it is storing active channel, if it is outbound channel, options.
@output - store, error.
func (*PaychStoreImpl) ListCurrencyIDs ¶
func (s *PaychStoreImpl) ListCurrencyIDs(ctx context.Context) (<-chan byte, <-chan error)
ListCurrencyIDs is used to list all currencies.
@input - context.
@output - currency id chan out, error chan out.
func (*PaychStoreImpl) ListPaychsByPeer ¶
func (s *PaychStoreImpl) ListPaychsByPeer(ctx context.Context, currencyID byte, peerAddr string) (<-chan string, <-chan error)
List channels by peer.
@input - context, currency id, peer address.
@output - channel address chan out, error chan out.
func (*PaychStoreImpl) ListPeers ¶
func (s *PaychStoreImpl) ListPeers(ctx context.Context, currencyID byte) (<-chan string, <-chan error)
ListPeers is used to list all peers.
@input - context, currency id.
@output - peer address chan out, error chan out.
func (*PaychStoreImpl) Read ¶
func (s *PaychStoreImpl) Read(ctx context.Context, currencyID byte, peerAddr string, chAddr string) (paychstate.State, error)
Read is used to read a channel state.
@input - context, currency id, peer address, channel address.
@output - channel state, error.
func (*PaychStoreImpl) Remove ¶
func (s *PaychStoreImpl) Remove(currencyID byte, peerAddr string, chAddr string)
Remove is used to remove a channel state.
@input - currency id, peer address, channel address.
func (*PaychStoreImpl) Shutdown ¶
func (s *PaychStoreImpl) Shutdown()
Shutdown safely shuts down the component.
func (*PaychStoreImpl) Upsert ¶
func (s *PaychStoreImpl) Upsert(state paychstate.State)
Upsert is used to update or insert a channel state.
@input - channel state.