Documentation
¶
Overview ¶
Package evidence preserves finding evidence independently of disposable traffic.
Index ¶
- type Store
- func (s *Store) Bind(ctx context.Context, findingID int64, refs []db.TrafficRef) (out *db.FindingTraffic, err error)
- func (s *Store) Binding(ctx context.Context, findingID, bindingID int64) (db.FindingTrafficBinding, error)
- func (s *Store) Collect(ctx context.Context, now time.Time) error
- func (s *Store) CopySnapshots(ctx context.Context, snapshots []db.TrafficEvidenceSnapshot, dest string) error
- func (s *Store) InstallSnapshots(ctx context.Context, snapshots []db.TrafficEvidenceSnapshot, source string) error
- func (s *Store) OpenBody(snapshot db.TrafficEvidenceSnapshot, side string) (*os.File, int64, error)
- func (s *Store) Record(ctx context.Context, in db.RecordFindingInput, refs []db.TrafficRef) (out *db.RecordedFinding, err error)
- func (s *Store) RunGC(ctx context.Context)
- func (s *Store) StageFindingsExport(ctx context.Context, findings []*db.DBFinding, dest string, copyBodies bool) error
- func (s *Store) WithBinding(ctx context.Context, findingID, bindingID int64, ...) error
- func (s *Store) WithInstalledSnapshots(ctx context.Context, snapshots []db.TrafficEvidenceSnapshot, source string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
func (*Store) Bind ¶
func (s *Store) Bind(ctx context.Context, findingID int64, refs []db.TrafficRef) (out *db.FindingTraffic, err error)
func (*Store) Binding ¶
func (s *Store) Binding(ctx context.Context, findingID, bindingID int64) (db.FindingTrafficBinding, error)
Binding resolves one binding's metadata under the evidence lock and releases the lock before returning. Callers that then stream a body to a client must use this instead of WithBinding: verifyFile+io.Copy is O(body size), so a large download (or a slow client) holding WithEvidenceTx would block every evidence write process-wide. Reading the blob afterwards is safe — blobs are content-addressed and GC only reaps unreferenced files after a 24h grace period, and an already-open fd survives an unlink regardless.
func (*Store) CopySnapshots ¶
func (s *Store) CopySnapshots(ctx context.Context, snapshots []db.TrafficEvidenceSnapshot, dest string) error
CopySnapshots is used by both report downloads and portable task archives. The destination owns real copies, never links into either disposable store.
func (*Store) InstallSnapshots ¶
func (*Store) Record ¶
func (s *Store) Record(ctx context.Context, in db.RecordFindingInput, refs []db.TrafficRef) (out *db.RecordedFinding, err error)
func (*Store) StageFindingsExport ¶
func (s *Store) StageFindingsExport(ctx context.Context, findings []*db.DBFinding, dest string, copyBodies bool) error
StageFindingsExport freezes bindings/report versions and makes private body copies before the HTTP response is started. The caller owns and removes dest.
func (*Store) WithBinding ¶
func (*Store) WithInstalledSnapshots ¶
func (s *Store) WithInstalledSnapshots(ctx context.Context, snapshots []db.TrafficEvidenceSnapshot, source string, restore func() error) error
WithInstalledSnapshots pins installed bodies until the metadata restore finishes. The callback must not acquire another evidence advisory lock.