writer

package
v110.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const EVENT_BUFFER_SIZE = 200
View Source
const READ_BUFFER_SIZE = 4 * 1024 // XXX: 4kb chosen at random

Variables

View Source
var TempDir = os.Getenv("LIVELOG_TEMP_DIR")

TempDir controls where livelog creates its temporary streaming files. It defaults to the LIVELOG_TEMP_DIR environment variable if set, otherwise the system temp dir. It is overridden in tests so they can reliably clean up.

Functions

This section is empty.

Types

type Event

type Event struct {
	Number int
	Err    error
	Bytes  []byte
	Length int64
	End    bool
	Offset int64
}

type Handles

type Handles map[*StreamHandle]struct{}

Handles represents a set of *StreamHandles

type Stream

type Stream struct {
	Path string
	// contains filtered or unexported fields
}

func NewStream

func NewStream(read io.Reader) (*Stream, error)

func (*Stream) Consume

func (stream *Stream) Consume() error

func (*Stream) GetState

func (stream *Stream) GetState() (offset int64, ended bool)

Get the state of this stream in a thread-safe fashion

func (*Stream) Observe

func (stream *Stream) Observe(start, stop int64) *StreamHandle

func (*Stream) Unobserve

func (stream *Stream) Unobserve(handle *StreamHandle)

type StreamHandle

type StreamHandle struct {
	Start int64
	Stop  int64

	// Current offset in StreamHandle.
	Offset int64
	// contains filtered or unexported fields
}

func (*StreamHandle) WriteTo

func (streamHandle *StreamHandle) WriteTo(target io.Writer) (n int64, err error)

The WriteTo method is ideal for handling the special use cases here initially we want to optimize for reuse of buffers across reads/writes in the future we can also extend this mechanism for reading from disk if events "fall behind"

Jump to

Keyboard shortcuts

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