Help us shape the future of Go! Take the 2026 Go Developer Survey

persistence

package
v0.60.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package persistence is a generated GoMock package.

Package persistence defines the Store abstraction used to save and load ApplicationGraphResponse artifacts. Concrete backends (git, graphdb, ...) live in sub-packages.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("persistence: not found")

ErrNotFound is returned by Store.Load when no graph exists for the key.

Functions

This section is empty.

Types

type Key

type Key struct {
	// Namespace groups related graphs (e.g. a branch prefix or DB collection).
	Namespace string

	// Name identifies the graph within the namespace.
	Name string
}

Key identifies a persisted graph within a Store.

The meaning of the fields is backend-specific:

  • For the git backend, Namespace maps to a branch prefix and Name to the file path inside the branch.
  • For a future graph DB backend, these fields map to database/collection identifiers.

type MockStore

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

MockStore is a mock of Store interface.

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance.

func (*MockStore) Delete

func (m *MockStore) Delete(ctx context.Context, key Key) error

Delete mocks base method.

func (*MockStore) EXPECT

func (m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStore) List

func (m *MockStore) List(ctx context.Context, namespace string) ([]Key, error)

List mocks base method.

func (*MockStore) Load

Load mocks base method.

func (*MockStore) Save

Save mocks base method.

type MockStoreDeleteCall

type MockStoreDeleteCall struct {
	*gomock.Call
}

MockStoreDeleteCall wrap *gomock.Call

func (*MockStoreDeleteCall) Do

Do rewrite *gomock.Call.Do

func (*MockStoreDeleteCall) DoAndReturn

func (c *MockStoreDeleteCall) DoAndReturn(f func(context.Context, Key) error) *MockStoreDeleteCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockStoreDeleteCall) Return

Return rewrite *gomock.Call.Return

type MockStoreListCall

type MockStoreListCall struct {
	*gomock.Call
}

MockStoreListCall wrap *gomock.Call

func (*MockStoreListCall) Do

Do rewrite *gomock.Call.Do

func (*MockStoreListCall) DoAndReturn

func (c *MockStoreListCall) DoAndReturn(f func(context.Context, string) ([]Key, error)) *MockStoreListCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockStoreListCall) Return

func (c *MockStoreListCall) Return(arg0 []Key, arg1 error) *MockStoreListCall

Return rewrite *gomock.Call.Return

type MockStoreLoadCall

type MockStoreLoadCall struct {
	*gomock.Call
}

MockStoreLoadCall wrap *gomock.Call

func (*MockStoreLoadCall) Do

Do rewrite *gomock.Call.Do

func (*MockStoreLoadCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockStoreLoadCall) Return

Return rewrite *gomock.Call.Return

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore.

func (*MockStoreMockRecorder) Delete

func (mr *MockStoreMockRecorder) Delete(ctx, key any) *MockStoreDeleteCall

Delete indicates an expected call of Delete.

func (*MockStoreMockRecorder) List

func (mr *MockStoreMockRecorder) List(ctx, namespace any) *MockStoreListCall

List indicates an expected call of List.

func (*MockStoreMockRecorder) Load

func (mr *MockStoreMockRecorder) Load(ctx, key any) *MockStoreLoadCall

Load indicates an expected call of Load.

func (*MockStoreMockRecorder) Save

func (mr *MockStoreMockRecorder) Save(ctx, key, graph, opts any) *MockStoreSaveCall

Save indicates an expected call of Save.

type MockStoreSaveCall

type MockStoreSaveCall struct {
	*gomock.Call
}

MockStoreSaveCall wrap *gomock.Call

func (*MockStoreSaveCall) Do

Do rewrite *gomock.Call.Do

func (*MockStoreSaveCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockStoreSaveCall) Return

func (c *MockStoreSaveCall) Return(arg0 error) *MockStoreSaveCall

Return rewrite *gomock.Call.Return

type SaveOptions

type SaveOptions struct {
	// Message is a human-readable description of the change (e.g. git commit
	// message).
	Message string

	// Labels are free-form key/value pairs attached to the saved graph.
	Labels map[string]string
}

SaveOptions contains optional metadata applied during Save.

type Store

type Store interface {
	// Save persists graph under key. Implementations should be idempotent
	// for identical (key, graph) pairs.
	Save(ctx context.Context, key Key, graph *corerpv20250801preview.ApplicationGraphResponse, opts SaveOptions) error

	// Load returns the graph previously stored under key, or ErrNotFound.
	Load(ctx context.Context, key Key) (*corerpv20250801preview.ApplicationGraphResponse, error)

	// List returns keys whose Namespace matches the supplied value. An empty
	// namespace lists all keys.
	List(ctx context.Context, namespace string) ([]Key, error)

	// Delete removes the graph stored under key. Deleting a missing key
	// must return ErrNotFound.
	Delete(ctx context.Context, key Key) error
}

Store persists ApplicationGraphResponse artifacts.

Implementations must be safe for concurrent use by multiple goroutines.

Directories

Path Synopsis
Package git provides a persistence.Store backed by a durable state archive.
Package git provides a persistence.Store backed by a durable state archive.
Package graphdb is a placeholder for a future persistence.Store implementation backed by a graph database (e.g.
Package graphdb is a placeholder for a future persistence.Store implementation backed by a graph database (e.g.

Jump to

Keyboard shortcuts

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