multi

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package multi provides a multi-ledger funder and adjudicator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMultiLedgerAssets

func IsMultiLedgerAssets(assets []channel.Asset) bool

IsMultiLedgerAssets returns whether the assets are from multiple ledgers.

Types

type Adjudicator

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

Adjudicator is a multi-ledger adjudicator.

func NewAdjudicator

func NewAdjudicator() *Adjudicator

NewAdjudicator creates a new adjudicator.

func (*Adjudicator) Progress

func (a *Adjudicator) Progress(ctx context.Context, req channel.ProgressReq) error

Progress progresses the state of a multi-ledger channel. It dispatches Progress calls to all relevant adjudicators. If any of the calls fails, the method returns an error.

func (*Adjudicator) Register

func (a *Adjudicator) Register(ctx context.Context, req channel.AdjudicatorReq, subStates []channel.SignedState) error

Register registers a multi-ledger channel. It dispatches Register calls to all relevant adjudicators. If any of the calls fails, the method returns an error.

func (*Adjudicator) RegisterAdjudicator

func (a *Adjudicator) RegisterAdjudicator(l LedgerID, la channel.Adjudicator)

RegisterAdjudicator registers an adjudicator for a given ledger.

func (*Adjudicator) Subscribe

Subscribe creates a new multi-ledger AdjudicatorSubscription.

func (*Adjudicator) Withdraw

func (a *Adjudicator) Withdraw(ctx context.Context, req channel.AdjudicatorReq, subStates channel.StateMap) error

Withdraw withdraws the funds from a multi-ledger channel. It dispatches Withdraw calls to all relevant adjudicators. If any of the calls fails, the method returns an error.

type AdjudicatorSubscription

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

AdjudicatorSubscription is a multi-ledger adjudicator subscription.

func (*AdjudicatorSubscription) Close

func (s *AdjudicatorSubscription) Close() error

Close closes the subscription.

func (*AdjudicatorSubscription) Err

func (s *AdjudicatorSubscription) Err() error

Err blocks until an error occurred and returns it.

func (*AdjudicatorSubscription) Next

Next returns the next event.

type Asset

type Asset interface {
	channel.Asset
	LedgerID() LedgerID
}

Asset defines a multi-ledger asset.

type Funder

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

Funder is a multi-ledger funder.

func NewFunder

func NewFunder() *Funder

NewFunder creates a new funder.

func (*Funder) Fund

func (f *Funder) Fund(ctx context.Context, request channel.FundingReq) error

Fund funds a multi-ledger channel. It dispatches funding calls to all relevant registered funders. It waits until all participants have funded the channel. If any of the funder calls fails, the method returns an error.

func (*Funder) RegisterFunder

func (f *Funder) RegisterFunder(l LedgerID, lf channel.Funder)

RegisterFunder registers a funder for a given ledger.

type LedgerID

type LedgerID interface {
	MapKey() LedgerIDMapKey
}

LedgerID represents a ledger identifier.

type LedgerIDMapKey

type LedgerIDMapKey string

LedgerIDMapKey is the map key representation of a ledger identifier.

Jump to

Keyboard shortcuts

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