Documentation
¶
Overview ¶
Package lockfile owns skeeper.lock encoding, validation, and digesting.
Index ¶
- Constants
- func CanonicalSidecarURL(value string) string
- func Marshal(lock Lock) ([]byte, error)
- func Validate(lock Lock) error
- type DigestResult
- type JSONStore
- func (s *JSONStore) Digest(ctx context.Context, sidecarDir string, namespace config.Namespace, ...) (NamespaceDigest, error)
- func (s *JSONStore) DigestResult(ctx context.Context, sidecarDir string, namespace config.Namespace, ...) (DigestResult, error)
- func (s *JSONStore) Load(root reconcile.RepoRoot) (Lock, error)
- func (s *JSONStore) RegenerateForMerge(_ context.Context, root reconcile.RepoRoot) (Lock, error)
- func (s *JSONStore) Write(root reconcile.RepoRoot, lock Lock) error
- type Lock
- type NamespaceDigest
- type NamespaceRecord
- type Store
Constants ¶
const ( // Filename is the committed root lockfile path. Filename = "skeeper.lock" // Version is the current lockfile schema version. Version = 1 )
Variables ¶
This section is empty.
Functions ¶
func CanonicalSidecarURL ¶
CanonicalSidecarURL canonicalizes sidecar URLs for lock comparison.
Types ¶
type DigestResult ¶
type DigestResult struct {
Digest NamespaceDigest
Files int
Bytes int64
}
DigestResult describes a namespace digest and its scale.
func DigestWorkingTree ¶
DigestWorkingTree calculates a digest from main-repo file contents.
type JSONStore ¶
type JSONStore struct {
// contains filtered or unexported fields
}
JSONStore is the production lockfile store.
func (*JSONStore) Digest ¶
func (s *JSONStore) Digest( ctx context.Context, sidecarDir string, namespace config.Namespace, ref reconcile.SidecarRef, ) (NamespaceDigest, error)
Digest calculates a namespace tree digest at ref.
func (*JSONStore) DigestResult ¶
func (s *JSONStore) DigestResult( ctx context.Context, sidecarDir string, namespace config.Namespace, ref reconcile.SidecarRef, ) (DigestResult, error)
DigestResult calculates a namespace tree digest and scale at ref.
func (*JSONStore) RegenerateForMerge ¶
RegenerateForMerge reloads the canonical lock after the merge driver updated it.
type Lock ¶
type Lock struct {
Version int `json:"version"`
Sidecar string `json:"sidecar"`
SourceBranch string `json:"source_branch"`
Namespaces []NamespaceRecord `json:"namespaces"`
}
Lock is the canonical JSON lockfile committed to the main repository.
type NamespaceDigest ¶
type NamespaceDigest string
NamespaceDigest is a deterministic digest for one namespace tree.
type NamespaceRecord ¶
type NamespaceRecord struct {
Name string `json:"name"`
SidecarBranch string `json:"sidecar_branch"`
Commit string `json:"commit"`
Digest NamespaceDigest `json:"digest"`
Files int `json:"files"`
Bytes int64 `json:"bytes"`
}
NamespaceRecord points one namespace to the sidecar commit it expects.
type Store ¶
type Store interface {
Load(root reconcile.RepoRoot) (Lock, error)
Write(root reconcile.RepoRoot, lock Lock) error
Digest(
ctx context.Context,
sidecarDir string,
namespace config.Namespace,
ref reconcile.SidecarRef,
) (NamespaceDigest, error)
RegenerateForMerge(ctx context.Context, root reconcile.RepoRoot) (Lock, error)
}
Store owns lockfile persistence and sidecar digests.