Documentation
¶
Index ¶
- Variables
- func GitURLToValidPath(gitURL string) string
- func IncrementPath(ctx context.Context, store Store, pathPrefix string) (string, error)
- type FSStateStore
- func (f *FSStateStore) ActualDependencyPaths(ctx context.Context, ref string, dependency string) (string, string)
- func (f *FSStateStore) ActualPath(ref string) (string, error)
- func (f *FSStateStore) AddDependency(ctx context.Context, ref string, dependency string) error
- func (f *FSStateStore) Close() error
- func (f *FSStateStore) CommitTransaction(ctx context.Context) error
- func (f *FSStateStore) Delete(ctx context.Context, ref string) error
- func (f *FSStateStore) Get(ctx context.Context, ref string, v any) error
- func (f *FSStateStore) GetDependants(ctx context.Context, ref string) ([]string, error)
- func (f *FSStateStore) GetDependencies(ctx context.Context, ref string) ([]string, error)
- func (f *FSStateStore) GetLinks(ctx context.Context, ref string) ([]string, error)
- func (f *FSStateStore) Link(ctx context.Context, ref string, target string) error
- func (f *FSStateStore) Match(ctx context.Context, glob ...string) ([]string, error)
- func (f *FSStateStore) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
- func (f *FSStateStore) RemoveDependency(ctx context.Context, ref string, dependency string) error
- func (f *FSStateStore) ResolveLink(ctx context.Context, ref string) (string, error)
- func (f *FSStateStore) Set(ctx context.Context, ref string, v any) error
- func (f *FSStateStore) StartTransaction(ctx context.Context, message string) error
- func (f *FSStateStore) Unlink(ctx context.Context, ref string) error
- type GitRefStore
- func (g *GitRefStore) AddDependency(ctx context.Context, ref string, dependency string) error
- func (g *GitRefStore) AddSupportFiles(ctx context.Context, files map[string]string) error
- func (g *GitRefStore) Close() error
- func (g *GitRefStore) CommitTransaction(ctx context.Context) error
- func (g *GitRefStore) Delete(ctx context.Context, ref string) error
- func (g *GitRefStore) Get(ctx context.Context, ref string, v any) error
- func (g *GitRefStore) GetDependants(ctx context.Context, ref string) ([]string, error)
- func (g *GitRefStore) GetDependencies(ctx context.Context, ref string) ([]string, error)
- func (g *GitRefStore) GetLinks(ctx context.Context, ref string) ([]string, error)
- func (g *GitRefStore) Link(ctx context.Context, ref string, target string) error
- func (g *GitRefStore) Match(ctx context.Context, glob ...string) ([]string, error)
- func (g *GitRefStore) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
- func (g *GitRefStore) RemoveDependency(ctx context.Context, ref string, dependency string) error
- func (g *GitRefStore) ResolveLink(ctx context.Context, ref string) (string, error)
- func (g *GitRefStore) Set(ctx context.Context, ref string, v any) error
- func (g *GitRefStore) StartTransaction(ctx context.Context, message string) error
- func (g *GitRefStore) Unlink(ctx context.Context, ref string) error
- type GitRefStoreConfig
- type GitRepo
- type GitRepoConfig
- type GitRepoWrapper
- type GitRepoWrapperWithOtel
- type GitSupportFileWriter
- type MatchOptions
- type PathResolver
- type ReadOnlyStore
- func (r *ReadOnlyStore) AddDependency(ctx context.Context, ref string, dependency string) error
- func (r *ReadOnlyStore) Close() error
- func (r *ReadOnlyStore) CommitTransaction(ctx context.Context) error
- func (r *ReadOnlyStore) Delete(ctx context.Context, ref string) error
- func (r *ReadOnlyStore) Get(ctx context.Context, ref string, v any) error
- func (r *ReadOnlyStore) GetDependants(ctx context.Context, ref string) ([]string, error)
- func (r *ReadOnlyStore) GetDependencies(ctx context.Context, ref string) ([]string, error)
- func (r *ReadOnlyStore) GetLinks(ctx context.Context, ref string) ([]string, error)
- func (r *ReadOnlyStore) Link(ctx context.Context, ref string, target string) error
- func (r *ReadOnlyStore) Match(ctx context.Context, glob ...string) ([]string, error)
- func (r *ReadOnlyStore) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
- func (r *ReadOnlyStore) RemoveDependency(ctx context.Context, ref string, dependency string) error
- func (r *ReadOnlyStore) ResolveLink(ctx context.Context, ref string) (string, error)
- func (r *ReadOnlyStore) Set(ctx context.Context, ref string, v any) error
- func (r *ReadOnlyStore) StartTransaction(ctx context.Context, message string) error
- func (r *ReadOnlyStore) Unlink(ctx context.Context, ref string) error
- type StorageKind
- type StorageObject
- type Store
- type StoreInfo
- type WithOtel
- func (w *WithOtel) AddDependency(ctx context.Context, ref string, dependency string) error
- func (w *WithOtel) AddSupportFiles(ctx context.Context, files map[string]string) error
- func (w *WithOtel) Close() error
- func (w *WithOtel) CommitTransaction(ctx context.Context) error
- func (w *WithOtel) Delete(ctx context.Context, ref string) error
- func (w *WithOtel) Get(ctx context.Context, ref string, v any) error
- func (w *WithOtel) GetDependants(ctx context.Context, ref string) ([]string, error)
- func (w *WithOtel) GetDependencies(ctx context.Context, ref string) ([]string, error)
- func (w *WithOtel) GetLinks(ctx context.Context, ref string) ([]string, error)
- func (w *WithOtel) Link(ctx context.Context, ref string, target string) error
- func (w *WithOtel) Match(ctx context.Context, glob ...string) ([]string, error)
- func (w *WithOtel) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
- func (w *WithOtel) RemoveDependency(ctx context.Context, ref string, dependency string) error
- func (w *WithOtel) ResolveLink(ctx context.Context, ref string) (string, error)
- func (w *WithOtel) Set(ctx context.Context, ref string, v any) error
- func (w *WithOtel) StartTransaction(ctx context.Context, message string) error
- func (w *WithOtel) Unlink(ctx context.Context, ref string) error
Constants ¶
This section is empty.
Variables ¶
var CheckStagedFiles = os.Getenv("OCUROOT_CHECK_STAGED_FILES") != ""
CheckedStagedFiles uses `git add .` to validate that we have the correct set of staged files for each commit. Enabling this will make commits slower, but may be useful for debugging status problems.
var DEBUG_TRACES = os.Getenv("OCUROOT_DEBUG_TRACES") != ""
var ErrReadOnly = errors.New("read-only store")
var ErrRefNotFound = errors.New("ref not found")
Functions ¶
func GitURLToValidPath ¶ added in v0.3.15
Types ¶
type FSStateStore ¶
type FSStateStore struct {
BasePath string
}
func NewFSRefStore ¶
func NewFSRefStore(basePath string) (*FSStateStore, error)
func (*FSStateStore) ActualDependencyPaths ¶
func (*FSStateStore) ActualPath ¶
func (f *FSStateStore) ActualPath(ref string) (string, error)
func (*FSStateStore) AddDependency ¶
func (*FSStateStore) CommitTransaction ¶
func (f *FSStateStore) CommitTransaction(ctx context.Context) error
func (*FSStateStore) Delete ¶
func (f *FSStateStore) Delete(ctx context.Context, ref string) error
Delete implements RefStore.
func (*FSStateStore) GetDependants ¶
func (*FSStateStore) GetDependencies ¶
func (*FSStateStore) MatchOptions ¶
func (f *FSStateStore) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
func (*FSStateStore) RemoveDependency ¶
func (*FSStateStore) ResolveLink ¶
func (*FSStateStore) StartTransaction ¶
func (f *FSStateStore) StartTransaction(ctx context.Context, message string) error
type GitRefStore ¶
type GitRefStore struct {
// contains filtered or unexported fields
}
func NewGitRefStore ¶
func NewGitRefStore( baseDir string, remote string, branch string, cfg GitRefStoreConfig, ) (*GitRefStore, error)
func (*GitRefStore) AddDependency ¶
func (*GitRefStore) AddSupportFiles ¶
func (*GitRefStore) Close ¶
func (g *GitRefStore) Close() error
func (*GitRefStore) CommitTransaction ¶
func (g *GitRefStore) CommitTransaction(ctx context.Context) error
func (*GitRefStore) GetDependants ¶
func (*GitRefStore) GetDependencies ¶
func (*GitRefStore) MatchOptions ¶
func (g *GitRefStore) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
func (*GitRefStore) RemoveDependency ¶
func (*GitRefStore) ResolveLink ¶
func (*GitRefStore) StartTransaction ¶
func (g *GitRefStore) StartTransaction(ctx context.Context, message string) error
type GitRefStoreConfig ¶ added in v0.3.15
type GitRefStoreConfig struct {
GitRepoConfig
PathPrefix string
}
type GitRepo ¶
type GitRepo interface {
RepoPath() string
Branch() string
// contains filtered or unexported methods
}
func GitRepoWithOtel ¶
func NewGitRepoForRemote ¶
func NewGitRepoForRemote(baseDir, remote, branch string, cfg GitRepoConfig) (GitRepo, error)
type GitRepoConfig ¶ added in v0.3.15
type GitRepoWrapper ¶
type GitRepoWrapper struct {
// contains filtered or unexported fields
}
func (*GitRepoWrapper) Branch ¶
func (g *GitRepoWrapper) Branch() string
func (*GitRepoWrapper) RepoPath ¶
func (g *GitRepoWrapper) RepoPath() string
type GitRepoWrapperWithOtel ¶
type GitRepoWrapperWithOtel struct {
// contains filtered or unexported fields
}
func (*GitRepoWrapperWithOtel) Branch ¶
func (g *GitRepoWrapperWithOtel) Branch() string
Branch implements GitRepo.
func (*GitRepoWrapperWithOtel) RepoPath ¶
func (g *GitRepoWrapperWithOtel) RepoPath() string
RepoPath implements GitRepo.
type GitSupportFileWriter ¶
type MatchOptions ¶
type MatchOptions struct {
NoLinks bool
}
type PathResolver ¶
type ReadOnlyStore ¶
type ReadOnlyStore struct {
// contains filtered or unexported fields
}
func (*ReadOnlyStore) AddDependency ¶
AddDependency implements RefStore.
func (*ReadOnlyStore) CommitTransaction ¶
func (r *ReadOnlyStore) CommitTransaction(ctx context.Context) error
CommitTransaction implements RefStore.
func (*ReadOnlyStore) Delete ¶
func (r *ReadOnlyStore) Delete(ctx context.Context, ref string) error
Delete implements RefStore.
func (*ReadOnlyStore) GetDependants ¶
GetDependants implements RefStore.
func (*ReadOnlyStore) GetDependencies ¶
GetDependencies implements RefStore.
func (*ReadOnlyStore) MatchOptions ¶
func (r *ReadOnlyStore) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
MatchOptions implements RefStore.
func (*ReadOnlyStore) RemoveDependency ¶
RemoveDependency implements RefStore.
func (*ReadOnlyStore) ResolveLink ¶
ResolveLink implements RefStore.
func (*ReadOnlyStore) StartTransaction ¶
func (r *ReadOnlyStore) StartTransaction(ctx context.Context, message string) error
StartTransaction implements RefStore.
type StorageKind ¶
type StorageKind string
const ( StorageKindRef StorageKind = "ref" StorageKindLink StorageKind = "link" )
type StorageObject ¶
type StorageObject struct {
Kind StorageKind `json:"kind"`
BodyType string `json:"body_type,omitempty"`
CreateStack []string `json:"create_stack,omitempty"`
SetStack []string `json:"set_stack,omitempty"`
Links []string `json:"links,omitempty"`
Body json.RawMessage `json:"body"`
}
type Store ¶
type Store interface {
StartTransaction(ctx context.Context, message string) error
CommitTransaction(ctx context.Context) error
Get(ctx context.Context, ref string, v any) error
Set(ctx context.Context, ref string, v any) error
Delete(ctx context.Context, ref string) error
// Match will return all the refs matching the provided glob patterns
// See: https://en.wikipedia.org/wiki/Glob_(programming)
Match(ctx context.Context, glob ...string) ([]string, error)
MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
// Link will create a new ref that points to the target ref
Link(ctx context.Context, ref string, target string) error
Unlink(ctx context.Context, ref string) error
GetLinks(ctx context.Context, ref string) ([]string, error)
ResolveLink(ctx context.Context, ref string) (string, error)
// Dependencies track dependency relationships between refs
AddDependency(ctx context.Context, ref string, dependency string) error
RemoveDependency(ctx context.Context, ref string, dependency string) error
GetDependencies(ctx context.Context, ref string) ([]string, error)
GetDependants(ctx context.Context, ref string) ([]string, error)
Close() error
}
func ListenToStateChanges ¶
func NewReadOnlyStore ¶
func StoreWithOtel ¶
type WithOtel ¶
type WithOtel struct {
Store Store
// contains filtered or unexported fields
}
func (*WithOtel) AddDependency ¶
AddDependency implements Store.
func (*WithOtel) AddSupportFiles ¶
func (*WithOtel) CommitTransaction ¶
CommitTransaction implements Store.
func (*WithOtel) GetDependants ¶
GetDependants implements Store.
func (*WithOtel) GetDependencies ¶
GetDependencies implements Store.
func (*WithOtel) MatchOptions ¶
func (w *WithOtel) MatchOptions(ctx context.Context, options MatchOptions, glob ...string) ([]string, error)
MatchOptions implements Store.
func (*WithOtel) RemoveDependency ¶
RemoveDependency implements Store.
func (*WithOtel) ResolveLink ¶
ResolveLink implements Store.
func (*WithOtel) StartTransaction ¶
StartTransaction implements Store.