snapshot

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 14 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 snapshot reads registries straight from git objects and caches exported skills by tree id: a tree never changes, so each skill version is exported once, and unchanged skills cost nothing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snapshot

type Snapshot struct {
	Commit   string
	Registry *registry.Registry
	// contains filtered or unexported fields
}

Snapshot is a registry as of one commit.

func (*Snapshot) TreeID

func (s *Snapshot) TreeID(dir string) (string, bool)

TreeID returns the tree id of a directory of the snapshot.

type Store

type Store struct {
	Repo *gitx.Repo
	Dir  string
}

Store caches exported skills under Dir/<tree id>.

func (*Store) Export

func (s *Store) Export(ctx context.Context, wants []Want) ([]string, []error)

Export makes sure the wanted trees are in the cache and returns the directory holding each, or why it cannot. Missing trees are exported together (see gitx.ExportTrees). A tree rejected by the export limits is remembered and not tried again: trees never change.

func (*Store) Prune

func (s *Store) Prune(ctx context.Context, keep ...string) error

Prune removes every cached skill except keep. Each one is renamed aside before being deleted, so an interrupted prune never leaves a partial tree that would pass for a complete one. Once ctx is done, the rest is left to the next sync.

func (*Store) Registry

func (s *Store) Registry(ctx context.Context, commit string) (*Snapshot, error)

Registry loads the registry of commit without exporting it: only the metadata files are read from git.

func (*Store) Skill

func (s *Store) Skill(ctx context.Context, tree string) (string, error)

Skill returns the directory holding the files of tree, exporting it if needed.

type Want

type Want struct {
	Commit, Dir, Tree string
}

Want is a tree to have in the cache: the directory Dir of Commit, whose tree id is Tree. Without a commit, the tree is listed by id.

Jump to

Keyboard shortcuts

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