publisher

package
v0.6.1-alpha.6-prerelease Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PublishBlockEvents added in v1.0.3

func PublishBlockEvents(blockApplied *blockApplied, events *Events, log *logger.Logger)

PublishBlockEvents extracts the events from a block, its returns a chan of ISCEventType, so they can be filtered

Types

type Events added in v1.0.3

type Events struct {
	BlockEvents    *event.Event1[*ISCEvent[[]string]]
	NewBlock       *event.Event1[*ISCEvent[*blocklog.BlockInfo]]
	RequestReceipt *event.Event1[*ISCEvent[*ReceiptWithError]]

	Published *event.Event1[*ISCEvent[any]]
}

type ISCEvent added in v1.0.3

type ISCEvent[T any] struct {
	Kind      ISCEventType  `json:"kind"`
	Issuer    isc.AgentID   `json:"issuer"`    // (AgentID) nil means issued by the VM
	RequestID isc.RequestID `json:"requestID"` // (isc.RequestID)
	ChainID   isc.ChainID   `json:"chainID"`   // (isc.ChainID)
	Payload   T             `json:"payload"`
}

func (*ISCEvent[T]) String added in v1.0.3

func (e *ISCEvent[T]) String() string

kind is not printed right now, because it is added when calling p.publish

type ISCEventType added in v1.0.3

type ISCEventType string
const (
	ISCEventKindNewBlock    ISCEventType = "new_block"
	ISCEventKindReceipt     ISCEventType = "receipt" // issuer will be the request sender
	ISCEventKindBlockEvents ISCEventType = "block_events"
	ISCEventIssuerVM        ISCEventType = "vm"
)

type Publisher added in v1.0.3

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

func New added in v1.0.3

func New(log *logger.Logger) *Publisher

func (*Publisher) AccessNodesUpdated added in v1.0.3

func (p *Publisher) AccessNodesUpdated(chainID isc.ChainID, accessNodes []*cryptolib.PublicKey)

Implements the chain.ChainListener interface. NOTE: Do not block the caller!

func (*Publisher) BlockApplied added in v1.0.3

func (p *Publisher) BlockApplied(chainID isc.ChainID, block state.Block)

Implements the chain.ChainListener interface. NOTE: Do not block the caller!

func (*Publisher) Run added in v1.0.3

func (p *Publisher) Run(ctx context.Context)

This is called by the component to run this.

func (*Publisher) ServerNodesUpdated added in v1.0.3

func (p *Publisher) ServerNodesUpdated(chainID isc.ChainID, serverNodes []*cryptolib.PublicKey)

Implements the chain.ChainListener interface. NOTE: Do not block the caller!

type ReceiptWithError added in v1.0.3

type ReceiptWithError struct {
	RequestReceipt *isc.Receipt
	Error          *isc.VMError
}

Jump to

Keyboard shortcuts

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