Documentation
¶
Index ¶
- Constants
- Variables
- func Reset(path string) (string, error)
- func VersionID(diffID, revision string) string
- type Binding
- type ContextInfo
- type GitHubStore
- func (s *GitHubStore) ClaimRefresh(ctx context.Context, token string, now, leaseUntil int64) (githubsync.Lease, error)
- func (s *GitHubStore) CompleteRefresh(ctx context.Context, lease githubsync.Lease, state string, ...) error
- func (s *GitHubStore) Connection(ctx context.Context, ownerID string) (githubsync.Connection, error)
- func (s *GitHubStore) Connections(ctx context.Context) ([]githubsync.Connection, error)
- func (s *GitHubStore) DeleteConnection(ctx context.Context, ownerID string) error
- func (s *GitHubStore) DeleteFollow(ctx context.Context, ownerID string, repositoryID int64) error
- func (s *GitHubStore) Follows(ctx context.Context, ownerID string) ([]githubsync.Follow, error)
- func (s *GitHubStore) KnownOpen(ctx context.Context, repositoryID int64) ([]int, error)
- func (s *GitHubStore) Leased(ctx context.Context, repositoryID int64, number int, token string, now int64) (githubsync.Lease, []byte, error)
- func (s *GitHubStore) LoseInstallation(ctx context.Context, installationID int64, repositoryIDs []int64) error
- func (s *GitHubStore) PutConnection(ctx context.Context, c githubsync.Connection) error
- func (s *GitHubStore) PutFollow(ctx context.Context, f githubsync.Follow) error
- func (s *GitHubStore) PutOAuthState(ctx context.Context, hash, ownerID string, expiresAt int64) error
- func (s *GitHubStore) RecordDelivery(ctx context.Context, id, event string, now int64) error
- func (s *GitHubStore) RecordLease(ctx context.Context, lease githubsync.Lease, leased []byte, now int64) error
- func (s *GitHubStore) ReleaseRefresh(ctx context.Context, lease githubsync.Lease, retryAt int64, detail string) error
- func (s *GitHubStore) RepositoryFollows(ctx context.Context, repositoryID int64) ([]githubsync.Follow, error)
- func (s *GitHubStore) RequestRefresh(ctx context.Context, ref githubsync.PullRequestRef, retentionRun string, ...) error
- func (s *GitHubStore) RevokeUser(ctx context.Context, userID int64) error
- func (s *GitHubStore) SeenDelivery(ctx context.Context, id string) (bool, error)
- func (s *GitHubStore) TakeOAuthState(ctx context.Context, hash string, now int64) (string, error)
- type SQLiteQueue
- func (queue *SQLiteQueue) Accept(ctx context.Context, owner string, request ingestion.Request) (ingestionqueue.Job, error)
- func (queue *SQLiteQueue) Claim(ctx context.Context, duration time.Duration) (ingestionqueue.Delivery, error)
- func (queue *SQLiteQueue) Complete(ctx context.Context, delivery ingestionqueue.Delivery, id string) error
- func (queue *SQLiteQueue) Fail(ctx context.Context, delivery ingestionqueue.Delivery, detail string) error
- func (queue *SQLiteQueue) Get(ctx context.Context, owner, id string) (ingestionqueue.Job, error)
- func (queue *SQLiteQueue) Renew(ctx context.Context, delivery ingestionqueue.Delivery, duration time.Duration) error
- func (queue *SQLiteQueue) Retry(ctx context.Context, delivery ingestionqueue.Delivery, next time.Time, ...) error
- type SessionAssociation
- type StateError
- type Store
- func (store *Store) AccountPassword(ctx context.Context, username string) (identityservice.PasswordCredential, error)
- func (store *Store) AccountPasswordByID(ctx context.Context, accountID string) (identityservice.PasswordCredential, error)
- func (store *Store) ClearMarks(ctx context.Context, contextID string, scope review.DiffMode) error
- func (store *Store) Close() error
- func (store *Store) Comments(ctx context.Context, contextID string) ([]review.ReviewComment, error)
- func (store *Store) Context(ctx context.Context, ownerID, id string, now time.Time) (ContextInfo, error)
- func (store *Store) ContextBinding(ctx context.Context, ownerID, id string, now time.Time) (Binding, error)
- func (store *Store) ContextCount(ctx context.Context, ownerID string, selection ingestion.Selection, ...) (int, error)
- func (store *Store) Contexts(ctx context.Context, ownerID string, limit int, beforeTime int64, ...) ([]ContextInfo, error)
- func (store *Store) CreateAccount(ctx context.Context, account identityservice.Account, passwordHash string, ...) (identityservice.Account, error)
- func (store *Store) CreateIdentityToken(ctx context.Context, accountID string, token identityservice.Token, ...) error
- func (store *Store) CreateSession(ctx context.Context, accountID, expected, secretHash, csrf string, ...) error
- func (store *Store) DeleteComment(ctx context.Context, contextID, commentID string) (bool, error)
- func (store *Store) DeleteComments(ctx context.Context, contextID string, selected map[string]bool) (int, error)
- func (store *Store) DeleteContext(ctx context.Context, ownerID, id string) error
- func (store *Store) DeleteIdentityToken(ctx context.Context, accountID, tokenID string) error
- func (store *Store) DeleteMark(ctx context.Context, contextID string, scope review.DiffMode, fileID string) error
- func (store *Store) DeleteSession(ctx context.Context, secretHash string) error
- func (store *Store) GitHub() *GitHubStore
- func (store *Store) IdentityAccounts(ctx context.Context) ([]identityservice.Account, error)
- func (store *Store) IdentityTokens(ctx context.Context, accountID string) ([]identityservice.Token, error)
- func (store *Store) ImportComments(ctx context.Context, contextID string, comments []review.ReviewComment) ([]review.ReviewComment, error)
- func (store *Store) Ingest(ownerID string, request ingestion.Request) (Binding, error)
- func (store *Store) IngestContext(ctx context.Context, ownerID string, request ingestion.Request) (Binding, error)
- func (store *Store) Marks(ctx context.Context, contextID string, scope review.DiffMode) ([]review.ReviewMark, error)
- func (store *Store) Observation(ownerID, contextID string) (ingestion.Metadata, error)
- func (store *Store) ObservationContexts(ctx context.Context, ownerID string, limit int, beforeTime int64, ...) ([]ContextInfo, error)
- func (store *Store) ObservationFileVersion(ctx context.Context, ownerID, contextID string, mode review.DiffMode, ...) (reviewdata.FileVersion, error)
- func (store *Store) ObservationPatch(ctx context.Context, ownerID, contextID string, mode review.DiffMode, ...) (review.FilePatch, error)
- func (store *Store) ObservationSnapshot(ctx context.Context, ownerID, contextID string, mode review.DiffMode) (review.RepositoryDiff, error)
- func (store *Store) PruneExpired(now time.Time) error
- func (store *Store) PutComment(ctx context.Context, contextID string, comment review.ReviewComment) error
- func (store *Store) PutMark(ctx context.Context, contextID string, mark review.ReviewMark) error
- func (store *Store) Queue() *SQLiteQueue
- func (store *Store) ReplaceComment(ctx context.Context, contextID string, comment review.ReviewComment) (bool, error)
- func (store *Store) ReplacePassword(ctx context.Context, accountID, expected, replacement string) error
- func (store *Store) ResolveIdentityToken(ctx context.Context, secretHash string, now time.Time) (identityservice.TokenIdentity, error)
- func (store *Store) ResolveSession(ctx context.Context, secretHash string, now time.Time) (identityservice.Session, error)
- func (store *Store) StoredVersion(ctx context.Context, ownerID, diffID, versionID string, now time.Time) (review.RepositoryDiff, error)
- func (store *Store) User(osUID, name string) (User, error)
- type User
Constants ¶
const DefaultRetention = 7 * 24 * time.Hour
Variables ¶
var ( ErrExpired = reviewdata.ErrExpired ErrSubmissionConflict = reviewdata.ErrSubmissionConflict )
var ErrNotFound = reviewdata.ErrNotFound
Functions ¶
func Reset ¶ added in v0.2.1
Reset moves current or older diffx state at path to a timestamped backup beside it, then removes earlier backups. It refuses newer or unrecognized state and returns "" when no state exists. Opening a store never resets; only entry points that own an explicit reset decision call Reset.
Types ¶
type Binding ¶
type Binding = reviewdata.Binding
type ContextInfo ¶
type ContextInfo = reviewdata.ContextInfo
type GitHubStore ¶ added in v0.2.1
type GitHubStore struct {
// contains filtered or unexported fields
}
func (*GitHubStore) ClaimRefresh ¶ added in v0.2.1
func (s *GitHubStore) ClaimRefresh(ctx context.Context, token string, now, leaseUntil int64) (githubsync.Lease, error)
func (*GitHubStore) CompleteRefresh ¶ added in v0.2.1
func (s *GitHubStore) CompleteRefresh(ctx context.Context, lease githubsync.Lease, state string, admissions []githubsync.Admission, now int64) error
func (*GitHubStore) Connection ¶ added in v0.2.1
func (s *GitHubStore) Connection(ctx context.Context, ownerID string) (githubsync.Connection, error)
func (*GitHubStore) Connections ¶ added in v0.2.1
func (s *GitHubStore) Connections(ctx context.Context) ([]githubsync.Connection, error)
func (*GitHubStore) DeleteConnection ¶ added in v0.2.1
func (s *GitHubStore) DeleteConnection(ctx context.Context, ownerID string) error
Follows cascade with their connection.
func (*GitHubStore) DeleteFollow ¶ added in v0.2.1
func (*GitHubStore) Follows ¶ added in v0.2.1
func (s *GitHubStore) Follows(ctx context.Context, ownerID string) ([]githubsync.Follow, error)
func (*GitHubStore) LoseInstallation ¶ added in v0.2.1
func (*GitHubStore) PutConnection ¶ added in v0.2.1
func (s *GitHubStore) PutConnection(ctx context.Context, c githubsync.Connection) error
func (*GitHubStore) PutFollow ¶ added in v0.2.1
func (s *GitHubStore) PutFollow(ctx context.Context, f githubsync.Follow) error
func (*GitHubStore) PutOAuthState ¶ added in v0.2.1
func (*GitHubStore) RecordDelivery ¶ added in v0.2.1
func (*GitHubStore) RecordLease ¶ added in v0.2.1
func (s *GitHubStore) RecordLease(ctx context.Context, lease githubsync.Lease, leased []byte, now int64) error
func (*GitHubStore) ReleaseRefresh ¶ added in v0.2.1
func (s *GitHubStore) ReleaseRefresh(ctx context.Context, lease githubsync.Lease, retryAt int64, detail string) error
func (*GitHubStore) RepositoryFollows ¶ added in v0.2.1
func (s *GitHubStore) RepositoryFollows(ctx context.Context, repositoryID int64) ([]githubsync.Follow, error)
func (*GitHubStore) RequestRefresh ¶ added in v0.2.1
func (s *GitHubStore) RequestRefresh(ctx context.Context, ref githubsync.PullRequestRef, retentionRun string, now int64) error
func (*GitHubStore) RevokeUser ¶ added in v0.2.1
func (s *GitHubStore) RevokeUser(ctx context.Context, userID int64) error
func (*GitHubStore) SeenDelivery ¶ added in v0.2.1
func (*GitHubStore) TakeOAuthState ¶ added in v0.2.1
type SQLiteQueue ¶
type SQLiteQueue struct {
// contains filtered or unexported fields
}
SQLiteQueue uses the same database owner as observations; it never opens a second connection pool or permits multiple processes to bypass store ownership.
func (*SQLiteQueue) Accept ¶
func (queue *SQLiteQueue) Accept(ctx context.Context, owner string, request ingestion.Request) (ingestionqueue.Job, error)
func (*SQLiteQueue) Claim ¶
func (queue *SQLiteQueue) Claim(ctx context.Context, duration time.Duration) (ingestionqueue.Delivery, error)
func (*SQLiteQueue) Complete ¶
func (queue *SQLiteQueue) Complete(ctx context.Context, delivery ingestionqueue.Delivery, id string) error
func (*SQLiteQueue) Fail ¶
func (queue *SQLiteQueue) Fail(ctx context.Context, delivery ingestionqueue.Delivery, detail string) error
func (*SQLiteQueue) Get ¶
func (queue *SQLiteQueue) Get(ctx context.Context, owner, id string) (ingestionqueue.Job, error)
func (*SQLiteQueue) Renew ¶
func (queue *SQLiteQueue) Renew(ctx context.Context, delivery ingestionqueue.Delivery, duration time.Duration) error
type SessionAssociation ¶
type SessionAssociation = reviewdata.SessionAssociation
SessionAssociation records observation, never ownership or authorship.
type StateError ¶ added in v0.2.1
StateError reports state this binary refuses to open. Version is the stored schema; it is zero for unversioned or unrecognized files.
func (*StateError) Error ¶ added in v0.2.1
func (failure *StateError) Error() string
func (*StateError) Older ¶ added in v0.2.1
func (failure *StateError) Older() bool
Older reports diffx state written by an earlier schema that cannot upgrade in place.
func (*StateError) Supported ¶ added in v0.2.1
func (failure *StateError) Supported() int
Supported is the schema this binary opens.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenWithRetention ¶
OpenWithRetention configures expiry for new observations. Existing expiry and replay identities remain unchanged.
func (*Store) AccountPassword ¶ added in v0.2.1
func (store *Store) AccountPassword(ctx context.Context, username string) (identityservice.PasswordCredential, error)
func (*Store) AccountPasswordByID ¶ added in v0.2.1
func (store *Store) AccountPasswordByID(ctx context.Context, accountID string) (identityservice.PasswordCredential, error)
func (*Store) ClearMarks ¶
func (*Store) ContextBinding ¶
func (*Store) ContextCount ¶
func (*Store) Contexts ¶
func (store *Store) Contexts(ctx context.Context, ownerID string, limit int, beforeTime int64, beforeID string, now time.Time) ([]ContextInfo, error)
Contexts uses a keyset cursor; concurrent submissions may move an item across pages.
func (*Store) CreateAccount ¶ added in v0.2.1
func (store *Store) CreateAccount(ctx context.Context, account identityservice.Account, passwordHash string, bootstrap bool, created time.Time) (identityservice.Account, error)
CreateAccount commits the owner and its initial credential together. Bootstrap checks all remote accounts in this transaction, so changed env never creates another owner or replaces credentials on restart.
func (*Store) CreateIdentityToken ¶ added in v0.2.1
func (*Store) CreateSession ¶ added in v0.2.1
func (*Store) DeleteComment ¶
func (*Store) DeleteComments ¶
func (*Store) DeleteContext ¶
DeleteContext removes the context and every scope's snapshot. Review state survives while its stream has another observation. Stream heads intentionally survive so older observations remain stale.
func (*Store) DeleteIdentityToken ¶ added in v0.2.1
func (*Store) DeleteMark ¶
func (store *Store) DeleteMark(ctx context.Context, contextID string, scope review.DiffMode, fileID string) error
DeleteMark and ClearMarks remove only marks visible in this context.
func (*Store) DeleteSession ¶ added in v0.2.1
func (*Store) GitHub ¶ added in v0.2.1
func (store *Store) GitHub() *GitHubStore
GitHub adapts the store to the integration's storage contract.
func (*Store) IdentityAccounts ¶ added in v0.2.1
func (*Store) IdentityTokens ¶ added in v0.2.1
func (*Store) ImportComments ¶
func (store *Store) ImportComments(ctx context.Context, contextID string, comments []review.ReviewComment) ([]review.ReviewComment, error)
func (*Store) Ingest ¶
Ingest atomically commits an immutable observation and its retry identity. Checkout paths are labels; this method never accesses a producer filesystem.
func (*Store) IngestContext ¶
func (*Store) Marks ¶
func (store *Store) Marks(ctx context.Context, contextID string, scope review.DiffMode) ([]review.ReviewMark, error)
Marks returns stream marks whose file patch is unchanged in this context, projected onto this context's snapshot.
func (*Store) Observation ¶
func (*Store) ObservationContexts ¶
func (store *Store) ObservationContexts(ctx context.Context, ownerID string, limit int, beforeTime int64, beforeID string, filter ingestion.Filter) ([]ContextInfo, error)
ObservationContexts filters immutable observations using captured metadata.
func (*Store) ObservationFileVersion ¶ added in v0.2.1
func (store *Store) ObservationFileVersion(ctx context.Context, ownerID, contextID string, mode review.DiffMode, fileID string) (reviewdata.FileVersion, error)
ObservationFileVersion reads only indexed identities. Missing files retain the scope identity so callers can reject stale scope references before file errors.
func (*Store) ObservationPatch ¶
func (*Store) ObservationSnapshot ¶
func (*Store) PutComment ¶
func (store *Store) PutComment(ctx context.Context, contextID string, comment review.ReviewComment) error
PutComment stores a comment in the context's stream review. New references must name this context's snapshot; an existing comment may keep the snapshot it was written against.
func (*Store) Queue ¶
func (store *Store) Queue() *SQLiteQueue
func (*Store) ReplaceComment ¶ added in v0.2.1
func (store *Store) ReplaceComment(ctx context.Context, contextID string, comment review.ReviewComment) (bool, error)
ReplaceComment updates an existing stream comment and reports false when it no longer exists, so an edit racing a delete cannot recreate the comment.
func (*Store) ReplacePassword ¶ added in v0.2.1
func (store *Store) ReplacePassword(ctx context.Context, accountID, expected, replacement string) error
ReplacePassword fences authentication against password changes/reset, and invalidates every browser session at the same commit. API tokens are independent.
func (*Store) ResolveIdentityToken ¶ added in v0.2.1
func (store *Store) ResolveIdentityToken(ctx context.Context, secretHash string, now time.Time) (identityservice.TokenIdentity, error)
func (*Store) ResolveSession ¶ added in v0.2.1
func (*Store) StoredVersion ¶
type User ¶
type User = reviewdata.User