Documentation
¶
Overview ¶
Package analyst implements finite, explicitly included capture investigations.
Index ¶
- Constants
- Variables
- func ApproveLog(ctx context.Context, dir string, review LogReview) error
- func AtomicJSON(ctx context.Context, dir, name string, data []byte, validate func() error) error
- func CatalogueFields() map[string]map[string][]string
- func Check(ctx context.Context, dir string, expected Binding) error
- func CheckDiagnostic(ctx context.Context, dir string, expected Binding) error
- func DecodeStrict(data []byte, value any) error
- func Digest(data []byte) string
- func IsHash(s string) bool
- func Match(q Query, msg proto.Message, typ string) []string
- func RecordJSON(msg proto.Message) (json.RawMessage, error)
- func Resolve(ctx context.Context, dir string, ref Reference) (json.RawMessage, error)
- func Scan(ctx context.Context, dir string, binding Binding, recordType string, ...) (string, error)
- func ValidateQuery(q Query) error
- func Walk(ctx context.Context, dir string, binding Binding, recordType string, ...) error
- type Binding
- type Catalogue
- type CataloguePage
- type CatalogueRequest
- type Coverage
- type Document
- type InspectRequest
- type LogReview
- type LogReviewRequest
- type Occurrence
- type OccurrencesRequest
- type Query
- type Reference
- type ResolveRequest
- type SafeLogLine
- type Source
- type SourceSelection
- type Workspace
- type WorkspaceRequest
Constants ¶
const MaxDecodedBytes int64 = 128 << 20
const MaxRecords = 100000
const ReviewedLogFile = "analyst-reviewed-log.json"
const WorkspaceFile = "analyst-workspace.json"
const WorkspaceLockFile = ".analyst-workspace.lock"
Variables ¶
var ErrBusy = errors.New("analyst workspace is leased; stale locks require explicit operator removal")
var ErrStale = errors.New("analyst evidence binding is stale")
Functions ¶
func AtomicJSON ¶
func CatalogueFields ¶
func CheckDiagnostic ¶
func DecodeStrict ¶
func RecordJSON ¶
func RecordJSON(msg proto.Message) (json.RawMessage, error)
func ValidateQuery ¶
func Walk ¶
func Walk(ctx context.Context, dir string, binding Binding, recordType string, visit func(Reference, proto.Message) error) error
Walk hashes the stored audit file and each original protobuf frame. A callback result must not be published until Walk succeeds and file/generation checks finish.
Types ¶
type Binding ¶
type Catalogue ¶
type Catalogue struct {
SnapshotSHA256 string `json:"snapshotSHA256,omitempty"`
TotalOccurrences int `json:"totalOccurrences"`
NextOffset *int `json:"nextOffset,omitempty"`
Version int `json:"version"`
Query Query `json:"query"`
Sources []Source `json:"sources"`
Coverage []Coverage `json:"coverage"`
Occurrences []Occurrence `json:"occurrences"`
Novelty string `json:"novelty"`
Limitations []string `json:"limitations"`
}
type CataloguePage ¶
type CatalogueRequest ¶
type CatalogueRequest struct {
Page *CataloguePage `json:"page,omitempty"`
ExpectedSnapshotSHA256 string `json:"expectedSnapshotSHA256,omitempty"`
Sources []SourceSelection `json:"sources"`
Query Query `json:"query"`
}
type Coverage ¶
type Coverage struct {
FileSHA256 string `json:"fileSHA256,omitempty"`
SourceID string `json:"sourceId"`
Binding Binding `json:"binding"`
Type string `json:"type"`
State string `json:"state"`
Records int `json:"records"`
QualifiedRecords int `json:"qualifiedRecords"`
UnqualifiedRecords int `json:"unqualifiedRecords"`
}
type Document ¶
type Document struct {
CatalogueSnapshotSHA256 string `json:"catalogueSnapshotSHA256,omitempty"`
IncludedSources []SourceSelection `json:"includedSources"`
ID string `json:"id"`
Revision int `json:"revision"`
Kind string `json:"kind"`
Title string `json:"title"`
Body string `json:"body"`
Binding Binding `json:"binding"`
Query *Query `json:"query,omitempty"`
References []Reference `json:"references"`
Review string `json:"review"`
Reviewer string `json:"reviewer,omitempty"`
UpdatedAt string `json:"updatedAt"`
}
type InspectRequest ¶
type InspectRequest struct {
Source SourceSelection `json:"source"`
}
type LogReview ¶
type LogReview struct {
Version int `json:"version"`
Binding Binding `json:"binding"`
File string `json:"file"`
FileSHA256 string `json:"fileSHA256"`
Start int `json:"start"`
End int `json:"end"`
Lines []SafeLogLine `json:"lines"`
ProjectionSHA256 string `json:"projectionSHA256"`
State string `json:"state"`
}
func PreviewLog ¶
type LogReviewRequest ¶
type LogReviewRequest struct {
Source SourceSelection `json:"source"`
File string `json:"file"`
Start int `json:"start"`
End int `json:"end"`
Approve *LogReview `json:"approve,omitempty"`
}
type Occurrence ¶
type OccurrencesRequest ¶
type OccurrencesRequest struct {
Source SourceSelection `json:"source"`
Type string `json:"type"`
}
type ResolveRequest ¶
type ResolveRequest struct {
Source SourceSelection `json:"source"`
Reference Reference `json:"reference"`
}
type SafeLogLine ¶
type SourceSelection ¶
type SourceSelection struct {
SessionID string `json:"sessionId,omitempty"`
InputFile string `json:"inputFile,omitempty"`
Binding Binding `json:"binding"`
}
SourceSelection never permits an implicit active-capture fallback.
type Workspace ¶
type WorkspaceRequest ¶
type WorkspaceRequest struct {
Source SourceSelection `json:"source"`
Document *Document `json:"document,omitempty"`
ExpectedRevision int `json:"expectedRevision"`
}