Documentation
¶
Overview ¶
Package contextservice manages durable review targets independently of transports.
Index ¶
- func ActivityTime(item Context) int64
- func CompareActivity(left, right Context) int
- type Context
- type Option
- type Page
- type Publication
- type Scope
- type Service
- func (service *Service) Close() error
- func (service *Service) Count(ctx context.Context) (int, error)
- func (service *Service) Delete(ctx context.Context, id string) error
- func (service *Service) Get(ctx context.Context, id string) (Context, error)
- func (service *Service) Ingest(ctx context.Context, input ingestion.Request) (Publication, error)
- func (service *Service) List(ctx context.Context, limit int, cursor string) (Page, error)
- func (service *Service) ListFiltered(ctx context.Context, limit int, cursor string, filter ingestion.Filter) (Page, error)
- func (service *Service) Notify(contextID string)
- func (service *Service) Resolve(ctx context.Context, id string) (reviewsession.Session, error)
- func (service *Service) Select(input ingestion.Request)
- func (service *Service) Subscribe() (<-chan string, func())
- func (service *Service) UserID() string
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityTime ¶ added in v0.2.1
ActivityTime returns advisory code activity, falling back to captured collection time for observations from producers without activity metadata.
func CompareActivity ¶ added in v0.2.1
CompareActivity orders most active first, with stable stream and context ties. It never changes stream freshness or catalog pagination.
Types ¶
type Context ¶
type Context struct {
Stale bool `json:"stale"`
Sessions []reviewdata.SessionAssociation `json:"sessions,omitempty"`
Observation *ingestion.Metadata `json:"observation,omitempty"`
ID string `json:"id"`
Kind string `json:"kind"`
Source string `json:"source"`
Name string `json:"name"`
Root *string `json:"root"`
LocationID *string `json:"locationId"`
RepositoryID *string `json:"repositoryId"`
CreatedAt int64 `json:"createdAt"`
LastSubmittedAt int64 `json:"lastSubmittedAt"`
LastChangedAt int64 `json:"lastChangedAt"`
ScopeSummaries []review.ScopeSummary `json:"scopeSummaries,omitempty"`
Commits *review.CommitRange `json:"commits,omitempty"`
ChangedFileCount *int `json:"changedFileCount"`
ExpiresAt *int64 `json:"expiresAt"`
SubmittedFrom *string `json:"submittedFrom"`
Capabilities reviewsession.Capabilities `json:"capabilities"`
Availability string `json:"availability"`
Branch *string `json:"branch"`
WorktreeName *string `json:"worktreeName"`
StreamID *string `json:"streamId"`
LatestContextID *string `json:"latestContextId"`
}
type Option ¶ added in v0.2.2
type Option func(*Service)
Option adjusts a composition's service.
func ExternalEvents ¶ added in v0.2.2
func ExternalEvents() Option
ExternalEvents stops Ingest and Delete from notifying subscribers in-process. The composition instead relays changes its store announces, from every process, through Notify.
type Publication ¶ added in v0.2.1
type Publication struct {
Context Context `json:"context"`
Snapshot review.RepositoryDiff `json:"snapshot"`
}
Publication is an ingested context with its snapshot.
type Scope ¶ added in v0.2.1
type Scope struct {
SourceID string
Checkouts []ingestion.Checkout
SubmissionID string
// contains filtered or unexported fields
}
Scope limits a composition to its selected checkouts or one capture. The zero value is unscoped. Contexts outside the scope behave as not found.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewWithContext ¶
func (*Service) ListFiltered ¶
func (*Service) Notify ¶ added in v0.2.2
Notify tells the owner's subscribers that contextID changed elsewhere. An empty contextID means changes may have been missed; subscribers reload.
func (*Service) Select ¶ added in v0.2.1
Select widens a scoped composition to the request's checkout before it is ingested, so checkouts discovered after startup become visible. Unscoped services are unchanged; only local entry points select.
type Store ¶
type Store interface {
IngestContext(context.Context, string, ingestion.Request) (reviewdata.Binding, error)
ObservationSnapshot(context.Context, string, string, review.DiffMode) (review.RepositoryDiff, error)
ObservationPatch(context.Context, string, string, review.DiffMode, string, string) (review.FilePatch, error)
ObservationContexts(context.Context, string, int, int64, string, ingestion.Filter) ([]reviewdata.ContextInfo, error)
Context(context.Context, string, string, time.Time) (reviewdata.ContextInfo, error)
ContextBinding(context.Context, string, string, time.Time) (reviewdata.Binding, error)
Contexts(context.Context, string, int, int64, string, time.Time) ([]reviewdata.ContextInfo, error)
ContextCount(context.Context, string, ingestion.Selection, time.Time) (int, error)
DeleteContext(context.Context, string, string) error
}
Store preserves atomic ingestion; callers cannot partially publish an observation.