git

package
v0.60.0-rc1 Latest Latest
Warning

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

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

Documentation

Overview

Package git provides a persistence.Store backed by a durable state archive.

It is a thin, graph-specific adapter over the shared pluggable storage backend in pkg/statearchive: it maps persistence.Key values to JSON files in the archive and delegates storage I/O to a statearchive.Archive (the git one by default). Swapping in a different statearchive.Archive (for example an OCI or filesystem implementation) requires no change here.

Key -> path layout in the archive:

<namespace>/<name>.json

Index

Constants

View Source
const (
	// DefaultGraphArchive is the default archive name for graph artifacts.
	DefaultGraphArchive = "radius-graph"

	// DefaultGraphBranch is deprecated. Use DefaultGraphArchive.
	DefaultGraphBranch = DefaultGraphArchive
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// ArchiveName is the archive used to persist graphs. If empty,
	// DefaultGraphArchive is used.
	ArchiveName string

	// Branch is deprecated. Use ArchiveName.
	Branch string

	// Archive is the durable state archive. If nil, the git implementation is
	// used. Tests may inject an alternative implementation.
	Archive statearchive.Archive
}

Options configures a Store.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a persistence.Store that persists each graph as a JSON file in a durable state archive.

Concurrency: the persistence.Store contract requires implementations to be safe for concurrent use. Serialization is delegated to the archive.

func NewStore

func NewStore(opts Options) (*Store, error)

NewStore returns an archive-backed Store. The default archive is git.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key persistence.Key) error

Delete removes the file for key and commits the deletion.

func (*Store) List

func (s *Store) List(ctx context.Context, namespace string) ([]persistence.Key, error)

List returns keys present in the archive under namespace. An empty namespace lists every key in the archive.

func (*Store) Load

Load returns the graph previously stored under key, or persistence.ErrNotFound.

func (*Store) Save

Save commits graph to the configured archive under constructPathForKey(key).

Jump to

Keyboard shortcuts

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