Documentation
¶
Overview ¶
Package provenance answers, at the moment an asset is written, which calls produced it.
It reads the audit log rather than keeping a buffer of its own. The audit log is already the platform's record of every call: it survives a restart, it is shared by every replica, and it holds what a buffer never did — the call's identifier, its stated purpose, how long it took, and whether it succeeded. A per-process map could answer none of that, and answered nothing at all for a session whose calls were served by another replica (issue #1320).
A capture is scoped to the caller: the default window is the caller's own session, and an explicitly cited source is resolved only among the caller's own calls. Nothing here can put another person's query into an asset.
Index ¶
Constants ¶
const ( // MaxCalls bounds how many calls one capture records. A capture is a // snapshot stored on the asset row, not a copy of the session. MaxCalls = 100 )
Variables ¶
This section is empty.
Functions ¶
func KindFor ¶
KindFor returns the provenance call kind for a toolkit kind, or "" when calls to that toolkit are not asset sources.
func SourceToolkitKinds ¶
func SourceToolkitKinds() []string
SourceToolkitKinds returns the toolkit kinds whose calls can be an asset's source. The call-reference middleware stamps exactly these calls with their own id, so what an agent can cite and what the platform captures by default are one rule rather than two lists that drift.
Types ¶
type Capturer ¶
type Capturer struct {
// contains filtered or unexported fields
}
Capturer builds an asset write's provenance capture from the audit log.
func New ¶
func New(events EventReader, flush Flusher) *Capturer
New builds a Capturer over the audit log. A nil reader yields a Capturer that records only what the caller states about itself, which is what a deployment with audit disabled gets. The flusher is optional: a synchronous audit writer has nothing to wait for.
func (*Capturer) Capture ¶
func (c *Capturer) Capture(ctx context.Context, req portal.ProvenanceRequest) portal.ProvenanceCapture
Capture resolves the calls behind one asset write.
It never fails the write: an unreadable audit log yields a capture holding only what the caller stated about itself, because an asset that records less provenance is better than an asset that could not be saved.
type EventReader ¶
type EventReader interface {
Query(ctx context.Context, filter audit.QueryFilter) ([]audit.Event, error)
}
EventReader reads recorded calls back out of the audit log.