semanticsegment

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package semanticsegment owns immutable, content-addressed ANN cache artifacts.

Index

Constants

View Source
const (
	SchemaVersion    = 1
	PayloadFileName  = "payload.bin"
	ManifestFileName = "manifest.json"
	RootFileName     = "root.json"
)

Variables

This section is empty.

Functions

func RootDescriptorSHA256

func RootDescriptorSHA256(input RootInput) (string, error)

RootDescriptorSHA256 returns the canonical root descriptor hash shared by filesystem publication and authoritative SQLite admission.

Types

type Manifest

type Manifest struct {
	SchemaVersion    int      `json:"schema_version"`
	DatabaseID       string   `json:"database_id"`
	ProfileID        string   `json:"profile_id"`
	Backend          string   `json:"backend"`
	BackendVersion   string   `json:"backend_version"`
	DistanceMetric   string   `json:"distance_metric"`
	Dimensions       int      `json:"dimensions"`
	Members          []Member `json:"members"`
	PayloadSHA256    string   `json:"payload_sha256"`
	MembersSHA256    string   `json:"members_sha256"`
	DescriptorSHA256 string   `json:"descriptor_sha256"`
}

type Member

type Member struct {
	Ordinal    uint64 `json:"ordinal"`
	ChunkID    string `json:"chunk_id"`
	Revision   int64  `json:"revision"`
	VectorHash string `json:"vector_hash"`
}

Member maps a dense, segment-local ordinal to the exact SQLite embedding revision from which the opaque payload was built.

type Root

type Root struct {
	RelativePath string
	Manifest     RootManifest
}

func OpenRoot

func OpenRoot(cacheDir, databaseID, profileID, generationID string) (Root, error)

func OpenRootManifest

func OpenRootManifest(ctx context.Context, cacheDir, databaseID, profileID, generationID string) (Root, error)

OpenRootManifest validates one immutable root descriptor without opening its referenced segment manifests or payloads.

func PublishRoot

func PublishRoot(cacheDir string, input RootInput) (Root, error)

type RootInput

type RootInput struct {
	DatabaseID, ProfileID, GenerationID string
	SnapshotRevision, PurgeEpoch        int64
	Segments                            []RootSegment
}

type RootManifest

type RootManifest struct {
	SchemaVersion    int           `json:"schema_version"`
	DatabaseID       string        `json:"database_id"`
	ProfileID        string        `json:"profile_id"`
	GenerationID     string        `json:"generation_id"`
	SnapshotRevision int64         `json:"snapshot_revision"`
	PurgeEpoch       int64         `json:"purge_epoch"`
	Segments         []RootSegment `json:"segments"`
	DescriptorSHA256 string        `json:"descriptor_sha256"`
}

type RootSegment

type RootSegment struct {
	Hash         string `json:"hash"`
	RelativePath string `json:"relative_path"`
}

type Segment

type Segment struct {
	Hash         string
	RelativePath string
	Manifest     Manifest
}

func OpenSegment

func OpenSegment(cacheDir, databaseID, profileID, hash string) (Segment, error)

func OpenSegmentManifest

func OpenSegmentManifest(ctx context.Context, cacheDir, databaseID, profileID, hash string) (Segment, error)

OpenSegmentManifest validates one immutable segment descriptor without reading its opaque payload. Payload consumers remain responsible for verifying PayloadSHA256 while reading the payload exactly once.

func PublishSegment

func PublishSegment(cacheDir string, input SegmentInput) (Segment, error)

type SegmentInput

type SegmentInput struct {
	DatabaseID, ProfileID, Backend, BackendVersion, DistanceMetric string
	Dimensions                                                     int
	Members                                                        []Member
	Payload                                                        func(io.Writer) error
}

Jump to

Keyboard shortcuts

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