recorders

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedRecorder

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

BufferedRecorder is an alternative Recorder that can be used when users are confident that a recording will be short. It provides some extra metadata for recording files. Not currently recommended for use.

func NewBufferedRecorder

func NewBufferedRecorder(clock clockwork.Clock, shell string) BufferedRecorder

NewBufferedRecorder is a constructor for a BufferedRecorder

func (*BufferedRecorder) AddEvent

func (r *BufferedRecorder) AddEvent(eType common.EventType, data string, evtTime time.Time)

AddEvent records an event from the provided input

func (*BufferedRecorder) GetDurationInSeconds

func (r *BufferedRecorder) GetDurationInSeconds() float64

GetDurationInSeconds returns the difference between the very first action and the very last action. If not events have been recorded yet, returns 0

func (*BufferedRecorder) GetEventCount

func (r *BufferedRecorder) GetEventCount() int

GetEventCount returns the number of encoutnered events in this stream

func (*BufferedRecorder) GetEventsForTesting

func (r *BufferedRecorder) GetEventsForTesting() []common.Event

GetEventsForTesting is a method that simply returns the unxpected events field. To be used only for testing purposes

func (*BufferedRecorder) GetStartTime

func (r *BufferedRecorder) GetStartTime() int64

GetStartTime returns the start of the recording, in unix time

func (*BufferedRecorder) Output

func (r *BufferedRecorder) Output(dst write.TerminalWriter)

Output writes the recorded events to the provided TerminalWriter

type Recorder

type Recorder interface {
	AddEvent(common.EventType, string, time.Time)
	GetEventCount() int
	GetDurationInSeconds() float64
	GetStartTime() int64
	Output(write.TerminalWriter)
}

Recorder is an interface for tracking I/O events

type StreamingRecorder

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

StreamingRecorder controls writes to a TerminalWriter. Events are added to the recorder as they are received. It is expected to be paried with a TerminalWriter that will keep the stream open

func NewStreamingRecorder

func NewStreamingRecorder(writer write.TerminalWriter, clock clockwork.Clock, shell string) StreamingRecorder

NewStreamingRecorder makes a new StreamingRecorder. The provided terminal writer should allow for an open session (see StreamingFileWriter)

Parameter Notes: clock: use clockwork.NewRealClock() unless you are testing shell: Passed along in metadata

Note: start time is set to now. Unfortunately, this cannot be made lazy, due to a shell prompt coming up immediately

func (*StreamingRecorder) AddEvent

func (r *StreamingRecorder) AddEvent(eType common.EventType, data string, evtTime time.Time)

AddEvent adds an event to the stream with an arbitrary timestamp

func (*StreamingRecorder) GetDurationInSeconds

func (r *StreamingRecorder) GetDurationInSeconds() float64

GetDurationInSeconds returns the elapsed time from the start of the stream

func (*StreamingRecorder) GetEventCount

func (r *StreamingRecorder) GetEventCount() int

GetEventCount returns -1, as we don't know how many events we have, or will, process.

func (*StreamingRecorder) GetStartTime

func (r *StreamingRecorder) GetStartTime() int64

GetStartTime returns the unix time that represents the start of this stream

func (*StreamingRecorder) Output

func (r *StreamingRecorder) Output(_ write.TerminalWriter)

Output writes the footer to the StreamingRecorder's TerminalWriter (and ignores the passed parameter)

Jump to

Keyboard shortcuts

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