Documentation
¶
Index ¶
- func DraftAnnotation(snapshot *RepositorySnapshot, input AddInput) (store.Annotation, error)
- func WarningFor(status anchor.Status) string
- type AcknowledgeCommentInput
- type AddInput
- type AnnotationView
- type ConvertCommentInput
- type FileSnapshot
- type Mutation
- type ReanchorInput
- type RepositoryIdentity
- type RepositorySnapshot
- type Service
- func (s *Service) AcknowledgeComment(input AcknowledgeCommentInput) (Mutation, error)
- func (s *Service) Add(input AddInput) (Mutation, error)
- func (s *Service) CheckComments(requested []string) ([]commentpolicy.Violation, error)
- func (s *Service) ConvertComment(input ConvertCommentInput) (Mutation, error)
- func (s *Service) Reanchor(input ReanchorInput) (Mutation, error)
- func (s *Service) Snapshot() (*RepositorySnapshot, error)
- type SnapshotInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DraftAnnotation ¶
func DraftAnnotation(snapshot *RepositorySnapshot, input AddInput) (store.Annotation, error)
func WarningFor ¶
WarningFor is the single stale-record warning policy for every surface.
Types ¶
type AcknowledgeCommentInput ¶
type AcknowledgeCommentInput struct {
File string
Comment string
Body string
Author store.Author
Acknowledged bool
}
AcknowledgeCommentInput explicitly retains one exceptional inline comment.
type AddInput ¶
type AddInput struct {
File string
Excerpt string
Kind store.Type
Title string
Body string
Author store.Author
Policy *store.Policy
}
AddInput is the complete intent needed to create an annotation.
type AnnotationView ¶
type AnnotationView struct {
Record store.Annotation
Status anchor.Status
Line int
Occurrences int
Warning string
}
AnnotationView is the common record and resolution presented by every reader.
type ConvertCommentInput ¶
ConvertCommentInput records explanatory comment intent before removing it.
type FileSnapshot ¶
type FileSnapshot struct {
Path string
Content []byte
Exists bool
Annotations []AnnotationView
}
FileSnapshot contains source and resolved annotations from the same read.
type Mutation ¶
type Mutation struct {
Record store.Annotation
Path string
Warnings []string
}
Mutation is the durable record and its repository-relative path.
type ReanchorInput ¶
ReanchorInput moves an existing annotation without changing its identity.
type RepositoryIdentity ¶
RepositoryIdentity is stable presentation metadata for a snapshot.
type RepositorySnapshot ¶
type RepositorySnapshot struct {
Repository RepositoryIdentity
Commit string
Dirty bool
GeneratedAt time.Time
Files []FileSnapshot
}
RepositorySnapshot is one internally consistent read of a repository.
func AssembleSnapshot ¶
func AssembleSnapshot(input SnapshotInput) (*RepositorySnapshot, error)
AssembleSnapshot resolves a complete source revision without performing I/O.
func BuildSnapshot ¶
func BuildSnapshot(entry repository.Repository) (*RepositorySnapshot, error)
BuildSnapshot reads every annotation and annotated source file once.
func (*RepositorySnapshot) Counts ¶
func (s *RepositorySnapshot) Counts() map[anchor.Status]int
Counts returns resolution counts for the repository.
func (*RepositorySnapshot) File ¶
func (s *RepositorySnapshot) File(path string) (FileSnapshot, bool)
File returns one annotated file from the snapshot.
func (*RepositorySnapshot) Search ¶
func (s *RepositorySnapshot) Search(query string) []AnnotationView
Search returns annotations whose record fields contain the query.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service owns local repository reads and mutations.
func NewService ¶
func NewService(entry repository.Repository) *Service
NewService constructs the application service for one repository.
func (*Service) AcknowledgeComment ¶
func (s *Service) AcknowledgeComment(input AcknowledgeCommentInput) (Mutation, error)
AcknowledgeComment creates the exact policy record required to retain a comment.
func (*Service) CheckComments ¶
func (s *Service) CheckComments(requested []string) ([]commentpolicy.Violation, error)
CheckComments applies the configured repository policy.
func (*Service) ConvertComment ¶
func (s *Service) ConvertComment(input ConvertCommentInput) (Mutation, error)
ConvertComment durably records rationale before editing the source.
func (*Service) Reanchor ¶
func (s *Service) Reanchor(input ReanchorInput) (Mutation, error)
Reanchor changes only an annotation's target.
func (*Service) Snapshot ¶
func (s *Service) Snapshot() (*RepositorySnapshot, error)
Snapshot reads the repository through the shared snapshot contract.
type SnapshotInput ¶
type SnapshotInput struct {
Repository RepositoryIdentity
Commit string
Dirty bool
GeneratedAt time.Time
Records []store.Annotation
Sources map[string][]byte
}
SnapshotInput is a complete repository read from one source revision.