watermark

package
v0.45.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package watermark encodes a part's per-series durability watermark sidecar: the newest timestamp each series has in that part.

Both engines write it beside the part at flush and merge, and a replica refresh reads it instead of decoding the part's whole timestamp column. It is the same shape in both — the record engine's streams are signal.SeriesID too — so the codec lives here rather than twice.

Index

Constants

This section is empty.

Variables

View Source
var ErrCorrupt = errors.New("watermark: corrupt sidecar")

ErrCorrupt marks an unreadable sidecar. A reader treats it like an absent one and falls back to decoding the timestamp column.

Functions

func Encode

func Encode(dst []byte, entries []Entry) []byte

Encode serializes the entries in the caller's order: [magic][uvarint n] then per entry [u64 id.Hi][u64 id.Lo][i64 max], all big-endian, with a trailing CRC32C. Encode appends, and the checksum covers only the bytes it appended — whatever dst already held is not part of the record.

func Key

func Key(prefix string) string

Key is the backend key of a part's watermark sidecar (deleted with the part, since a part is removed by listing its prefix).

Types

type Entry

type Entry struct {
	ID  signal.SeriesID
	Max int64
}

Entry is one series' newest timestamp in a part.

func Decode

func Decode(data []byte) ([]Entry, error)

Decode parses a sidecar. It bounds-checks every field and never panics, returning ErrCorrupt on any malformed input so the caller can fall back to decoding.

Jump to

Keyboard shortcuts

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