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
- type Options
- type Store
- func (s *Store) Delete(ctx context.Context, key persistence.Key) error
- func (s *Store) List(ctx context.Context, namespace string) ([]persistence.Key, error)
- func (s *Store) Load(ctx context.Context, key persistence.Key) (*corerpv20250801preview.ApplicationGraphResponse, error)
- func (s *Store) Save(ctx context.Context, key persistence.Key, ...) error
Constants ¶
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 (*Store) List ¶
List returns keys present in the archive under namespace. An empty namespace lists every key in the archive.
func (*Store) Load ¶
func (s *Store) Load(ctx context.Context, key persistence.Key) (*corerpv20250801preview.ApplicationGraphResponse, error)
Load returns the graph previously stored under key, or persistence.ErrNotFound.
func (*Store) Save ¶
func (s *Store) Save(ctx context.Context, key persistence.Key, graph *corerpv20250801preview.ApplicationGraphResponse, opts persistence.SaveOptions) error
Save commits graph to the configured archive under constructPathForKey(key).