Documentation ¶
Index ¶
- Variables
- func HashProfile(processID format.UUID, profileType string, timeRange TimeRange) format.Hash
- type Compression
- type LogReader
- type LogRecordReader
- type LogRecordWriter
- type LogWriter
- type Record
- type RecordBatch
- func (b *RecordBatch) CompressedSize() int64
- func (b *RecordBatch) Compression() Compression
- func (b *RecordBatch) FirstOffset() int64
- func (b *RecordBatch) FirstTimestamp() time.Time
- func (b *RecordBatch) LastTimestamp() time.Time
- func (b *RecordBatch) NextOffset() int64
- func (b *RecordBatch) NumRecords() int
- func (b *RecordBatch) Read(records []Record) (int, error)
- func (b *RecordBatch) Reset(startTime time.Time, buf []byte, reader io.Reader)
- func (b *RecordBatch) UncompressedSize() int64
- type RecordBatchBuilder
- type RecordBuilder
- func (b *RecordBuilder) Bytes() []byte
- func (b *RecordBuilder) Reset(startTime time.Time)
- func (b *RecordBuilder) SetFunctionCall(functionCall []byte)
- func (b *RecordBuilder) SetFunctionID(id int)
- func (b *RecordBuilder) SetTimestamp(t time.Time)
- func (b *RecordBuilder) Write(w io.Writer) (int, error)
- type Registry
- func (reg *Registry) CreateConfig(ctx context.Context, config *format.Config, tags ...object.Tag) (*format.Descriptor, error)
- func (reg *Registry) CreateLogManifest(ctx context.Context, processID format.UUID, manifest *format.Manifest) error
- func (reg *Registry) CreateLogSegment(ctx context.Context, processID format.UUID, segmentNumber int) (io.WriteCloser, error)
- func (reg *Registry) CreateModule(ctx context.Context, module *format.Module, tags ...object.Tag) (*format.Descriptor, error)
- func (reg *Registry) CreateProcess(ctx context.Context, process *format.Process, tags ...object.Tag) (*format.Descriptor, error)
- func (reg *Registry) CreateProfile(ctx context.Context, processID format.UUID, profileType string, ...) (*format.Descriptor, error)
- func (reg *Registry) CreateRuntime(ctx context.Context, runtime *format.Runtime, tags ...object.Tag) (*format.Descriptor, error)
- func (reg *Registry) ListConfigs(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]
- func (reg *Registry) ListLogManifests(ctx context.Context) stream.ReadCloser[*format.Manifest]
- func (reg *Registry) ListLogSegments(ctx context.Context, processID format.UUID) stream.ReadCloser[format.LogSegment]
- func (reg *Registry) ListModules(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]
- func (reg *Registry) ListProcesses(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]
- func (reg *Registry) ListRecords(ctx context.Context, processID format.UUID, timeRange TimeRange) stream.ReadCloser[Record]
- func (reg *Registry) ListResources(ctx context.Context, mediaType format.MediaType, timeRange TimeRange, ...) stream.ReadCloser[*format.Descriptor]
- func (reg *Registry) ListRuntimes(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]
- func (reg *Registry) LookupConfig(ctx context.Context, hash format.Hash) (*format.Config, error)
- func (reg *Registry) LookupDescriptor(ctx context.Context, hash format.Hash) (*format.Descriptor, error)
- func (reg *Registry) LookupLogManifest(ctx context.Context, processID format.UUID) (*format.Manifest, error)
- func (reg *Registry) LookupModule(ctx context.Context, hash format.Hash) (*format.Module, error)
- func (reg *Registry) LookupProcess(ctx context.Context, hash format.Hash) (*format.Process, error)
- func (reg *Registry) LookupProfile(ctx context.Context, hash format.Hash) (*profile.Profile, error)
- func (reg *Registry) LookupRecord(ctx context.Context, process *format.Manifest, offset int64) (Record, error)
- func (reg *Registry) LookupResource(ctx context.Context, hash format.Hash) (io.ReadSeekCloser, error)
- func (reg *Registry) LookupRuntime(ctx context.Context, hash format.Hash) (*format.Runtime, error)
- func (reg *Registry) ReadLogSegment(ctx context.Context, processID format.UUID, segmentNumber int) (io.ReadSeekCloser, error)
- type TimeRange
Constants ¶
This section is empty.
Variables ¶
var ErrNoLogRecords = errors.New("process has no records")
ErrNoRecords is an error returned when no log records could be found for a given process id.
Functions ¶
Types ¶
type Compression ¶
type Compression = types.Compression
const ( Uncompressed Compression = types.Compressionuncompressed Snappy Compression = types.Compressionsnappy Zstd Compression = types.Compressionzstd )
type LogReader ¶
type LogReader struct {
// contains filtered or unexported fields
}
LogReader instances allow programs to read the content of a record log.
func NewLogReader ¶
func NewLogReader(input io.ReadSeeker, manifest *format.Manifest) *LogReader
NewLogReader construct a new log reader consuming input from the given io.Reader.
func (*LogReader) ReadRecordBatch ¶
func (r *LogReader) ReadRecordBatch() (*RecordBatch, error)
ReadRecordBatch reads the next record batch.
The RecordBatch is only valid until the next call to ReadRecordBatch or Seek.
type LogRecordReader ¶
type LogRecordReader struct {
// contains filtered or unexported fields
}
LogRecordReader wraps a LogReader to help with reading individual records in order.
The reader exposes an iterator like interface. Callers should call Next to determine whether another record is available. If so, it can be retrieved via the Record method.
func NewLogRecordReader ¶
func NewLogRecordReader(r *LogReader) *LogRecordReader
NewLogRecordReader creates a log record iterator.
type LogRecordWriter ¶
type LogRecordWriter struct { *LogWriter // contains filtered or unexported fields }
LogRecordWriter wraps a LogWriter to help with write batching.
A WriteRecord method is added that buffers records in a batch up to a configurable size before flushing the batch to the log.
func NewLogRecordWriter ¶
func NewLogRecordWriter(w *LogWriter, batchSize int, compression Compression) *LogRecordWriter
NewLogRecordWriter creates a LogRecordWriter.
func (*LogRecordWriter) Flush ¶
func (w *LogRecordWriter) Flush() error
Flush flushes the pending batch.
func (*LogRecordWriter) WriteRecord ¶
func (w *LogRecordWriter) WriteRecord(record *RecordBuilder) error
WriteRecord buffers a Record in a batch and then flushes the batch once it reaches the configured maximum size.
The record is consumed immediately and can be reused safely when the call returns.
type LogWriter ¶
type LogWriter struct {
// contains filtered or unexported fields
}
LogWriter supports writing log segments to an io.Writer.
func NewLogWriter ¶
NewLogWriter constructs a new log writer which produces output to the given io.Writer.
func (*LogWriter) Reset ¶
Reset resets the state of the log writer to produce to output to the given io.Writer.
func (*LogWriter) WriteRecordBatch ¶
func (w *LogWriter) WriteRecordBatch(batch *RecordBatchBuilder) error
WriteRecordBatch writes a record batch to the log. The method returns a non-nil error if the write failed.
If the error occurred while writing to the underlying io.Writer, the writer is broken and will always error on future calls to WriteRecordBatch until the program calls Reset.
type RecordBatch ¶
type RecordBatch struct {
// contains filtered or unexported fields
}
RecordBatch is a read-only batch of records read from a log segment.
The records themselves are compressed and stored separately. To support use cases where the user may want to read batch metadata in order to skip the processing of records, the record batch is structured such that records are read and decompressed lazily.
func (*RecordBatch) CompressedSize ¶
func (b *RecordBatch) CompressedSize() int64
CompressedSize returns the size of the record batch data section in the log segment.
func (*RecordBatch) Compression ¶
func (b *RecordBatch) Compression() Compression
Compression returns the compression algorithm used to encode the record batch data section.
func (*RecordBatch) FirstOffset ¶
func (b *RecordBatch) FirstOffset() int64
FirstOffset returns the logical offset of the first record in the batch.
func (*RecordBatch) FirstTimestamp ¶
func (b *RecordBatch) FirstTimestamp() time.Time
FirstTimestamp returns the time of the first record in the batch.
func (*RecordBatch) LastTimestamp ¶
func (b *RecordBatch) LastTimestamp() time.Time
LastTimestamp returns the time of the last record in the batch.
func (*RecordBatch) NextOffset ¶
func (b *RecordBatch) NextOffset() int64
NextOffset returns the offset of the first record after this batch.
func (*RecordBatch) NumRecords ¶
func (b *RecordBatch) NumRecords() int
NumRecords returns the number of records in the batch.
func (*RecordBatch) Read ¶
func (b *RecordBatch) Read(records []Record) (int, error)
Read reads records from the batch.
The record values share memory buffers with the record batch, they remain valid until the next call to ReadRecordBatch on the parent LogReader.
func (*RecordBatch) UncompressedSize ¶
func (b *RecordBatch) UncompressedSize() int64
UncompressedSize returns the size of the record batch data section after being uncompressed.
type RecordBatchBuilder ¶
type RecordBatchBuilder struct {
// contains filtered or unexported fields
}
RecordBatchBuilder is a builder for record batches.
func (*RecordBatchBuilder) AddRecord ¶
func (b *RecordBatchBuilder) AddRecord(record *RecordBuilder)
AddRecord adds a record to the batch.
The record is consumed immediately and can be reused safely when the call returns.
func (*RecordBatchBuilder) Bytes ¶
func (b *RecordBatchBuilder) Bytes() []byte
Bytes returns the serialized representation of the record batch.
Since the batch is made up of two components – the batch metadata and then the compressed records – additional buffering is required here to merge the two together. If efficiency is required, Write should be used instead.
func (*RecordBatchBuilder) Reset ¶
func (b *RecordBatchBuilder) Reset(compression Compression, firstOffset int64)
Reset resets the builder.
type RecordBuilder ¶
type RecordBuilder struct {
// contains filtered or unexported fields
}
RecordBuilder is a builder for records.
func (*RecordBuilder) Bytes ¶
func (b *RecordBuilder) Bytes() []byte
Bytes returns the serialized representation of the record.
func (*RecordBuilder) Reset ¶
func (b *RecordBuilder) Reset(startTime time.Time)
Reset resets the builder.
func (*RecordBuilder) SetFunctionCall ¶
func (b *RecordBuilder) SetFunctionCall(functionCall []byte)
SetFunctionCall sets the function call.
The provided slice is retained until Bytes() is called and the record is serialized.
func (*RecordBuilder) SetFunctionID ¶
func (b *RecordBuilder) SetFunctionID(id int)
SetFunctionID sets the function ID.
func (*RecordBuilder) SetTimestamp ¶
func (b *RecordBuilder) SetTimestamp(t time.Time)
SetTimestamp sets the timestamp.
type Registry ¶
type Registry struct { // The object store that the registry uses to load and store data. Store object.Store // List of tags that are added to every object created by this registry. CreateTags []object.Tag // List of tags that are added to every query selecting objects from this // registry. SelectTags []object.Tag }
func (*Registry) CreateConfig ¶
func (*Registry) CreateLogManifest ¶
func (*Registry) CreateLogSegment ¶
func (*Registry) CreateModule ¶
func (*Registry) CreateProcess ¶
func (*Registry) CreateProfile ¶
func (*Registry) CreateRuntime ¶
func (*Registry) ListConfigs ¶
func (reg *Registry) ListConfigs(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]
func (*Registry) ListLogManifests ¶
func (*Registry) ListLogSegments ¶
func (reg *Registry) ListLogSegments(ctx context.Context, processID format.UUID) stream.ReadCloser[format.LogSegment]
func (*Registry) ListModules ¶
func (reg *Registry) ListModules(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]
func (*Registry) ListProcesses ¶
func (reg *Registry) ListProcesses(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]
func (*Registry) ListRecords ¶
func (*Registry) ListResources ¶
func (*Registry) ListRuntimes ¶
func (reg *Registry) ListRuntimes(ctx context.Context, timeRange TimeRange, tags ...object.Tag) stream.ReadCloser[*format.Descriptor]