luci: Index | Files

package buffered_callback

import ""

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.


Package Files

common.go datagram.go doc.go text.go


var (
    // Shared.
    InvalidStreamType = errors.New("wrong StreamType")

    // Datagram-specific.
    LostDatagramChunk = errors.New(
        "got self-contained Datagram LogEntry while buffered LogEntries exist",

    // Text-specific.
    PartialLineNotLast = errors.New("partial line not last in LogEntry")

Errors on which we panic.

func GetWrappedDatagramCallback Uses

func GetWrappedDatagramCallback(cb bundler.StreamChunkCallback) bundler.StreamChunkCallback

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

func GetWrappedTextCallback Uses

func GetWrappedTextCallback(cb bundler.StreamChunkCallback) bundler.StreamChunkCallback

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

Package buffered_callback imports 4 packages (graph) and is imported by 1 packages. Updated 2018-12-14. Refresh now. Tools for package owners.