Package buffered_callback provides functionality to wrap around LogEntry callbacks to guarantee calling only on complete LogEntries, because the LogDog bundler produces fragmented LogEntries under normal operation, in order to meet time or buffer size requirements. The wrapped callbacks will not split otherwise contiguous LogEntries (e.g. if a bundler produces a LogEntry with multiple complete lines, that will get passed along as-is, not called once per line).
Expects: - LogEntry to be read-only, so the callback and others must take care not to
modify the LogEntry and should be able to assume that keeping the reference remains safe;
- callback to return quickly as it will block the stream until it completes.
Errors on which we panic.
GetWrappedDatagramCallback wraps a passed callback meant to be called on complete Datagrams so that it is actually called on complete Datagrams.
The wrapped callback panics if: - the passed LogEntry is not a Datagram LogEntry - it receives a complete Datagram while partial Datagrams are still buffered
GetWrappedCallback wraps a passed callback meant to be called at the ends of Text lines so that it is actually called at the end of Text lines. Does not wrap callback to guarantee being called at the end of *every* Text line.
The wrapped callback panics if: - the passed LogEntry is not a Text LogEntry - the passed LogEntry has lines in a form other than described in log.proto