buffered_callback

package
v0.0.0-...-35d8de9 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

View Source
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.

Functions

func GetWrappedDatagramCallback

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

func GetWrappedTextCallback(cb bundler.StreamChunkCallback) bundler.StreamChunkCallback

GetWrappedTextCallback 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

Types

This section is empty.

Jump to

Keyboard shortcuts

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