nodebridge

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListenToNodeStatusCooldownInMilliseconds = 1_000
)

Variables

View Source
var (
	ErrLedgerUpdateTransactionAlreadyInProgress = errors.New("trying to begin a ledger update transaction with an already active transaction")
	ErrLedgerUpdateInvalidOperation             = errors.New("trying to process a ledger update operation without active transaction")
	ErrLedgerUpdateEndedAbruptly                = errors.New("ledger update transaction ended before receiving all operations")
)
View Source
var ErrAlreadyRegistered = errors.New("callback for block ID is already registered")

ErrAlreadyRegistered is returned when a callback for the same block ID has already been registered.

Functions

func INXBlockMetadataCaller

func INXBlockMetadataCaller(handler interface{}, params ...interface{})

func MilestoneCaller

func MilestoneCaller(handler interface{}, params ...interface{})

Types

type BlockSolidCallback

type BlockSolidCallback = func(*inx.BlockMetadata)

type Events

type Events struct {
	LatestMilestoneChanged    *events.Event
	ConfirmedMilestoneChanged *events.Event
}

type LedgerUpdate

type LedgerUpdate struct {
	MilestoneIndex iotago.MilestoneIndex
	Consumed       []*inx.LedgerSpent
	Created        []*inx.LedgerOutput
}

type Milestone

type Milestone struct {
	MilestoneID iotago.MilestoneID
	Milestone   *iotago.Milestone
}

type NodeBridge

type NodeBridge struct {
	// the logger used to log events.
	*logger.WrappedLogger

	NodeConfig *inx.NodeConfiguration

	Events *Events
	// contains filtered or unexported fields
}

func NewNodeBridge

func NewNodeBridge(ctx context.Context, address string, maxConnectionAttempts uint, log *logger.Logger) (*NodeBridge, error)

func (*NodeBridge) Block

func (n *NodeBridge) Block(ctx context.Context, blockID iotago.BlockID) (*iotago.Block, error)

func (*NodeBridge) BlockMetadata

func (n *NodeBridge) BlockMetadata(ctx context.Context, blockID iotago.BlockID) (*inx.BlockMetadata, error)

func (*NodeBridge) Client

func (n *NodeBridge) Client() inx.INXClient

func (*NodeBridge) ConfirmedMilestone

func (n *NodeBridge) ConfirmedMilestone() (*Milestone, error)

func (*NodeBridge) ConfirmedMilestoneIndex

func (n *NodeBridge) ConfirmedMilestoneIndex() uint32

func (*NodeBridge) EventAPI

EventAPI returns the EventAPIClient if supported by the node. Returns ErrMQTTPluginNotAvailable if the current node does not support the plugin. It retries every second until the given context is done.

func (*NodeBridge) INXNodeClient

func (n *NodeBridge) INXNodeClient() *nodeclient.Client

func (*NodeBridge) Indexer

Indexer returns the IndexerClient. Returns ErrIndexerPluginNotAvailable if the current node does not support the plugin. It retries every second until the given context is done.

func (*NodeBridge) IsNodeAlmostSynced

func (n *NodeBridge) IsNodeAlmostSynced() bool

func (*NodeBridge) IsNodeHealthy

func (n *NodeBridge) IsNodeHealthy() bool

func (*NodeBridge) IsNodeSynced

func (n *NodeBridge) IsNodeSynced() bool

func (*NodeBridge) LatestMilestone

func (n *NodeBridge) LatestMilestone() (*Milestone, error)

func (*NodeBridge) LatestMilestoneIndex

func (n *NodeBridge) LatestMilestoneIndex() uint32

func (*NodeBridge) ListenToBlocks

func (n *NodeBridge) ListenToBlocks(ctx context.Context, cancel context.CancelFunc, consumer func(block *iotago.Block)) error

func (*NodeBridge) ListenToLedgerUpdates

func (n *NodeBridge) ListenToLedgerUpdates(ctx context.Context, startIndex uint32, endIndex uint32, consume func(update *LedgerUpdate) error) error

func (*NodeBridge) Milestone

func (n *NodeBridge) Milestone(ctx context.Context, index uint32) (*Milestone, error)

func (*NodeBridge) MilestoneConeMetadata

func (n *NodeBridge) MilestoneConeMetadata(ctx context.Context, cancel context.CancelFunc, index uint32, consumer func(metadata *inx.BlockMetadata)) error

func (*NodeBridge) NodeStatus

func (n *NodeBridge) NodeStatus() *inx.NodeStatus

func (*NodeBridge) ProtocolParameters

func (n *NodeBridge) ProtocolParameters() *iotago.ProtocolParameters

func (*NodeBridge) RegisterAPIRoute

func (n *NodeBridge) RegisterAPIRoute(ctx context.Context, route string, bindAddress string) error

func (*NodeBridge) RequestTips

func (n *NodeBridge) RequestTips(ctx context.Context, count uint32, allowSemiLazy bool) (iotago.BlockIDs, error)

func (*NodeBridge) Run

func (n *NodeBridge) Run(ctx context.Context)

func (*NodeBridge) SubmitBlock

func (n *NodeBridge) SubmitBlock(ctx context.Context, block *iotago.Block) (iotago.BlockID, error)

func (*NodeBridge) UnregisterAPIRoute

func (n *NodeBridge) UnregisterAPIRoute(ctx context.Context, route string) error

type TangleListener

type TangleListener struct {
	Events *TangleListenerEvents
	// contains filtered or unexported fields
}

func NewTangleListener

func NewTangleListener(nodeBridge *NodeBridge) *TangleListener

func (*TangleListener) ClearBlockSolidCallbacks

func (t *TangleListener) ClearBlockSolidCallbacks()

ClearBlockSolidCallbacks removes all previously registered blockSolidCallbacks.

func (*TangleListener) DeregisterBlockSolidCallback

func (t *TangleListener) DeregisterBlockSolidCallback(blockID iotago.BlockID)

DeregisterBlockSolidCallback removes a previously registered callback for blockID.

func (*TangleListener) DeregisterBlockSolidEvent

func (t *TangleListener) DeregisterBlockSolidEvent(blockID iotago.BlockID)

func (*TangleListener) DeregisterMilestoneConfirmedEvent

func (t *TangleListener) DeregisterMilestoneConfirmedEvent(msIndex uint32)

func (*TangleListener) RegisterBlockSolidCallback

func (t *TangleListener) RegisterBlockSolidCallback(ctx context.Context, blockID iotago.BlockID, f BlockSolidCallback) error

RegisterBlockSolidCallback registers a callback for when a block with blockID becomes solid. If another callback for the same ID has already been registered, an error is returned.

func (*TangleListener) RegisterBlockSolidEvent

func (t *TangleListener) RegisterBlockSolidEvent(ctx context.Context, blockID iotago.BlockID) chan struct{}

func (*TangleListener) RegisterMilestoneConfirmedEvent

func (t *TangleListener) RegisterMilestoneConfirmedEvent(msIndex uint32) chan struct{}

func (*TangleListener) Run

func (t *TangleListener) Run(ctx context.Context)

type TangleListenerEvents

type TangleListenerEvents struct {
	BlockSolid *events.Event
}

type TipPoolListener

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

func NewTipPoolListener

func NewTipPoolListener(nodeBridge *NodeBridge, interval time.Duration) *TipPoolListener

func (*TipPoolListener) GetTipsPoolSizes

func (t *TipPoolListener) GetTipsPoolSizes() (uint32, uint32)

func (*TipPoolListener) Run

func (t *TipPoolListener) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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