committimestamp

package
v0.70.11 Latest Latest
Warning

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

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

Documentation

Overview

Package committimestamp decodes a blob-stored commit timestamp shared by every blob backend (badger, S3, GCS), rejecting a value that does not actually fit the int64 the rest of the codebase carries it as, rather than each backend separately risking silent truncation or wraparound.

Index

Constants

This section is empty.

Variables

View Source
var ErrOutOfRange = errors.New("commit timestamp value out of int64 range")

ErrOutOfRange means a stored timestamp value does not fit in an int64.

Functions

func DecodeLegacy

func DecodeLegacy(data []byte) (int64, error)

DecodeLegacy decodes a variable-length, big-endian byte-encoded timestamp (the pre-fixed-width encoding some backends still read for backward compatibility). big.Int.Int64() is undefined for a value that does not fit in an int64, so this rejects rather than silently truncates an oversized or corrupted stored value.

The error reports only the encoded byte length, not the value's decimal expansion: a corrupted object can be large (backends cap reads at hundreds of MiB), and formatting that many digits to decimal just to report an error would itself be an expensive, avoidable allocation.

func FromFixedWidth

func FromFixedWidth(v uint64) (int64, error)

FromFixedWidth validates a fixed-width 8-byte big-endian uint64 timestamp before narrowing it to int64. A raw int64(v) cast is undefined once v's high bit is set, silently wrapping into a negative timestamp instead of failing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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