Documentation
¶
Index ¶
- Constants
- func EditConfig(repo *os.Root, fn func(x Config) Config) error
- func Init(root *os.Root, config Config) error
- func RepoVolumeSpec(useSchema bool) blobcache.VolumeSpec
- type BlobcacheSpec
- type Config
- type DistConfig
- type Env
- type ExternalBlobcache
- type FQM
- type FetchConfig
- type InProcessBlobcache
- type MarkInfo
- type Ref
- type Repo
- func (r *Repo) BeginStagingTx(ctx context.Context, wcid WorkingCopyID, modify bool) (volumes.Tx, error)
- func (r *Repo) BlobcachePeer() blobcache.PeerID
- func (r *Repo) Cat(ctx context.Context, mark FQM, p string, w io.Writer) error
- func (r *Repo) CheckAll(ctx context.Context) error
- func (r *Repo) Cleanup(ctx context.Context) error
- func (r *Repo) CleanupMark(ctx context.Context, mark FQM) error
- func (r *Repo) CloneMark(ctx context.Context, base, next FQM) error
- func (r *Repo) Close() (retErr error)
- func (r *Repo) Config() Config
- func (r *Repo) Configure(fn func(x Config) Config) error
- func (r *Repo) ConfigureMark(ctx context.Context, fqname FQM, md marks.Metadata) error
- func (r *Repo) CreateIdentity(ctx context.Context, name string) (*inet256.ID, error)
- func (r *Repo) CreateMark(ctx context.Context, fqname FQM, mcfg marks.DSConfig, anns []marks.Annotation) (*MarkInfo, error)
- func (r *Repo) DebugFS(ctx context.Context, mark FQM, w io.Writer) error
- func (r *Repo) DebugKV(ctx context.Context, mark FQM, w io.Writer) error
- func (r *Repo) DeleteMark(ctx context.Context, fqname FQM) error
- func (r *Repo) Dir() string
- func (r *Repo) Distribute(ctx context.Context) error
- func (r *Repo) Endpoint() blobcache.Endpoint
- func (r *Repo) Fetch(ctx context.Context) error
- func (r *Repo) ForEachMark(ctx context.Context, spaceName string, fn func(string) error) error
- func (r *Repo) GCStage(ctx context.Context, wcid WorkingCopyID) (volumes.Tx, error)
- func (r *Repo) GetIdentity(ctx context.Context, name string) (*gotorg.IdentityUnit, error)
- func (r *Repo) GetMark(ctx context.Context, fqname FQM) (*marks.Mark, error)
- func (r *Repo) GetSpace(ctx context.Context, name string) (marks.Space, error)
- func (r *Repo) History(ctx context.Context, mark FQM, fn func(ref Ref, s Snap) error) error
- func (r *Repo) Identities(ctx context.Context) (map[string]gotorg.IdentityUnit, error)
- func (r *Repo) InspectMark(ctx context.Context, fqname FQM) (*marks.Info, error)
- func (r *Repo) ListSpaces(ctx context.Context) (map[string]SpaceSpec, error)
- func (r *Repo) Ls(ctx context.Context, mark FQM, p string, fn func(gotfs.DirEnt) error) error
- func (r *Repo) MarkLoad(ctx context.Context, mark FQM) (*Snap, error)
- func (r *Repo) Modify(ctx context.Context, fqm FQM, fn func(mc marks.ModifyCtx) (*Snap, error)) error
- func (r *Repo) NSVolume(ctx context.Context) (blobcache.FQOID, error)
- func (r *Repo) NSVolumeSpec(ctx context.Context) (*VolumeSpec, error)
- func (r *Repo) OrgClient(actAs string) (gotorg.Client, error)
- func (r *Repo) Serve(ctx context.Context, pc net.PacketConn) error
- func (r *Repo) Stat(ctx context.Context, mark FQM, p string) (*gotfs.Info, error)
- func (r *Repo) SyncSpaces(ctx context.Context, task SyncSpacesTask) error
- func (r *Repo) SyncUnit(ctx context.Context, src, dst FQM, force bool) error
- type Root
- type Snap
- type Space
- type SpaceSpec
- type SyncSpacesTask
- type Volume
- type VolumeSpec
- type WorkingCopyID
Constants ¶
const DefaultIden = "default"
Variables ¶
This section is empty.
Functions ¶
func EditConfig ¶
EditConfig applies fn to the config of the repo at repoPath
func Init ¶
Init initializes a new repo at the given path. If bc is nil, a local blobcache will be created within the .got directory.
func RepoVolumeSpec ¶
func RepoVolumeSpec(useSchema bool) blobcache.VolumeSpec
RepoVolumeSpec returns a Blobcache Volume spec which can be used to create a Volume suitable for a Repo.
Types ¶
type BlobcacheSpec ¶
type BlobcacheSpec struct {
// InProcess uses an in-process Blobcache service.
// The state will be stored in the .got/blobcache directory.
// This is the default.
// The state can get quite large for large datasets, so it is recommended to use the system's Blobcache.
InProcess *InProcessBlobcache `json:"in_process,omitempty"`
// Client uses the Client Blobcache service, as configured through BLOBCACHE_API
Client *ExternalBlobcache `json:"client,omitempty"`
}
BlobcacheSpec describes how to access a Blobcache Service.
type Config ¶
type Config struct {
// Blobcache configures access to a Blobcache service.
// Got stores most of it's data in Blobcache.
Blobcache BlobcacheSpec `json:"blobcache"`
// RepoVolume is the OID of the volume that stores the repo's data.
// This is different than the volume for the namespace.
// This volume will have a link to the namespace volume.
RepoVolume blobcache.OID `json:"repo_volume"`
// Identities are named identities, which refer to files in the .got/iden directory
Identities map[string]inet256.ID `json:"identities"`
// Spaces contain named mutable references to Snapshots
// They are most similar to git remotes.
Spaces map[string]SpaceSpec `json:"spaces"`
Fetch []FetchConfig `json:"fetch"`
Dist []DistConfig `json:"dist"`
}
Config contains runtime parameters for a Repo
func DefaultConfig ¶
func DefaultConfig() Config
func (*Config) AddFetch ¶
func (c *Config) AddFetch(fc FetchConfig) *Config
func (*Config) SetBlobcache ¶
func (c *Config) SetBlobcache(spec BlobcacheSpec) *Config
type DistConfig ¶
type DistConfig struct {
// Filter is a regexp for which marks to fetch from the source space.
// In the case of distribution, the is always the local space.
Filter *regexp.Regexp `json:"filter"`
// CutPrefix is the prefix to remove from the name
// The zero value does not change the name at all.
CutPrefix string `json:"cut_prefix"`
// AddPrefix is the prefix to add to the name
// before inserting into the local space.
// The zero value does not change the name at all.
AddPrefix string `json:"add_prefix"`
// To is the name of the space to write to.
To string `json:"to"`
// Delete is the regexp for which marks to delete from the destination space.
// Only names starting with AddPrefix in the destination space are considered.
// The regexp should match the entire name including the prefix.
Delete *regexp.Regexp `json:"delete"`
}
DistConfig configures a distribution task.
type Env ¶
type Env struct {
Background context.Context
Dir *os.Root
Blobcache blobcache.Service
// CloseAll causes Repo.Close to also close these resources.
CloseAll bool
}
Env is the environment that the Repo needs to function.
type ExternalBlobcache ¶
type FetchConfig ¶
type FetchConfig struct {
// From is the name of the space to pull from.
// The destination space is always assumed to be the local space.
From string `json:"from"`
// Filter is a regexp for which marks to fetch from the source space.
Filter *regexp.Regexp `json:"filter"`
// CutPrefix is the prefix to remove from the name
// The zero value does not change the name at all.
CutPrefix string `json:"cut_prefix"`
// AddPrefix is the prefix to add to the name
// before inserting into the local space.
// The zero value does not change the name at all.
AddPrefix string `json:"add_prefix"`
// Delete is the regexp for which marks to delete from the destination space.
// Only names starting with AddPrefix in the destination space are considered.
// The regexp should match the entire name including the prefix.
Delete *regexp.Regexp `json:"delete"`
}
FetchConfig configures a fetch task.
type InProcessBlobcache ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo manages configuration including the connection to Blobcache The Repo can optionally host it's own Blobcache Node. Repos also manage a namespace and multiple stages. Working Copies can be created to manipulate the contents of the stages.
func NewTestRepo ¶
func (*Repo) BeginStagingTx ¶
func (r *Repo) BeginStagingTx(ctx context.Context, wcid WorkingCopyID, modify bool) (volumes.Tx, error)
BeginStagingTx begins a new transaction for the staging area for the given WorkingCopy It is up to the caller to commit or abort the transaction.
func (*Repo) BlobcachePeer ¶
BlobcachePeer returns the PeerID used by the local Blobcache. This depends on the ActAs parameter in the Blobcache config. If the Blobcache is not local, then the zero value is returned
func (*Repo) CloneMark ¶
CloneMark creates a new branch called next and sets its head to match base's
func (*Repo) ConfigureMark ¶
ConfigureMark adjusts metadata
func (*Repo) CreateIdentity ¶
Create
func (*Repo) CreateMark ¶
func (r *Repo) CreateMark(ctx context.Context, fqname FQM, mcfg marks.DSConfig, anns []marks.Annotation) (*MarkInfo, error)
CreateBranch creates a new mark in the repo's local space.
func (*Repo) DeleteMark ¶
DeleteBranch deletes a mark The target of the mark may be garbage collected if nothing else references it.
func (*Repo) Distribute ¶
Distribute is the opposite of Fetch.
func (*Repo) ForEachMark ¶
ForEachBranch calls fn once for each branch, or until an error is returned from fn
func (*Repo) GetIdentity ¶
func (*Repo) GetSpace ¶
GetSpace looks for a space with a matching name in the configuration if it finds a match, then the spec is used to construct a space and it is returned. If name is empty, then GetSpace returns the repos default namespace.
func (*Repo) Identities ¶
func (*Repo) InspectMark ¶
func (*Repo) ListSpaces ¶
ListSpaces lists all the spaces that the repository is configured to use
func (*Repo) Modify ¶
func (r *Repo) Modify(ctx context.Context, fqm FQM, fn func(mc marks.ModifyCtx) (*Snap, error)) error
Modify calls fn to modify the target of a Mark.
func (*Repo) NSVolume ¶
NSVolume returns the FQOID of the namespace volume. This can be used to access the namespace from another Blobcache node. It does not modify the contents of the namespace volume.
func (*Repo) NSVolumeSpec ¶
func (r *Repo) NSVolumeSpec(ctx context.Context) (*VolumeSpec, error)
func (*Repo) SyncSpaces ¶
func (r *Repo) SyncSpaces(ctx context.Context, task SyncSpacesTask) error
SyncSpaces executes a SyncSpaceTask
type SpaceSpec ¶
type SpaceSpec struct {
// Blobcache is a arbitrary Blobcache Volume
// The contents of the Volume are expected to be in the GotNS format.
Blobcache *VolumeSpec `json:"bc,omitempty"`
// Org is an arbitrary Blobcache Volume
// The contents of the Volume are expected to be in the GotOrg format
Org *blobcache.URL `json:"org,omitempty"`
}
type SyncSpacesTask ¶
type SyncSpacesTask struct {
// Src is name of the space to read from.
Src string
// 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
// Dst is the name of the space to write to.
Dst string
}
SyncSpacesTask contains parameters needed to copy marks from one space to another.
type VolumeSpec ¶
type WorkingCopyID ¶
type WorkingCopyID = reposchema.StageID
func NewWorkingCopyID ¶
func NewWorkingCopyID() WorkingCopyID
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
reposchema
Package reposchema implements a Blobcache Schema for a Got Repo.
|
Package reposchema implements a Blobcache Schema for a Got Repo. |