trace

package
v0.0.0-...-00b5140 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package trace implements a tracing mechanism to track the state of blockchain events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

Channel represents a trace channel.

func (*Channel) Close

func (c *Channel) Close()

Close closes the trace channel.

func (*Channel) GetChan

func (c *Channel) GetChan() chan Message

GetChan returns the underlying channel of the trace channel.

func (*Channel) GetID

func (c *Channel) GetID() string

GetID returns the ID of the trace channel.

type Config

type Config struct {
	Enabled bool `config:"memory_enabled"`
}

type Message

type Message struct {
	ID    string
	State State
}

Message represents a message to be pushed on a trace channel.

type State

type State int

State represents the state of a blockchain event.

const (
	Mining State = iota
	Creating
	Validating
	Done
	Failed
)

Constants representing different states of a blockchain event.

func (State) String

func (e State) String() string

String returns the string representation of the State.

type Trace

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

Trace represents the trace mechanism to track blockchain events.

func New

func New(cfg Config, log *zap.Logger) *Trace

New creates a new Trace instance with the given configuration and logger.

func (*Trace) CloseReader

func (t *Trace) CloseReader(ch Channel)

CloseReader closes the trace reader channel.

func (*Trace) NewReader

func (t *Trace) NewReader() *Channel

NewReader creates a new trace reader channel.

func (*Trace) Push

func (t *Trace) Push(blockID string, state State)

Push pushes a message onto the trace channel.

Jump to

Keyboard shortcuts

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