ballotwriter

package
v1.7.15 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BallotAddTime = metrics.NewSimpleCounter(
	namespace,
	"ballot_add_time",
	"time spent in ballots.Add (under lock)",
)
View Source
var BatchWriteCount = metrics.NewSimpleCounter(
	namespace,
	"batch_write_count",
	"number of errors when writing a batch",
)
View Source
var CleanupTime = metrics.NewSimpleCounter(
	namespace,
	"cleanup_time",
	"time spent in final cleanup(under lock)",
)
View Source
var ErroredBatchCount = metrics.NewSimpleCounter(
	namespace,
	"errored_batch",
	"number of batches that errored",
)
View Source
var FlushBatchSize = metrics.NewSimpleCounter(
	namespace,
	"flush_batch_size",
	"size of flushed batch",
)
View Source
var LayerBallotTime = metrics.NewSimpleCounter(
	namespace,
	"layer_ballot_time",
	"time spent getting layer-ballot by node id (under lock)",
)
View Source
var WriteBatchErrorsCount = metrics.NewSimpleCounter(
	namespace,
	"write_batch_errors",
	"number of errors when writing a batch",
)
View Source
var WriteTime = metrics.NewSimpleCounter(
	namespace,
	"batch_write_time",
	"time spent writing data to db (under lock)",
)
View Source
var WriteTimeHist = metrics.NewSimpleHistogram(
	"write_time_hist",
	namespace,
	"observed time (in seconds) for writing a ballot",
	prometheus.ExponentialBuckets(0.01, 10, 5),
)

Functions

This section is empty.

Types

type BallotWriter

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

func New

func New(db sql.StateDatabase, logger *zap.Logger) *BallotWriter

func (*BallotWriter) Start

func (w *BallotWriter) Start(ctx context.Context)

Start the forever-loop that flushes the ballots to the DB at-least every `writerDelay`. The caller is responsible to call Start in a different goroutine.

func (*BallotWriter) Store

func (w *BallotWriter) Store(b *types.Ballot) error

Store a ballot. Will return the error encountered during the write to the db. May also return a context canceled error during shutdown.

Jump to

Keyboard shortcuts

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