Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConflict = errors.New("change conflict")
ErrConflict is returned by a Pusher when one of the changes fails to apply cleanly on top of the current tip of the target branch. Callers should treat conflicts as user-caused and non-retryable.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// QueueName identifies the queue this Pusher serves.
QueueName string
}
Config carries the per-queue identity handed to a Factory. The system knows only the queue name; everything an implementation needs (checkout, remote, target) is injected at construction by the integrator.
type Factory ¶
type Factory interface {
// For returns the Pusher for the given queue.
For(cfg Config) (Pusher, error)
}
Factory builds the Pusher for a queue. Implementations are provided by integrators (and tests) and inject whatever they need at construction.
type Pusher ¶
type Pusher interface {
// Push resolves and applies the changes of the given batches, in order,
// onto the target branch and pushes the resulting commits. The batch list
// designs for a merge-train (land several ready batches in one atomic push);
// today merge passes a single batch. See the type-level docs for the
// atomicity contract.
Push(ctx context.Context, batches []entity.Batch) (entity.PushResult, error)
}
Pusher applies the changes of one or more batches on top of a target branch and pushes the result to the source-control remote. Each implementation is bound to a specific (checkout, remote, target) at construction time and resolves each batch's changes itself through an injected changeset resolver.
Atomicity contract: when Push returns a non-nil error, NO change has been pushed to the remote — neither partially nor fully. Implementations must either roll back any local state or arrange for the push to never happen when any change fails to apply. Callers can treat a non-nil error as "the remote is exactly as it was before the call".
On success, len(entity.PushResult.Batches) == len(batches) and Batches[i] describes what happened to batches[i], with one entity.ChangeOutcome per change in that batch in apply order. A change can produce multiple commits (entity.OutcomeStatusCommitted, CommitSHAs populated in apply order) or none at all (entity.OutcomeStatusAlreadyExisted, CommitSHAs empty) — the latter happens when the change's content is already present on the target branch.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fake provides a pusher.Pusher whose outcome is driven by the input changes.
|
Package fake provides a pusher.Pusher whose outcome is driven by the input changes. |
|
Package git is a simple Pusher implementation backed by a local git checkout.
|
Package git is a simple Pusher implementation backed by a local git checkout. |
|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |