sourceartifact

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package sourceartifact stores immutable Project analysis source on local disk.

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New(root string, maxFileBytes int64, maxFiles int, maxBytes int64) *Store

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 (s *Store) CleanupExpired(_ context.Context, before time.Time) error

func (*Store) DeleteAnalysis

func (s *Store) DeleteAnalysis(_ context.Context, tenantID, projectID shared.ID, analysisID string) error

func (*Store) DeleteProject

func (s *Store) DeleteProject(_ context.Context, tenantID, projectID shared.ID) error

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

func (s *Store) SetRetention(retention time.Duration)

SetRetention makes retention a write-path invariant, not merely a startup task. A non-positive duration disables age-based cleanup.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL