Documentation
¶
Overview ¶
Package syncer is the seam between the mirror and the work that needs git and a disk. The mirror owns it. gitsyncer runs the git binary over a cache of clones, and fakesyncer keeps a commit graph in memory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PlanChunks ¶
PlanChunks splits n commits into pushes. It returns the index of the last commit of each push, in order. fits(from, to) says whether the objects of commit to that commit from does not reach (from -1 means none) fit in one push. A commit that does not fit alone is still a push of its own.
Types ¶
type CacheState ¶
type LocalError ¶
type LocalError struct{ Err error }
func (*LocalError) Error ¶
func (e *LocalError) Error() string
func (*LocalError) Unwrap ¶
func (e *LocalError) Unwrap() error
type PushRequest ¶
PushRequest asks for the push of the specs from the clone of Repo to Remote. The clone gets the commits of the specs from Source when it lacks them.
type PushSourceRequest ¶
type PushSourceRequest struct {
Repo string
Target Endpoint
Origin Endpoint
Specs []gitremote.PushSpec
}
PushSourceRequest asks for the push of the specs from the clone of Repo to Target. A commit that the clone lacks comes from Origin, by the ref of its spec. A delete needs no Origin.
type Result ¶
Result is the result of one spec of a Push. Err is set when the spec was not pushed: a *SourceError for a commit that could not be fetched, or the failure of the call that the spec shared with the others. Every spec of a call has a Result.
type SeedLimits ¶
type SeedPlanRequest ¶
type SeedPlanRequest struct {
Repo string
Remote Endpoint
Patterns []string
TargetRefs map[string]string
Limits SeedLimits
}
SeedPlanRequest asks for the pushes that copy the refs of Remote that Patterns match into a store whose refs are TargetRefs (stored name to commit).
type Source ¶
Source is where the commits come from. Cred is called only when a fetch is needed, so a push of deletes mints no credential.
type SourceError ¶
SourceError is a failure to get commits from the source. Transport is true when the network or the source failed, and false when the clone did.
func (*SourceError) Error ¶
func (e *SourceError) Error() string
func (*SourceError) Unwrap ¶
func (e *SourceError) Unwrap() error
type Syncer ¶
type Syncer interface {
Push(ctx context.Context, req PushRequest) (map[string]Result, error)
PushSource(ctx context.Context, req PushSourceRequest) (map[string]gitremote.Outcome, error)
SeedPlan(ctx context.Context, req SeedPlanRequest) ([]SeedPush, error)
Trim(ctx context.Context) (CacheState, error)
}
Syncer does the work that needs git and a disk. Each call needs nothing from an earlier call, and no call names a path: the clone of a repository is private to the implementation.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fakesyncer is a syncer.Syncer over an in-memory commit graph.
|
Package fakesyncer is a syncer.Syncer over an in-memory commit graph. |
|
Package gitsyncer is the syncer.Syncer that runs the git binary over a cache of bare clones on the local disk.
|
Package gitsyncer is the syncer.Syncer that runs the git binary over a cache of bare clones on the local disk. |
|
Package syncertest is the conformance suite of syncer.Syncer.
|
Package syncertest is the conformance suite of syncer.Syncer. |