eventlog

package
v0.0.0-...-f247ec5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBufferSize = 5000

DefaultBuffer size is the number of unwritten state events which may be held in queue before blocking.

View Source
const DefaultCompressionLevel = gzip.BestSpeed

DefaultCompressionLevel is used for event capture when not overridden. In emperical tests, best speed was only a few tenths of a percent worse than best compression, but your results may vary.

Variables

This section is empty.

Functions

func WriteRecordedEvent

func WriteRecordedEvent(writer io.Writer, event *recording.Event) error

Types

type Reader

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

func NewReader

func NewReader(source io.Reader) (*Reader, error)

func (*Reader) ReadEvent

func (r *Reader) ReadEvent() (*recording.Event, error)

type Recorder

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

Recorder is intended to be used as an imlementation of the mirbft.EventInterceptor interface. It receives state events, serializes them, compresses them, and writes them to a stream.

func NewRecorder

func NewRecorder(nodeID uint64, dest io.Writer, opts ...RecorderOpt) *Recorder

func (*Recorder) Intercept

func (i *Recorder) Intercept(event *state.Event) error

Intercept takes an event and enqueues it into the event buffer. If there is no room in the buffer, it blocks. If draining the buffer to the output stream has completed (successfully or otherwise), Intercept returns an error.

func (*Recorder) Stop

func (i *Recorder) Stop() error

Stop must be invoked to release the resources associated with this Interceptor, and should only be invoked after the mir node has completely exited. The returned error

type RecorderOpt

type RecorderOpt interface{}

func BufferSizeOpt

func BufferSizeOpt(size int) RecorderOpt

BufferSizeOpt overrides the default buffer size of the interceptor buffer. Once the buffer overflows, the state machine will be blocked from receiving new state events until the buffer has room.

func CompressionLevelOpt

func CompressionLevelOpt(level int) RecorderOpt

CompressionLevelOpt takes any of the compression levels supported by the golang standard gzip package.

func RetainRequestDataOpt

func RetainRequestDataOpt() RecorderOpt

RetainRequestDataOpt indicates that the full request data should be embedded into the logs. Usually, this option is undesirable since although request data is not actually needed to replay a log, the request data increases the size of the log substantially and the request data may be considered sensitive so is therefore unsuitable for debug/service. However, for debugging application code, sometimes, having the complete logs is available, so this option may be set to true.

func TimeSourceOpt

func TimeSourceOpt(source func() int64) RecorderOpt

TimeSource can be used to override the default time source for an interceptor. This can be useful for changing the granularity of the timestamps, or picking some externally supplied sync point when trying to synchronize logs. The default time source will timestamp with the time, in milliseconds since the interceptor was created.

Jump to

Keyboard shortcuts

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