Documentation
¶
Overview ¶
Package sourceartifact stores immutable Project analysis source on local disk.
Index ¶
- Variables
- type Store
- func (s *Store) Capture(ctx context.Context, tenantID, projectID shared.ID, ...) (projectanalysis.SourceCapture, error)
- func (s *Store) CaptureBase(ctx context.Context, tenantID, projectID shared.ID, analysisID string, ...) (projectanalysis.SourceManifest, error)
- func (s *Store) CleanupExpired(_ context.Context, before time.Time) error
- func (s *Store) DeleteAnalysis(_ context.Context, tenantID, projectID shared.ID, analysisID string) error
- func (s *Store) DeleteProject(_ context.Context, tenantID, projectID shared.ID) error
- func (s *Store) DiscardPublished(ctx context.Context, tenantID, projectID shared.ID, analysisID string) error
- func (s *Store) Load(ctx context.Context, tenantID, projectID shared.ID, analysisID, path string) ([]byte, projectanalysis.SourceFile, error)
- func (s *Store) LoadBase(ctx context.Context, tenantID, projectID shared.ID, analysisID, path string) ([]byte, projectanalysis.SourceFile, error)
- func (s *Store) PublishArchive(ctx context.Context, tenantID, projectID shared.ID, analysisID string, ...) (projectanalysis.SourceCapture, error)
- func (s *Store) SetRetention(retention time.Duration)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotRetained = projectanalysis.ErrSourceNotRetained ErrIntegrity = projectanalysis.ErrSourceIntegrity )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Capture ¶
func (s *Store) Capture(ctx context.Context, tenantID, projectID shared.ID, analysisID, sourceDir string) (projectanalysis.SourceCapture, error)
func (*Store) CaptureBase ¶
func (s *Store) CaptureBase(ctx context.Context, tenantID, projectID shared.ID, analysisID string, files map[string][]byte) (projectanalysis.SourceManifest, error)
CaptureBase stores only the base-side files selected by the normalized Git diff. It is independent from the head capture so deleted files remain renderable later.
func (*Store) CleanupExpired ¶
func (*Store) DeleteAnalysis ¶
func (*Store) DeleteProject ¶
func (*Store) DiscardPublished ¶
func (s *Store) DiscardPublished(ctx context.Context, tenantID, projectID shared.ID, analysisID string) error
DiscardPublished removes only the v2 directory claimed by PublishArchive. It is used as a compensation action when the subsequent analysis+audit transaction fails; legacy capture locations are deliberately untouched.
func (*Store) Load ¶
func (s *Store) Load(ctx context.Context, tenantID, projectID shared.ID, analysisID, path string) ([]byte, projectanalysis.SourceFile, error)
func (*Store) LoadBase ¶
func (s *Store) LoadBase(ctx context.Context, tenantID, projectID shared.ID, analysisID, path string) ([]byte, projectanalysis.SourceFile, error)
func (*Store) PublishArchive ¶
func (s *Store) PublishArchive(ctx context.Context, tenantID, projectID shared.ID, analysisID string, writer projectanalysis.SourceWriter, allowedPaths []string, src io.Reader) (projectanalysis.SourceCapture, error)
PublishArchive consumes an untrusted tar stream into the server-owned artifact namespace. The destination directory is claimed with an atomic mkdir, so a second publisher can never replace an existing snapshot. manifest.json is written last and the use case attaches the manifest to the analysis only after this method returns successfully.
func (*Store) SetRetention ¶
SetRetention makes retention a write-path invariant, not merely a startup task. A non-positive duration disables age-based cleanup.