contextservice

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: 10 Imported by: 0

Documentation

Overview

Package contextservice manages durable review targets independently of transports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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"`
	ChangedFileCount *int                            `json:"changedFileCount"`
	ExpiresAt        *int64                          `json:"expiresAt"`
	SubmittedFrom    *string                         `json:"submittedFrom"`
	Capabilities     session.Capabilities            `json:"capabilities"`
	Availability     string                          `json:"availability"`
	Branch           *string                         `json:"branch"`
	WorktreeName     *string                         `json:"worktreeName"`
}

type Page

type Page struct {
	Contexts   []Context `json:"contexts"`
	NextCursor *string   `json:"nextCursor"`
}

type Service

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

func New

func New(store Store, user reviewdata.User) *Service

func NewWithContext

func NewWithContext(ctx context.Context, store Store, user reviewdata.User) *Service

func (*Service) Close

func (service *Service) Close() error

func (*Service) Count

func (service *Service) Count(ctx context.Context) (int, error)

func (*Service) Delete

func (service *Service) Delete(ctx context.Context, id string) error

func (*Service) Get

func (service *Service) Get(ctx context.Context, id string) (Context, error)

func (*Service) Ingest

func (service *Service) Ingest(ctx context.Context, input ingestion.Request) (Submission, error)

func (*Service) List

func (service *Service) List(ctx context.Context, limit int, cursor string) (Page, error)

func (*Service) ListFiltered

func (service *Service) ListFiltered(ctx context.Context, limit int, cursor string, filter ingestion.Filter) (Page, error)

func (*Service) Resolve

func (service *Service) Resolve(ctx context.Context, id string) (session.Session, error)

func (*Service) Subscribe

func (service *Service) Subscribe() (<-chan string, func())

func (*Service) UserID

func (service *Service) UserID() string

type Store

type Store interface {
	IngestContext(context.Context, string, ingestion.Request) (reviewdata.Binding, error)
	ObservationSnapshot(string, string, review.DiffMode) (review.RepositoryDiff, error)
	ObservationPatch(string, string, review.DiffMode, string) (review.FilePatch, error)
	ObservationContexts(string, int, int64, string, ingestion.Filter) ([]reviewdata.ContextInfo, error)
	Context(string, string, time.Time) (reviewdata.ContextInfo, error)
	ContextBinding(string, string, time.Time) (reviewdata.Binding, error)
	Contexts(string, int, int64, string, time.Time) ([]reviewdata.ContextInfo, error)
	ContextCount(string, time.Time) (int, error)
	DeleteContext(string, string) error
}

Store preserves atomic ingestion; callers cannot partially publish an observation.

type Submission

type Submission struct {
	Context  Context               `json:"context"`
	Snapshot review.RepositoryDiff `json:"snapshot"`
}

Jump to

Keyboard shortcuts

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