Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrSkipSegment = errors.New("skip truncated WAL segment")
)
Functions ¶
This section is empty.
Types ¶
type Tailer ¶
type Tailer struct {
// contains filtered or unexported fields
}
Tailer tails a write ahead log in a given directory.
func Tail ¶
func Tail(ctx context.Context, logger log.Logger, dir string, promMon *prometheus.Monitor) (*Tailer, error)
Tail the prometheus/tsdb write ahead log in the given directory. Checkpoints are read before reading any WAL segments. Tailing may fail if we are racing with the DB itself in deleting obsolete checkpoints and segments. The caller should implement relevant logic to retry in those cases.
func (*Tailer) CurrentSegment ¶
CurrentSegment returns the index of the currently read segment. If no successful read has been performed yet, it may be negative.
func (*Tailer) Offset ¶
Offset returns the approximate current position of the tailer in the WAL with respect to Size().
func (*Tailer) SetNextSegment ¶ added in v0.23.1
Offset is reset as in incNextSegment() as we *just* started pointing to the *current* segment.