Versions in this module Expand all Collapse all v0 v0.20.0 Nov 12, 2026 Changes in this version + func PGForwardsOnPush(ctx context.Context, tx pgx.Tx, repoID string) (bool, error) + func PGRequestForward(ctx context.Context, tx pgx.Tx, repoID string) (bool, error) + func ValidText(s string) bool type ListParams + Prefix string type LocalWork + func PGLaneWork(ctx context.Context, tx pgx.Tx, repoID string) (LocalWork, error) + func PGListLaneWork(ctx context.Context, tx pgx.Tx, org, after string, limit int) ([]LocalWork, error) v0.19.0 Oct 30, 2026 Changes in this version + const OmittedDefaultBranch + const ViewCheckLogEnv + func CheckFormat(ctx context.Context, b Backend) error + type CorruptDocumentError struct + Err error + func (e *CorruptDocumentError) Error() string + func (e *CorruptDocumentError) Unwrap() error type EventingStore + AdoptUpstreamDefaultBranch func(ctx context.Context, repoID, branch string) (adopted bool, err error) + type FormatVersionError struct + Got int + Want []int + func (e *FormatVersionError) Error() string type LocalScheduleStore + func LocalSchedule(ms any) (LocalScheduleStore, bool) type PG + func (s *PG) AdoptUpstreamDefaultBranch(ctx context.Context, repoID, branch string) (bool, error) + type QuarantinedError struct + Err error + func (e *QuarantinedError) Error() string + func (e *QuarantinedError) Unwrap() error type RepoUpstream + DefaultBranchOmitted bool type S3WAL + func (s *S3WAL) AdoptUpstreamDefaultBranch(ctx context.Context, repoID, branch string) (bool, error) + type S3WALConvertOptions struct + Force bool + type S3WALMetaConversion struct + After S3WALMetaCounts + Before S3WALMetaCounts + ForcedCreates []S3WALPendingCreate + From int + Missing bool + RepairedSyncCreates []string + SeqAfter int64 + SeqBefore int64 + To int + func ConvertS3WALMeta(ctx context.Context, cs s3wal.ConditionalStore, to int, ...) (S3WALMetaConversion, error) + type S3WALMetaCounts struct + Credentials int + Orgs int + Repos int + Upstreams int + Webhooks int + type S3WALPendingCreate struct + RepoID string + URL string + func (c S3WALPendingCreate) String() string + type S3WALPendingCreatesError struct + Creates []S3WALPendingCreate + func (e *S3WALPendingCreatesError) Error() string type SQLite + func (s *SQLite) AdoptUpstreamDefaultBranch(ctx context.Context, repoID, branch string) (bool, error) + type StaleDocumentError struct + Got int64 + Seen int64 + func (e *StaleDocumentError) Error() string v0.18.0 Oct 13, 2026 Changes in this version + func PGRequestSync(ctx context.Context, tx pgx.Tx, repoID string) error v0.17.0 Oct 12, 2026 v0.16.0 Oct 12, 2026 Changes in this version + const EnvSyncStealLegacy + const LegacyClaimHolder + var ErrAlreadyDeleted = errors.New("repository already deleted") + var ErrAlreadyExists = errors.New("repository already exists") + var ErrClaimLost = errors.New("sync claim lost") + var ErrInvalidCursor = errors.New("invalid cursor") + var ErrNotFound = errors.New("not found") + var ErrRepoNotDeleted = errors.New("repository is not soft-deleted") + var ErrReservedSecret = fmt.Errorf("secret values must not start with the reserved prefix %q", ...) + var ErrValueNotUTF8 = errors.New("s3walmeta: string value is not valid UTF-8") + func NewEventingID(prefix string) string + type Backend interface + Close func() + InitSchema func(ctx context.Context) error + func Open(ctx context.Context, dbURL string, opts ...Option) (Backend, error) + type CreateOutcome int + const CreateAlreadyComplete + const CreateCompleted + const CreateDeleted + func PGCompleteRepoCreate(ctx context.Context, tx pgx.Tx, org, repoID string, ...) (CreateOutcome, error) + type CreateState int + const CreateStateComplete + const CreateStateLegacy + const CreateStatePending + type EventingStore interface + CreateGitCredential func(ctx context.Context, cred GitCredential) (GitCredential, error) + CreateLinkedRepo func(ctx context.Context, org, url, defaultBranch string, up RepoUpstream, ...) (Repo, error) + CreateWebhook func(ctx context.Context, org, url, secret string) (Webhook, error) + DeleteGitCredential func(ctx context.Context, id string) error + DeleteRepoUpstream func(ctx context.Context, repoID string) error + DeleteWebhook func(ctx context.Context, org, id string) error + FinishPush func(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + FinishSync func(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + GetGitCredential func(ctx context.Context, id string) (GitCredential, error) + GetRepoUpstream func(ctx context.Context, repoID string) (RepoUpstream, error) + GetWebhook func(ctx context.Context, id string) (Webhook, error) + GitCredentialForRepo func(ctx context.Context, repoID string) (GitCredential, error) + GitCredentialMeta func(ctx context.Context, id string) (GitCredential, error) + ListWebhooks func(ctx context.Context, org string) ([]Webhook, error) + PendingPushRepoIDs func(ctx context.Context) ([]string, error) + PendingSyncRepoIDs func(ctx context.Context) ([]string, error) + RequestPush func(ctx context.Context, repoID string, force bool) error + RequestSync func(ctx context.Context, repoID string) error + SetRepoUpstream func(ctx context.Context, up RepoUpstream) (RepoUpstream, error) + TryBeginPush func(ctx context.Context, repoID, holder string, lease time.Duration) (up RepoUpstream, claimed bool, force bool, stolenFrom string, err error) + TryBeginSync func(ctx context.Context, repoID, holder string, lease time.Duration) (up RepoUpstream, claimed bool, stolenFrom string, err error) + UpdateGitCredential func(ctx context.Context, id, username, password string) (GitCredential, error) + type GitCredential struct + CreatedAt time.Time + ID string + Password string + RepoID string + Username string + type LaneOutcome int + const OutcomeDone + const OutcomeRestore + const OutcomeRetry + type ListParams struct + Cursor string + Limit int + Q string + type ListResult struct + HasMore bool + NextCursor string + Repos []Repo + type LocalClaim struct + Attempt int + Busy bool + Claimed bool + Force bool + StolenFrom string + Up RepoUpstream + type LocalScheduleStore interface + ClaimDuePush func(ctx context.Context, repoID, holder string, lease time.Duration) (LocalClaim, error) + ClaimDueSync func(ctx context.Context, repoID, holder string, lease time.Duration) (LocalClaim, error) + CompleteSyncRepoCreate func(ctx context.Context, org, repoID string) (CreateOutcome, error) + FinishPushOutcome func(ctx context.Context, repoID, holder string, o PushOutcome) (RepoUpstream, error) + FinishSyncOutcome func(ctx context.Context, repoID, holder string, o SyncOutcome) (RepoUpstream, error) + ListLocalWork func(ctx context.Context, org, after string, limit int) ([]LocalWork, error) + RequestPushNow func(ctx context.Context, repoID string, force bool) error + type LocalWork struct + Pull bool + Push bool + RepoID string + type Option func(*storeOptions) + func WithNowFunc(now func() time.Time) Option + func WithSecretsCodec(c *secrets.Codec) Option + func WithSyncClaimSink(sink SyncClaimSink) Option + type Org struct + CreatedAt time.Time + ID int64 + Name string + type PG struct + func OpenPG(ctx context.Context, pgURL string, opts ...Option) (*PG, error) + func (s *PG) AddSigningKey(ctx context.Context, org, keyText string) (SigningKey, error) + func (s *PG) Close() + func (s *PG) CompleteRepoCreate(ctx context.Context, org, repoID string) (CreateOutcome, error) + func (s *PG) CreateGitCredential(ctx context.Context, cred GitCredential) (GitCredential, error) + func (s *PG) CreateLinkedRepo(ctx context.Context, org, url, defaultBranch string, up RepoUpstream, ...) (Repo, error) + func (s *PG) CreateRepo(ctx context.Context, org, url, defaultBranch string) (Repo, error) + func (s *PG) CreateRepoWithState(ctx context.Context, org, url, defaultBranch string, state CreateState) (Repo, error) + func (s *PG) CreateWebhook(ctx context.Context, org, url, secret string) (Webhook, error) + func (s *PG) DeleteGitCredential(ctx context.Context, id string) error + func (s *PG) DeleteRepoUpstream(ctx context.Context, repoID string) error + func (s *PG) DeleteWebhook(ctx context.Context, org, id string) error + func (s *PG) FinishPush(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + func (s *PG) FinishSync(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + func (s *PG) GetGitCredential(ctx context.Context, id string) (GitCredential, error) + func (s *PG) GetRepoByID(ctx context.Context, org, repoID string) (Repo, error) + func (s *PG) GetRepoByURL(ctx context.Context, org, url string) (Repo, error) + func (s *PG) GetRepoUpstream(ctx context.Context, repoID string) (RepoUpstream, error) + func (s *PG) GetWebhook(ctx context.Context, id string) (Webhook, error) + func (s *PG) GitCredentialForRepo(ctx context.Context, repoID string) (GitCredential, error) + func (s *PG) GitCredentialMeta(ctx context.Context, id string) (GitCredential, error) + func (s *PG) InitSchema(ctx context.Context) error + func (s *PG) ListRepos(ctx context.Context, org string, params ListParams) (ListResult, error) + func (s *PG) ListWebhooks(ctx context.Context, org string) ([]Webhook, error) + func (s *PG) OrgNames(ctx context.Context) ([]string, error) + func (s *PG) PendingPushRepoIDs(ctx context.Context) ([]string, error) + func (s *PG) PendingSyncRepoIDs(ctx context.Context) ([]string, error) + func (s *PG) PublicKeysForOrg(ctx context.Context, name string) ([]string, error) + func (s *PG) PurgeRepoMeta(ctx context.Context, repoID string) error + func (s *PG) PurgeableRepos(ctx context.Context, deletedBefore time.Time, after PurgeCandidate, limit int) ([]PurgeCandidate, error) + func (s *PG) RemoveSigningKey(ctx context.Context, org string, id int64) error + func (s *PG) RepoPurgeState(ctx context.Context, repoID string) (state PurgeState, found bool, err error) + func (s *PG) RequestPush(ctx context.Context, repoID string, force bool) error + func (s *PG) RequestSync(ctx context.Context, repoID string) error + func (s *PG) RestorePush(ctx context.Context, repoID, holder string, force bool) (RepoUpstream, error) + func (s *PG) RestoreSync(ctx context.Context, repoID, holder string) (RepoUpstream, error) + func (s *PG) SetRepoUpstream(ctx context.Context, up RepoUpstream) (RepoUpstream, error) + func (s *PG) SigningKeysForOrg(ctx context.Context, org string) ([]SigningKey, error) + func (s *PG) SoftDeleteRepo(ctx context.Context, org, url string) (Repo, error) + func (s *PG) TryBeginPush(ctx context.Context, repoID, holder string, lease time.Duration) (RepoUpstream, bool, bool, string, error) + func (s *PG) TryBeginSync(ctx context.Context, repoID, holder string, lease time.Duration) (RepoUpstream, bool, string, error) + func (s *PG) UpdateGitCredential(ctx context.Context, id, username, password string) (GitCredential, error) + func (s *PG) UpdateRepoDefaultBranch(ctx context.Context, org, url, oldBranch, newBranch string) (bool, error) + func (s *PG) UpsertOrgWithKeys(ctx context.Context, name string, pemPublicKeys []string) (Org, error) + type PurgeCandidate struct + DeletedAt time.Time + RepoID string + type PurgeState struct + PurgedAt *time.Time + Repo Repo + type PushOutcome struct + Delay time.Duration + Force bool + Kind LaneOutcome + MirrorBack bool + Success bool + type Repo struct + CreateState CreateState + CreatedAt time.Time + DefaultBranch string + DeletedAt *time.Time + OrgID int64 + RepoID string + URL string + func ResolveRepoKey(ctx context.Context, store Store, org, key string) (Repo, error) + type RepoUpstream struct + CreatedAt time.Time + ForwardOnPush bool + Name string + Owner string + Provider string + PushClaimExpiresAt time.Time + PushClaimForce bool + PushClaimHolder string + PushPending int + PushRunCount int + PushSuccessCount int + PushSyncing bool + RepoID string + RunCount int + SuccessCount int + SyncClaimExpiresAt time.Time + SyncClaimHolder string + SyncPending bool + Syncing bool + UpstreamHost string + type RunRestoreStore interface + RestorePush func(ctx context.Context, repoID, holder string, force bool) (RepoUpstream, error) + RestoreSync func(ctx context.Context, repoID, holder string) (RepoUpstream, error) + type S3WAL struct + func NewS3WAL(cs s3wal.ConditionalStore, opts ...Option) *S3WAL + func OpenS3WAL(ctx context.Context, rawURL string, opts ...Option) (*S3WAL, error) + func (s *S3WAL) AddSigningKey(ctx context.Context, org, keyText string) (SigningKey, error) + func (s *S3WAL) Close() + func (s *S3WAL) CompleteRepoCreate(ctx context.Context, org, repoID string) (CreateOutcome, error) + func (s *S3WAL) CreateGitCredential(ctx context.Context, cred GitCredential) (GitCredential, error) + func (s *S3WAL) CreateLinkedRepo(ctx context.Context, org, url, defaultBranch string, up RepoUpstream, ...) (Repo, error) + func (s *S3WAL) CreateRepo(ctx context.Context, org, url, defaultBranch string) (Repo, error) + func (s *S3WAL) CreateRepoWithState(ctx context.Context, org, url, defaultBranch string, state CreateState) (Repo, error) + func (s *S3WAL) CreateWebhook(ctx context.Context, org, url, secret string) (Webhook, error) + func (s *S3WAL) DeleteGitCredential(ctx context.Context, id string) error + func (s *S3WAL) DeleteRepoUpstream(ctx context.Context, repoID string) error + func (s *S3WAL) DeleteWebhook(ctx context.Context, org, id string) error + func (s *S3WAL) FinishPush(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + func (s *S3WAL) FinishSync(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + func (s *S3WAL) GetGitCredential(ctx context.Context, id string) (GitCredential, error) + func (s *S3WAL) GetRepoByID(ctx context.Context, org, repoID string) (Repo, error) + func (s *S3WAL) GetRepoByURL(ctx context.Context, org, url string) (Repo, error) + func (s *S3WAL) GetRepoUpstream(ctx context.Context, repoID string) (RepoUpstream, error) + func (s *S3WAL) GetWebhook(ctx context.Context, id string) (Webhook, error) + func (s *S3WAL) GitCredentialForRepo(ctx context.Context, repoID string) (GitCredential, error) + func (s *S3WAL) GitCredentialMeta(ctx context.Context, id string) (GitCredential, error) + func (s *S3WAL) InitSchema(ctx context.Context) error + func (s *S3WAL) ListRepos(ctx context.Context, org string, params ListParams) (ListResult, error) + func (s *S3WAL) ListWebhooks(ctx context.Context, org string) ([]Webhook, error) + func (s *S3WAL) OrgNames(ctx context.Context) ([]string, error) + func (s *S3WAL) PendingPushRepoIDs(ctx context.Context) ([]string, error) + func (s *S3WAL) PendingSyncRepoIDs(ctx context.Context) ([]string, error) + func (s *S3WAL) PublicKeysForOrg(ctx context.Context, name string) ([]string, error) + func (s *S3WAL) PurgeRepoMeta(ctx context.Context, repoID string) error + func (s *S3WAL) PurgeableRepos(ctx context.Context, deletedBefore time.Time, after PurgeCandidate, limit int) ([]PurgeCandidate, error) + func (s *S3WAL) RemoveSigningKey(ctx context.Context, org string, id int64) error + func (s *S3WAL) RepoPurgeState(ctx context.Context, repoID string) (PurgeState, bool, error) + func (s *S3WAL) RequestPush(ctx context.Context, repoID string, force bool) error + func (s *S3WAL) RequestSync(ctx context.Context, repoID string) error + func (s *S3WAL) SetRepoUpstream(ctx context.Context, up RepoUpstream) (RepoUpstream, error) + func (s *S3WAL) SigningKeysForOrg(ctx context.Context, org string) ([]SigningKey, error) + func (s *S3WAL) SoftDeleteRepo(ctx context.Context, org, url string) (Repo, error) + func (s *S3WAL) TryBeginPush(ctx context.Context, repoID, holder string, lease time.Duration) (RepoUpstream, bool, bool, string, error) + func (s *S3WAL) TryBeginSync(ctx context.Context, repoID, holder string, lease time.Duration) (RepoUpstream, bool, string, error) + func (s *S3WAL) UpdateGitCredential(ctx context.Context, id, username, password string) (GitCredential, error) + func (s *S3WAL) UpdateRepoDefaultBranch(ctx context.Context, org, url, oldBranch, newBranch string) (bool, error) + func (s *S3WAL) UpsertOrgWithKeys(ctx context.Context, name string, pemPublicKeys []string) (Org, error) + type SQLite struct + func OpenSQLite(ctx context.Context, sqliteURL string, opts ...Option) (*SQLite, error) + func (s *SQLite) AddSigningKey(ctx context.Context, org, keyText string) (SigningKey, error) + func (s *SQLite) ClaimDuePush(ctx context.Context, repoID, holder string, lease time.Duration) (LocalClaim, error) + func (s *SQLite) ClaimDueSync(ctx context.Context, repoID, holder string, lease time.Duration) (LocalClaim, error) + func (s *SQLite) Close() + func (s *SQLite) CompleteRepoCreate(ctx context.Context, org, repoID string) (CreateOutcome, error) + func (s *SQLite) CompleteSyncRepoCreate(ctx context.Context, org, repoID string) (CreateOutcome, error) + func (s *SQLite) CreateGitCredential(ctx context.Context, cred GitCredential) (GitCredential, error) + func (s *SQLite) CreateLinkedRepo(ctx context.Context, org, url, defaultBranch string, up RepoUpstream, ...) (Repo, error) + func (s *SQLite) CreateRepo(ctx context.Context, org, url, defaultBranch string) (Repo, error) + func (s *SQLite) CreateRepoWithState(ctx context.Context, org, url, defaultBranch string, state CreateState) (Repo, error) + func (s *SQLite) CreateWebhook(ctx context.Context, org, url, secret string) (Webhook, error) + func (s *SQLite) DeleteGitCredential(ctx context.Context, id string) error + func (s *SQLite) DeleteRepoUpstream(ctx context.Context, repoID string) error + func (s *SQLite) DeleteWebhook(ctx context.Context, org, id string) error + func (s *SQLite) FinishPush(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + func (s *SQLite) FinishPushOutcome(ctx context.Context, repoID, holder string, o PushOutcome) (RepoUpstream, error) + func (s *SQLite) FinishSync(ctx context.Context, repoID, holder string, success bool) (RepoUpstream, error) + func (s *SQLite) FinishSyncOutcome(ctx context.Context, repoID, holder string, o SyncOutcome) (RepoUpstream, error) + func (s *SQLite) GetGitCredential(ctx context.Context, id string) (GitCredential, error) + func (s *SQLite) GetRepoByID(ctx context.Context, org, repoID string) (Repo, error) + func (s *SQLite) GetRepoByURL(ctx context.Context, org, url string) (Repo, error) + func (s *SQLite) GetRepoUpstream(ctx context.Context, repoID string) (RepoUpstream, error) + func (s *SQLite) GetWebhook(ctx context.Context, id string) (Webhook, error) + func (s *SQLite) GitCredentialForRepo(ctx context.Context, repoID string) (GitCredential, error) + func (s *SQLite) GitCredentialMeta(ctx context.Context, id string) (GitCredential, error) + func (s *SQLite) InitSchema(ctx context.Context) error + func (s *SQLite) ListLocalWork(ctx context.Context, org, after string, limit int) ([]LocalWork, error) + func (s *SQLite) ListRepos(ctx context.Context, org string, params ListParams) (ListResult, error) + func (s *SQLite) ListWebhooks(ctx context.Context, org string) ([]Webhook, error) + func (s *SQLite) OrgNames(ctx context.Context) ([]string, error) + func (s *SQLite) PendingPushRepoIDs(ctx context.Context) ([]string, error) + func (s *SQLite) PendingSyncRepoIDs(ctx context.Context) ([]string, error) + func (s *SQLite) PublicKeysForOrg(ctx context.Context, name string) ([]string, error) + func (s *SQLite) PurgeRepoMeta(ctx context.Context, repoID string) error + func (s *SQLite) PurgeableRepos(ctx context.Context, deletedBefore time.Time, after PurgeCandidate, limit int) ([]PurgeCandidate, error) + func (s *SQLite) RemoveSigningKey(ctx context.Context, org string, id int64) error + func (s *SQLite) RepoPurgeState(ctx context.Context, repoID string) (state PurgeState, found bool, err error) + func (s *SQLite) RequestPush(ctx context.Context, repoID string, force bool) error + func (s *SQLite) RequestPushNow(ctx context.Context, repoID string, force bool) error + func (s *SQLite) RequestSync(ctx context.Context, repoID string) error + func (s *SQLite) SetRepoUpstream(ctx context.Context, up RepoUpstream) (RepoUpstream, error) + func (s *SQLite) SigningKeysForOrg(ctx context.Context, org string) ([]SigningKey, error) + func (s *SQLite) SoftDeleteRepo(ctx context.Context, org, url string) (Repo, error) + func (s *SQLite) TryBeginPush(ctx context.Context, repoID, holder string, lease time.Duration) (RepoUpstream, bool, bool, string, error) + func (s *SQLite) TryBeginSync(ctx context.Context, repoID, holder string, lease time.Duration) (RepoUpstream, bool, string, error) + func (s *SQLite) UpdateGitCredential(ctx context.Context, id, username, password string) (GitCredential, error) + func (s *SQLite) UpdateRepoDefaultBranch(ctx context.Context, org, url, oldBranch, newBranch string) (bool, error) + func (s *SQLite) UpsertOrgWithKeys(ctx context.Context, name string, pemPublicKeys []string) (Org, error) + type SigningKey struct + CreatedAt time.Time + ID int64 + KeyText string + OrgID int64 + type Store interface + AddSigningKey func(ctx context.Context, org, keyText string) (SigningKey, error) + CompleteRepoCreate func(ctx context.Context, org, repoID string) (CreateOutcome, error) + CreateRepo func(ctx context.Context, org, url, defaultBranch string) (Repo, error) + CreateRepoWithState func(ctx context.Context, org, url, defaultBranch string, state CreateState) (Repo, error) + GetRepoByID func(ctx context.Context, org, repoID string) (Repo, error) + GetRepoByURL func(ctx context.Context, org, url string) (Repo, error) + ListRepos func(ctx context.Context, org string, params ListParams) (ListResult, error) + OrgNames func(ctx context.Context) ([]string, error) + PublicKeysForOrg func(ctx context.Context, name string) ([]string, error) + RemoveSigningKey func(ctx context.Context, org string, id int64) error + SigningKeysForOrg func(ctx context.Context, org string) ([]SigningKey, error) + SoftDeleteRepo func(ctx context.Context, org, url string) (Repo, error) + UpdateRepoDefaultBranch func(ctx context.Context, org, url, oldBranch, newBranch string) (won bool, err error) + UpsertOrgWithKeys func(ctx context.Context, name string, pemPublicKeys []string) (Org, error) + type SyncClaimSink interface + ClearSyncClaim func(ctx context.Context, repoID, holder string) error + SetSyncClaim func(ctx context.Context, repoID, holder string) error + type SyncOutcome struct + Delay time.Duration + Kind LaneOutcome + Success bool + type Webhook struct + CreatedAt time.Time + ID string + OrgID int64 + Secret string + URL string