Documentation
¶
Overview ¶
Package engine contains the types and imperative code for the business logic of a go-nitro Node.
Index ¶
Constants ¶
const ( Incoming messageDirection = "Incoming" Outgoing messageDirection = "Outgoing" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletedObjectiveEvent ¶
type CompletedObjectiveEvent struct {
Id protocols.ObjectiveId
}
type Engine ¶
type Engine struct {
// From API
ObjectiveRequestsFromAPI chan protocols.ObjectiveRequest
PaymentRequestsFromAPI chan PaymentRequest
// contains filtered or unexported fields
}
Engine is the imperative part of the core business logic of a go-nitro Node
func New ¶
func New(vm *payments.VoucherManager, msg messageservice.MessageService, chain chainservice.ChainService, store store.Store, policymaker PolicyMaker, eventHandler func(EngineEvent)) Engine
NewEngine is the constructor for an Engine
func (*Engine) GetConsensusAppAddress ¶
GetConsensusAppAddress returns the address of a deployed ConsensusApp (for ledger channels)
func (*Engine) GetVirtualPaymentAppAddress ¶
GetVirtualPaymentAppAddress returns the address of a deployed VirtualPaymentApp
type EngineEvent ¶
type EngineEvent struct {
// These are objectives that are now completed
CompletedObjectives []protocols.Objective
// These are objectives that have failed
FailedObjectives []protocols.ObjectiveId
// ReceivedVouchers are vouchers we've received from other participants
ReceivedVouchers []payments.Voucher
// LedgerChannelUpdates contains channel info for ledger channels that have been updated
LedgerChannelUpdates []query.LedgerChannelInfo
// PaymentChannelUpdates contains channel info for payment channels that have been updated
PaymentChannelUpdates []query.PaymentChannelInfo
}
EngineEvent is a struct that contains a list of changes caused by handling a message/chain event/api event
func (*EngineEvent) IsEmpty ¶
func (ee *EngineEvent) IsEmpty() bool
IsEmpty returns true if the EngineEvent contains no changes
func (*EngineEvent) Merge ¶
func (ee *EngineEvent) Merge(other EngineEvent)
type ErrGetObjective ¶
type ErrGetObjective struct {
// contains filtered or unexported fields
}
func (*ErrGetObjective) Error ¶
func (e *ErrGetObjective) Error() string
type ErrUnhandledChainEvent ¶
type ErrUnhandledChainEvent struct {
// contains filtered or unexported fields
}
ErrUnhandledChainEvent is an engine error when the the engine cannot process a chain event
func (*ErrUnhandledChainEvent) Error ¶
func (uce *ErrUnhandledChainEvent) Error() string
type PaymentRequest ¶
type PaymentRequest struct {
ChannelId types.Destination
Amount *big.Int
}
PaymentRequest represents a request from the API to make a payment using a channel
type PermissivePolicy ¶
type PermissivePolicy struct{}
PermissivePolicy is a policy maker that decides to approve every unapproved objective
func (*PermissivePolicy) ShouldApprove ¶
func (pp *PermissivePolicy) ShouldApprove(o protocols.Objective) bool
ShouldApprove decides to approve o if it is currently unapproved
type PolicyMaker ¶
PolicyMaker is used to decide whether to approve or reject an objective
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chainservice is a chain service responsible for submitting blockchain transactions and relaying blockchain events.
|
Package chainservice is a chain service responsible for submitting blockchain transactions and relaying blockchain events. |
|
adjudicator
package NitroAdjudicator contains bindings generated from the Nitro Adjudicator solidity contract, as well as utilities for converting client types to on-chain types.
|
package NitroAdjudicator contains bindings generated from the Nitro Adjudicator solidity contract, as well as utilities for converting client types to on-chain types. |
|
Package messageservice is a messaging service responsible for routing messages to peers and relaying messages received from peers.
|
Package messageservice is a messaging service responsible for routing messages to peers and relaying messages received from peers. |
|
Package store contains the interface for a go-nitro store.
|
Package store contains the interface for a go-nitro store. |