Help us shape the future of Go! Take the 2026 Go Developer Survey

reviewstore

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 18 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 ErrNotFound = reviewdata.ErrNotFound

Functions

func Reset added in v0.2.1

func Reset(path string) (string, error)

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.

func VersionID

func VersionID(diffID, revision string) string

Types

type Binding

type Binding = reviewdata.Binding

type ContextInfo

type ContextInfo = reviewdata.ContextInfo

type SessionAssociation

type SessionAssociation = reviewdata.SessionAssociation

SessionAssociation records observation, never ownership or authorship.

type StateError added in v0.2.1

type StateError struct {
	Path    string
	Version int
	// contains filtered or unexported fields
}

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 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) ClearMarks

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

func (*Store) Close

func (store *Store) Close() error

func (*Store) Comments

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

Comments returns the stream's comments while the context is retained.

func (*Store) Context

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

func (*Store) ContextBinding

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

func (*Store) ContextCount

func (store *Store) ContextCount(ctx context.Context, ownerID string, selection ingestion.Selection, now time.Time) (int, error)

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) DeleteComment

func (store *Store) DeleteComment(ctx context.Context, contextID, commentID string) (bool, error)

func (*Store) DeleteComments

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

func (*Store) DeleteContext

func (store *Store) DeleteContext(ctx context.Context, ownerID, id string) error

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) 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) ImportComments

func (store *Store) ImportComments(ctx context.Context, 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(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 *Store) Observation(ownerID, contextID string) (ingestion.Metadata, error)

func (*Store) ObservationCommitFileVersion added in v0.2.2

func (store *Store) ObservationCommitFileVersion(ctx context.Context, ownerID, contextID, oid, fileID string) (reviewdata.FileVersion, error)

ObservationCommitFileVersion reads only indexed identities of a commit's file.

func (*Store) ObservationCommitPatch added in v0.2.2

func (store *Store) ObservationCommitPatch(ctx context.Context, ownerID, contextID, oid, fileID, fileVersion string) (review.FilePatch, error)

func (*Store) ObservationCommitSnapshot added in v0.2.2

func (store *Store) ObservationCommitSnapshot(ctx context.Context, ownerID, contextID, oid string) (review.RepositoryDiff, error)

ObservationCommitSnapshot reads a captured commit's diff. Merge commits and commits outside the observation are not found.

func (*Store) ObservationCommits added in v0.2.2

func (store *Store) ObservationCommits(ctx context.Context, ownerID, contextID string) ([]review.CommitSummary, review.CommitRange, error)

ObservationCommits lists an unexpired observation's captured commits, oldest first, with the count of omitted older commits.

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 *Store) ObservationPatch(ctx context.Context, ownerID, contextID string, mode review.DiffMode, fileID, fileVersion string) (review.FilePatch, error)

func (*Store) ObservationSnapshot

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

func (*Store) PruneExpired

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

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) PutMark

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

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) StoredVersion

func (store *Store) StoredVersion(ctx context.Context, 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