global

package
v0.0.0-...-261ff67 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MultiStateDBName     = "proximadb"
	TxStoreDBName        = "proximadb.txstore"
	ConfigKeyTxStoreType = "txstore.type"
)
View Source
const TimeLayoutDefault = "01-02 15:04:05.000"
View Source
const TraceTag = "global"
View Source
const Version = "0.0-proto"

Version is the version of the Proxima node

Variables

This section is empty.

Functions

func BannerString

func BannerString() string

func NewLogger

func NewLogger(name string, level zapcore.Level, outputs []string, timeLayout string) *zap.SugaredLogger

func SetGlobalLogger

func SetGlobalLogger(l *Global)

SetGlobalLogger not thread safe

Types

type Global

type Global struct {
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewDefault

func NewDefault() *Global

func NewFromConfig

func NewFromConfig() *Global

func (*Global) AssertMustError

func (l *Global) AssertMustError(err error)

func (*Global) AssertNoError

func (l *Global) AssertNoError(err error, prefix ...string)

func (*Global) Assertf

func (l *Global) Assertf(cond bool, format string, args ...any)

func (*Global) Ctx

func (l *Global) Ctx() context.Context

func (*Global) Log

func (l *Global) Log() *zap.SugaredLogger

func (*Global) LogAttacherStats

func (l *Global) LogAttacherStats() bool

func (*Global) MarkWorkProcessStarted

func (l *Global) MarkWorkProcessStarted(name string)

func (*Global) MarkWorkProcessStopped

func (l *Global) MarkWorkProcessStopped(name string)

func (*Global) MetricsRegistry

func (l *Global) MetricsRegistry() *prometheus.Registry

func (*Global) MustWaitAllWorkProcessesStop

func (l *Global) MustWaitAllWorkProcessesStop(timeout ...time.Duration)

func (*Global) RepeatEvery

func (l *Global) RepeatEvery(period time.Duration, fun func() bool, skipFirst ...bool)

func (*Global) StartTracingTags

func (l *Global) StartTracingTags(tags ...string)

func (*Global) StartTracingTx

func (l *Global) StartTracingTx(txid ledger.TransactionID)

func (*Global) Stop

func (l *Global) Stop()

func (*Global) StopTracingTag

func (l *Global) StopTracingTag(tag string)

func (*Global) StopTracingTx

func (l *Global) StopTracingTx(txid ledger.TransactionID)

func (*Global) TraceTx

func (l *Global) TraceTx(txid *ledger.TransactionID, format string, args ...any)

func (*Global) Tracef

func (l *Global) Tracef(tag string, format string, args ...any)

type IndexedStateReader

type IndexedStateReader interface {
	StateReader
	StateIndexReader
}

IndexedStateReader state and indexer readers packing together

type Logging

type Logging interface {
	Log() *zap.SugaredLogger
	Tracef(tag string, format string, args ...any)
	TraceTx(txid *ledger.TransactionID, format string, args ...any)
	Assertf(cond bool, format string, args ...any)
	AssertNoError(err error, prefix ...string)
	AssertMustError(err error)
	LogAttacherStats() bool
}

func Logger

func Logger() Logging

type Metrics

type Metrics interface {
	MetricsRegistry() *prometheus.Registry
}

type NodeGlobal

type NodeGlobal interface {
	Logging
	TraceTx
	StartStop
	Metrics
}

type NodeInfo

type NodeInfo struct {
	Name           string                 `json:"name"`
	ID             peer.ID                `json:"id"`
	NumStaticPeers uint16                 `json:"num_static_peers"`
	NumActivePeers uint16                 `json:"num_active_peers"`
	Sequencers     []ledger.ChainID       `json:"sequencers,omitempty"`
	Branches       []ledger.TransactionID `json:"branches,omitempty"`
}

func NodeInfoFromBytes

func NodeInfoFromBytes(data []byte) (*NodeInfo, error)

func (*NodeInfo) Bytes

func (ni *NodeInfo) Bytes() []byte

func (*NodeInfo) Lines

func (ni *NodeInfo) Lines(prefix ...string) *lines.Lines

TODO not finished

type StartStop

type StartStop interface {
	Ctx() context.Context
	Stop()
	MarkWorkProcessStarted(name string)
	MarkWorkProcessStopped(name string)
	RepeatEvery(period time.Duration, fun func() bool, skipFirst ...bool) // runs background goroutine
}

StartStop interface of the global objet\ct which coordinates graceful shutdown

type StateIndexReader

type StateIndexReader interface {
	GetIDsLockedInAccount(addr ledger.AccountID) ([]ledger.OutputID, error)
	GetUTXOsLockedInAccount(accountID ledger.AccountID) ([]*ledger.OutputDataWithID, error)
	GetUTXOForChainID(id *ledger.ChainID) (*ledger.OutputDataWithID, error)
	Root() common.VCommitment
	MustLedgerIdentityBytes() []byte // either state identity consistent or panic
}

type StateReader

type StateReader interface {
	GetUTXO(id *ledger.OutputID) ([]byte, bool)
	HasUTXO(id *ledger.OutputID) bool
	KnowsCommittedTransaction(txid *ledger.TransactionID) bool // all txids are kept in the state for some time
}

type StateStore

type StateStore interface {
	StateStoreReader
	common.BatchedUpdatable
}

type StateStoreReader

type StateStoreReader interface {
	common.KVReader
	common.Traversable
	IsClosed() bool
}

type TraceTx

type TraceTx interface {
	StartTracingTx(txid ledger.TransactionID)
	StopTracingTx(txid ledger.TransactionID)
}

type TxBytesGet

type TxBytesGet interface {
	// GetTxBytesWithMetadata return empty slice on absence, otherwise returns concatenated metadata bytes and transaction bytes
	GetTxBytesWithMetadata(id *ledger.TransactionID) []byte
	HasTxBytes(txid *ledger.TransactionID) bool
}

type TxBytesPersist

type TxBytesPersist interface {
	// PersistTxBytesWithMetadata saves txBytes prefixed with metadata bytes.
	// metadata == nil is interpreted as empty metadata (one 0 byte as prefix)
	PersistTxBytesWithMetadata(txBytes []byte, metadata *txmetadata.TransactionMetadata) (ledger.TransactionID, error)
}

type TxBytesStore

type TxBytesStore interface {
	TxBytesGet
	TxBytesPersist
}

Jump to

Keyboard shortcuts

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