reviewstore

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRetention = 7 * 24 * time.Hour

Variables

View Source
var (
	ErrExpired            = reviewdata.ErrExpired
	ErrSubmissionConflict = reviewdata.ErrSubmissionConflict
)
View Source
var ErrAuthentication = errors.New("invalid credentials")
View Source
var ErrNotFound = reviewdata.ErrNotFound

Functions

func DefaultPath

func DefaultPath() (string, error)

func VersionID

func VersionID(diffID, revision string) string

Types

type Binding

type Binding = reviewdata.Binding

type ContextInfo

type ContextInfo = reviewdata.ContextInfo

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

func (*SQLiteQueue) Retry

func (queue *SQLiteQueue) Retry(ctx context.Context, delivery ingestionqueue.Delivery, next time.Time, detail string) error

type SessionAssociation

type SessionAssociation = reviewdata.SessionAssociation

SessionAssociation records observation, never ownership or authorship.

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(path string) (*Store, error)

func OpenWithRetention

func OpenWithRetention(path string, retention time.Duration) (*Store, error)

OpenWithRetention configures expiry for new observations. Existing expiry and replay identities remain unchanged.

func (*Store) AuthenticateToken

func (store *Store) AuthenticateToken(token string) (User, error)

func (*Store) ClearMarks

func (store *Store) ClearMarks(contextID string, scope review.DiffMode) error

func (*Store) Close

func (store *Store) Close() error

func (*Store) Comments

func (store *Store) Comments(contextID string) ([]review.ReviewComment, error)

func (*Store) Context

func (store *Store) Context(ownerID, id string, now time.Time) (ContextInfo, error)

func (*Store) ContextBinding

func (store *Store) ContextBinding(ownerID, id string, now time.Time) (Binding, error)

func (*Store) ContextCount

func (store *Store) ContextCount(ownerID string, now time.Time) (int, error)

func (*Store) Contexts

func (store *Store) Contexts(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) DeleteComment

func (store *Store) DeleteComment(contextID, commentID string) (bool, error)

func (*Store) DeleteComments

func (store *Store) DeleteComments(contextID string, selected map[string]bool) (int, error)

func (*Store) DeleteContext

func (store *Store) DeleteContext(ownerID, id string) error

DeleteContext removes the context and every scope's retained review data. Stream heads intentionally survive so older observations remain stale.

func (*Store) DeleteMark

func (store *Store) DeleteMark(contextID string, scope review.DiffMode, fileID string) error

func (*Store) EnsureRemoteUser

func (store *Store) EnsureRemoteUser(account, token string) (User, error)

EnsureRemoteUser bootstraps credentials, but never changes existing credentials.

func (*Store) ImportComments

func (store *Store) ImportComments(contextID string, comments []review.ReviewComment) ([]review.ReviewComment, error)

func (*Store) Ingest

func (store *Store) Ingest(ownerID string, request ingestion.Request) (Binding, error)

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 *Store) IngestContext(ctx context.Context, ownerID string, request ingestion.Request) (Binding, error)

func (*Store) Marks

func (store *Store) Marks(contextID string, scope review.DiffMode) ([]review.ReviewMark, error)

func (*Store) Observation

func (store *Store) Observation(ownerID, contextID string) (ingestion.Metadata, error)

func (*Store) ObservationContexts

func (store *Store) ObservationContexts(ownerID string, limit int, beforeTime int64, beforeID string, filter ingestion.Filter) ([]ContextInfo, error)

ObservationContexts filters immutable observations using captured metadata.

func (*Store) ObservationPatch

func (store *Store) ObservationPatch(ownerID, contextID string, mode review.DiffMode, fileID string) (review.FilePatch, error)

func (*Store) ObservationSnapshot

func (store *Store) ObservationSnapshot(ownerID, contextID string, mode review.DiffMode) (review.RepositoryDiff, error)

func (*Store) ProvisionUser

func (store *Store) ProvisionUser(account, token string) (User, error)

ProvisionUser explicitly creates a new remote account. Tokens are stored hashed.

func (*Store) PruneExpired

func (store *Store) PruneExpired(now time.Time) error

func (*Store) PutComment

func (store *Store) PutComment(contextID string, comment review.ReviewComment) error

func (*Store) PutMark

func (store *Store) PutMark(contextID string, mark review.ReviewMark) error

func (*Store) Queue

func (store *Store) Queue() *SQLiteQueue

func (*Store) RemoteUsers

func (store *Store) RemoteUsers() ([]User, error)

func (*Store) StoredVersion

func (store *Store) StoredVersion(ownerID, diffID, versionID string, now time.Time) (review.RepositoryDiff, error)

func (*Store) User

func (store *Store) User(osUID, name string) (User, error)

type User

type User = reviewdata.User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL