logstream

package
v0.0.0-...-6dcaeb9 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogStream

type LogStream struct {
	// contains filtered or unexported fields
}

LogStream streams log entries of the /logstream API endpoint over a websocket connection.

func Open

func Open(conn base.StreamConnector, cfg params.LogStreamConfig, controllerUUID string) (*LogStream, error)

Open opens a websocket to the API's /logstream endpoint and returns a stream of log records from that connection.

func (*LogStream) Close

func (ls *LogStream) Close() error

Close closes the stream.

func (*LogStream) Next

func (ls *LogStream) Next() ([]logfwd.Record, error)

Next returns the next batch of log records from the server. The records are converted from the wire format into logfwd.Record. The first returned record will be the one after the last successfully sent record. If no records have been sent yet then it will be the oldest log record.

An error indicates either the streaming connection is closed, the connection failed, or the data read from the connection is corrupted. In each of these cases the stream should be re-opened. It will start at the record after the one marked as successfully sent. So the the record at which Next() failed previously will be streamed again.

That is only a problem when the same record is consistently streamed as invalid data. This will happen only if the record was invalid before being stored in the DB or if the DB on-disk storage for the record becomes corrupted. Both scenarios are highly unlikely and the respective systems are managed such that neither should happen.

Jump to

Keyboard shortcuts

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