Documentation
¶
Index ¶
- Constants
- Variables
- func Apply(ctx context.Context, fsmach *gotfs.Machine, ss gotfs.RW, fn gotfsvm.Function, ...) (gotfs.Root, error)
- func CheckName(name string) error
- func CloneMark(ctx context.Context, st SpaceTx, from, to string) error
- func ForEach(ctx context.Context, stx SpaceTx, span Span, fn func(string) error) (retErr error)
- func GotFS(cfg DSConfig) gotfs.Machine
- func GotVC(cfg DSConfig) gotvc.Machine[Payload]
- func History(ctx context.Context, vcmach *VCMach, s stores.RO, commRef gdat.Ref, ...) error
- func IsExists(err error) bool
- func IsNotExist(err error) bool
- func PostCommit(ctx context.Context, vcmach *VCMach, srw stores.WO, comm Commit) (gdat.Ref, error)
- func SortAnnotations(s []Annotation)
- func Sync(ctx context.Context, src, dst *MarkTx, force bool) error
- func SyncSpaces(ctx context.Context, task SyncSpacesTask) error
- func TestSpace(t *testing.T, newSpace func(t testing.TB) Space)
- func TestSync(t *testing.T, setup func(testing.TB) Space)
- func ViewCommit(ctx context.Context, stx SpaceTx, se CommitExpr, fn func(vctx *ViewCtx) error) error
- type Annotation
- type ChunkingConfig
- type Chunking_CDConfig
- type Chunking_Fixed
- type Commit
- type CommitExpr
- type CommitExpr_Exact
- type CommitExpr_Mark
- type CommitExpr_Offset
- type CommitNotes
- type CommitParams
- type DSConfig
- type ErrInvalidName
- type ErrRefIntegrity
- type FSConfig
- type FSMach
- type Info
- type MarkTx
- func (m *MarkTx) Apply(ctx context.Context, fn func(RW, gdat.Ref) (gdat.Ref, error)) error
- func (m *MarkTx) Config() DSConfig
- func (mtx *MarkTx) FSRO() gotfs.RO
- func (mtx *MarkTx) FSRW() gotfs.RW
- func (b *MarkTx) GotFS() *gotfs.Machine
- func (b *MarkTx) GotVC() *VCMach
- func (b *MarkTx) History(ctx context.Context, fn func(ref gdat.Ref, comm Commit) error) error
- func (b *MarkTx) Info() Info
- func (b *MarkTx) Load(ctx context.Context, dst *gdat.Ref) (bool, error)
- func (mt *MarkTx) LoadCommit(ctx context.Context, dst *Commit) (bool, error)
- func (b *MarkTx) LoadFS(ctx context.Context, dst *gotfs.Root) (bool, error)
- func (m *MarkTx) Modify(ctx context.Context, fn func(mctx ModifyCtx) (*Commit, error)) error
- func (mtx *MarkTx) RO() RO
- func (m *MarkTx) Save(ctx context.Context, ref gdat.Ref) error
- func (mtx *MarkTx) VCRO() stores.RO
- func (mtx *MarkTx) VCRW() stores.RW
- func (mtx *MarkTx) WO() WO
- type Metadata
- type ModifyCtx
- type Payload
- type RO
- type RW
- type Salt
- type Space
- type SpaceTx
- type Span
- type SyncSpacesTask
- type VCMach
- type ViewCtx
- type WO
Constants ¶
const MaxNameLen = 1024
Variables ¶
var ( ErrNotExist = errors.New("mark does not exist") ErrExists = errors.New("a mark already exists by that name") )
Functions ¶
func Apply ¶ added in v0.4.0
func Apply(ctx context.Context, fsmach *gotfs.Machine, ss gotfs.RW, fn gotfsvm.Function, ins []gotfs.Root) (gotfs.Root, error)
Apply applies a function to a root to create a new Root.
func ForEach ¶
ForEach is a convenience function which uses Space.List to call fn with all the mark names contained in span.
func IsNotExist ¶
func PostCommit ¶ added in v0.4.0
PostCommit write a commit to the store.
func SortAnnotations ¶
func SortAnnotations(s []Annotation)
func SyncSpaces ¶
func SyncSpaces(ctx context.Context, task SyncSpacesTask) error
func ViewCommit ¶ added in v0.4.0
func ViewCommit(ctx context.Context, stx SpaceTx, se CommitExpr, fn func(vctx *ViewCtx) error) error
ViewCommit calls fn with everything needed to read a Commitshot, its filesystem, and its ancestry.
Types ¶
type Annotation ¶
Annotation annotates a mark
func GetAnnotation ¶
func GetAnnotation(as []Annotation, key string) (ret []Annotation)
type ChunkingConfig ¶
type ChunkingConfig struct {
CD *Chunking_CDConfig `json:"cd,omitempty"`
Max *Chunking_Fixed `json:"fixed,omitempty"`
}
type Chunking_CDConfig ¶
type Chunking_Fixed ¶
type Commit ¶ added in v0.4.0
Commit is a commitment to a filesystem commit, ancestor Commits, and additional metadata.
func CreateCommit ¶ added in v0.4.0
func CreateCommit(ctx context.Context, vcmach *VCMach, srw stores.RW, copa CommitParams) (Commit, error)
CreateCommit creates a new Commit in the store.
type CommitExpr ¶ added in v0.4.0
type CommitExpr interface {
GetSpace() string
// Resolve returns a valid Ref, which points to a Commit.
// Resolve returns the zero valued Ref when a mark does not have a Ref set.
Resolve(ctx context.Context, stx SpaceTx) (gdat.Ref, error)
// contains filtered or unexported methods
}
CommitExpr is a sum type representing the different ways to refer to a Commit in Got So far, there are 2 primitive ways - Exactly by Ref - By Mark And 1 higher-order way - By an offset from the result of a previous expression
func ParseCommitExpr ¶ added in v0.4.0
func ParseCommitExpr(x string) (CommitExpr, error)
type CommitExpr_Exact ¶ added in v0.4.0
func ParseCommit_Exact ¶ added in v0.4.0
func ParseCommit_Exact(x string) (*CommitExpr_Exact, error)
func (*CommitExpr_Exact) GetSpace ¶ added in v0.4.0
func (se *CommitExpr_Exact) GetSpace() string
type CommitExpr_Mark ¶ added in v0.4.0
func ParseCommit_Mark ¶ added in v0.4.0
func ParseCommit_Mark(x string) (*CommitExpr_Mark, error)
func (CommitExpr_Mark) GetSpace ¶ added in v0.4.0
func (se CommitExpr_Mark) GetSpace() string
func (CommitExpr_Mark) String ¶ added in v0.4.0
func (se CommitExpr_Mark) String() string
type CommitExpr_Offset ¶ added in v0.4.0
type CommitExpr_Offset struct {
X CommitExpr
Offset uint
}
type CommitNotes ¶ added in v0.4.0
type CommitNotes struct {
AuthoredAt tai64.TAI64 `json:"authored_at"`
Authors []inet256.ID `json:"authors"`
Message string `json:"message"`
}
CommitNotes holds additional information about a commit. This is stored as json in the commit.
type CommitParams ¶ added in v0.4.0
type DSConfig ¶
type DSConfig struct {
// Salt is a 32-byte salt used to derive the cryptographic keys for the mark.
Salt Salt `json:"salt"`
// GotFS contains all configuration for GotFS
GotFS FSConfig `json:"fs"`
}
DSConfig holds all data structure parameters
func DefaultConfig ¶
type ErrInvalidName ¶
func (ErrInvalidName) Error ¶
func (e ErrInvalidName) Error() string
type ErrRefIntegrity ¶
func (ErrRefIntegrity) Error ¶
func (e ErrRefIntegrity) Error() string
type FSConfig ¶
type FSConfig struct {
Data ChunkingConfig `json:"data_chunking"`
Metadata Chunking_CDConfig `json:"metadata_chunking"`
}
Config contains all parameters.
type Info ¶
type Info struct {
// Config holds the all the datastructure parameters
Config DSConfig `json:"config"`
// Annotations are arbitrary metadata associated with the mark.
Annotations []Annotation `json:"annotations"`
// CreatedAt is the time the mark was created.
CreatedAt tai64.TAI64 `json:"created_at"`
}
Info is the metadata associated with a Mark.
func CreateIfNotExists ¶
func (Info) AsMetadata ¶
type MarkTx ¶
type MarkTx struct {
// contains filtered or unexported fields
}
MarkTx scopes down a SpaceTx to a single Mark.
func (*MarkTx) Apply ¶
Apply calls fn with the Marks target Ref If the mark does not yet have a target, then the ref will be 0.
func (*MarkTx) LoadCommit ¶ added in v0.4.0
type Metadata ¶
type Metadata struct {
Config DSConfig `json:"config"`
Annotations []Annotation `json:"annotations"`
}
Metadata is non-volume, user-modifiable information associated with a mark.
type Salt ¶
type Salt [32]byte
Salt is a 32-byte salt
func (Salt) MarshalText ¶
func (*Salt) UnmarshalText ¶
type Space ¶
type Space interface {
// Do calls fn to perform a transaction.
Do(ctx context.Context, modify bool, fn func(SpaceTx) error) error
}
A Space holds named gotcore.
type SpaceTx ¶
type SpaceTx interface {
// Create creates a new Mark at name in the Space.
// The mark will have md for initial metadata.
// An error is returned if the name already exists.
Create(ctx context.Context, name string, md Metadata) (*Info, error)
// Inspect returns all the info for a Mark
Inspect(ctx context.Context, name string) (*Info, error)
// SetMetadata sets the metadata for the Mark at name to md
SetMetadata(ctx context.Context, name string, md Metadata) error
// Delete deletes a Mark and all of it's metadata, the Commit is not removed.
Delete(ctx context.Context, name string) error
// All iterates over all the mark names.
All(context.Context) iter.Seq2[string, error]
// Store returns the space's underlying stores
// These can all be the same store, but each will be passed to different systems.
// 0: GotFS data stream
// 1: GotFS metadata
// 2: GotVC
Stores() RW
// SetTarget changes the mark so it points to a different commit
SetTarget(ctx context.Context, name string, ref gdat.Ref) error
// GetTarget retrieves the Commit referenced by gdat.Ref
GetTarget(ctx context.Context, name string, dst *gdat.Ref) (bool, error)
}
SpaceTx is a transaction on a Space
type SyncSpacesTask ¶
type SyncSpacesTask struct {
// Src is the space to read from.
Src Space
// Dst is the name ofthe space to write to.
Dst Space
// Filter is applied to src to determine what to copy.
// If nil, then all marks are copied.
Filter func(string) bool
// MapName is applied to go from names in the Src space, to name in the Dst space.
MapName func(string) string
}
SyncSpacesTask contains parameters needed to copy marks from one space to another.