Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventResult ¶
type EventResult struct { Event *event_go_proto.Event Err error Fatal bool }
EventResult describes the result of attempting to read an event, which may have failed. Event != nil if and only if Err == nil. If Err == nil, then Fatal == false. If Fatal is true, then the event file reader is dead.
type Reader ¶
type Reader struct { // Results is an output channel for each event read from the file. If // this ever emits a fatal error, the owner should expect all future // interactions with these channels to block forever. Results <-chan EventResult // Asleep is an output channel that sees unit when the file has been // read to its end, for now. Asleep <-chan struct{} // Wake is an input channel that sees a wake action when it should stop // being asleep. Wake chan<- WakeAction }
Reader reads TFRecords from an event file and parses them as Event protos. It expects that the file that it's reading is being actively written, and as such merely dozes off at EOF rather than exiting entirely. It can be awoken by its owner later: e.g., after some amount of time has passed.
type ReaderBuilder ¶
ReaderBuilder specifies options for a Reader.
func (ReaderBuilder) Start ¶
func (b ReaderBuilder) Start() *Reader
Start starts a reader in a new goroutine. Once woken, it reads the full contents of the event file, then goes to sleep again.
type WakeAction ¶
type WakeAction int
A WakeAction tells a Reader what to do after waking up.
const ( // Resume indicates that the reader should keep reading records. Resume WakeAction = iota // Abort indicates that the reader should discard its state and exit // immediately. Abort )