Documentation
¶
Index ¶
Constants ¶
const DefaultBufferSize = 5000
DefaultBuffer size is the number of unwritten state events which may be held in queue before blocking.
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 ¶
Types ¶
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
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.