datafile

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package datafile provides a public API for external tools that need to read and write Netsy .netsy data files.

This package intentionally exposes plain Go types instead of generated protobuf types. Netsy internals should continue to use internal/datafile

Record byte slices are not defensively copied. Callers must not mutate them concurrently with read or write operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteChunk

func WriteChunk(w io.Writer, records []*Record, leaderID string) error

WriteChunk writes records as a Netsy chunk file.

func WriteSnapshot

func WriteSnapshot(w io.Writer, records []*Record, leaderID string) error

WriteSnapshot writes records as an uncompressed Netsy snapshot file.

Types

type Record

type Record struct {
	Revision       int64
	Key            []byte
	Created        bool
	Deleted        bool
	CreateRevision int64
	PrevRevision   int64
	Version        int64
	Lease          int64
	Dek            int64
	Value          []byte
	CreatedAt      *time.Time
	CompactedAt    *time.Time
	LeaderID       string
	ReplicatedAt   *time.Time
}

Record is a Netsy key-value record stored in a .netsy data file.

func ReadChunk

func ReadChunk(r io.Reader) ([]*Record, error)

ReadChunk reads and validates a Netsy chunk file.

func ReadSnapshot

func ReadSnapshot(r io.Reader) ([]*Record, error)

ReadSnapshot reads and validates a Netsy snapshot file.

Jump to

Keyboard shortcuts

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