pservmgr

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Index

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 paych serving manager.
	Path string
}

Opts is the options for paych serving manager.

type PaychServingManager

type PaychServingManager interface {
	// Serve is used to serve a payment channel.
	//
	// @input - context, currency id, recipient address, channel address, price-per-period, period.
	//
	// @output - error.
	Serve(ctx context.Context, currencyID byte, toAddr string, chAddr string, ppp *big.Int, period *big.Int) error

	// Stop is used to stop serving a payment channel.
	//
	// @input - context, currency id, recipient address, channel address.
	//
	// @output - error.
	Stop(ctx context.Context, currencyID byte, toAddr string, chAddr string) error

	// Inspect is used to inspect a payment channel serving state.
	//
	// @input - context, currency id, recipient address, channel address.
	//
	// @output - if served, price-per-period, period, error.
	Inspect(ctx context.Context, currencyID byte, toAddr string, chAddr string) (bool, *big.Int, *big.Int, error)

	// ListCurrencyIDs lists all currencies.
	//
	// @input - context.
	//
	// @output - currency chan out, error chan out.
	ListCurrencyIDs(ctx context.Context) (<-chan byte, <-chan error)

	// ListRecipients lists all recipients.
	//
	// @input - context, currency id.
	//
	// @output - recipient chan out, error chan out.
	ListRecipients(ctx context.Context, currencyID byte) (<-chan string, <-chan error)

	// ListServings lists all servings.
	//
	// @input - context, currency id, recipient address.
	//
	// @output - paych chan out, error chan out.
	ListServings(ctx context.Context, currencyID byte, toAddr string) (<-chan string, <-chan error)
}

PaychServingManager is the interface for a manager that manages all served payment channels.

type PaychServingManagerImpl

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

PaychServingManagerImpl is the implementation of the PaychServingManager interface.

func NewPaychServingManagerImpl

func NewPaychServingManagerImpl(ctx context.Context, opts Opts) (*PaychServingManagerImpl, error)

NewPaychServingManagerImpl creates a new PaychServingManagerImpl.

@input - context, options.

@output - paych serving manager, error.

func (*PaychServingManagerImpl) Inspect

func (s *PaychServingManagerImpl) Inspect(ctx context.Context, currencyID byte, toAddr string, chAddr string) (bool, *big.Int, *big.Int, error)

Inspect is used to inspect a payment channel serving state.

@input - context, currency id, recipient address, channel address.

@output - if served, price-per-period, period, error.

func (*PaychServingManagerImpl) ListCurrencyIDs

func (s *PaychServingManagerImpl) ListCurrencyIDs(ctx context.Context) (<-chan byte, <-chan error)

ListCurrencyIDs lists all currencies.

@input - context.

@output - currency chan out, error chan out.

func (*PaychServingManagerImpl) ListRecipients

func (s *PaychServingManagerImpl) ListRecipients(ctx context.Context, currencyID byte) (<-chan string, <-chan error)

ListRecipients lists all recipients.

@input - context, currency id.

@output - recipient chan out, error chan out.

func (*PaychServingManagerImpl) ListServings

func (s *PaychServingManagerImpl) ListServings(ctx context.Context, currencyID byte, toAddr string) (<-chan string, <-chan error)

ListServings lists all servings.

@input - context, currency id, recipient address.

@output - paych chan out, error chan out.

func (*PaychServingManagerImpl) Serve

func (s *PaychServingManagerImpl) Serve(ctx context.Context, currencyID byte, toAddr string, chAddr string, ppp *big.Int, period *big.Int) error

Serve is used to serve a payment channel.

@input - context, currency id, recipient address, channel address, price-per-period, period.

@output - error.

func (*PaychServingManagerImpl) Shutdown

func (s *PaychServingManagerImpl) Shutdown()

Shutdown safely shuts down the component.

func (*PaychServingManagerImpl) Stop

func (s *PaychServingManagerImpl) Stop(ctx context.Context, currencyID byte, toAddr string, chAddr string) error

Stop is used to stop serving a payment channel.

@input - context, currency id, recipient address, channel address.

@output - error.

Jump to

Keyboard shortcuts

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