storage

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeStorageBackend

func InitializeStorageBackend(ctx context.Context) (context.Context, error)

func SetStorageBackend

func SetStorageBackend(ctx context.Context, backend Backend) context.Context

Types

type Backend

type Backend interface {
	Metadata() MetadataBackend
	Checks() ChecksBackend
}

func MustGetBackend

func MustGetBackend(ctx context.Context) Backend

type Check

type Check struct {
	CheckCode   string         `json:"check_code"`
	CheckStatus CheckStatus    `json:"check_status"`
	Rationale   string         `json:"rationale"`
	Evidence    []string       `json:"evidence,omitempty"`
	Thresholds  map[string]any `json:"thresholds"`
}

type CheckStatus

type CheckStatus string
const (
	StatusCompliant CheckStatus = "compliant"
	StatusViolation CheckStatus = "violation"
	StatusSkipped   CheckStatus = "skipped"
)

func (CheckStatus) String

func (s CheckStatus) String() string

type ChecksBackend

type ChecksBackend interface {
	Get(ctx context.Context, analysisID string) (*ChecksInsertParams, error)
	Exists(ctx context.Context, analysisID string) (bool, error)
	Insert(ctx context.Context, params ChecksInsertParams) error
	GetBatch(ctx context.Context, analysisIDs []string) ([]*ChecksInsertParams, error)
	GetPolicy(ctx context.Context, analysisID string) (string, error)
}

type ChecksInsertParams

type ChecksInsertParams struct {
	Checks ChecksResult
	Policy *PolicyData
}

type ChecksResult

type ChecksResult struct {
	AnalysisIdentifier string                      `json:"analysis_identifier"`
	AppliedOverrides   []overrides.AppliedOverride `json:"applied_overrides,omitempty"`
	AnalyzedAt         *time.Time                  `json:"analyzed_at"`
	Checks             []Check                     `json:"checks"`
}

type FieldNotFoundError

type FieldNotFoundError struct {
	Field string
}

type FileBackend

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

func NewFileBackend

func NewFileBackend() *FileBackend

func (*FileBackend) Checks

func (f *FileBackend) Checks() ChecksBackend

func (*FileBackend) Metadata

func (f *FileBackend) Metadata() MetadataBackend

type MetadataBackend

type MetadataBackend interface {
	WriteAll(ctx context.Context, outputDir string, entries []executiondag.Entry, input dag_impl.Input) error
	Get(ctx context.Context, analysisID string, fields []string) (*MetadataResult, error)
}

type MetadataResult

type MetadataResult struct {
	AnalysisIdentifier string         `json:"analysis_identifier"`
	AnalyzedAt         time.Time      `json:"analyzed_at"`
	TraceID            string         `json:"trace_id,omitempty"`
	SourceURL          string         `json:"source_url,omitempty"`
	Ecosystem          string         `json:"ecosystem,omitempty"`
	PackageName        string         `json:"package_name,omitempty"`
	PackageVersion     string         `json:"package_version,omitempty"`
	Input              dag_impl.Input `json:"input"`
	Data               map[string]any `json:"data"`
}

type Outcomes

type Outcomes map[CheckStatus]string

Outcomes maps each check status to a description of what that result means.

type PolicyData

type PolicyData struct {
	Policy  any    `json:"policy,omitempty"`
	RawYAML string `json:"raw_yaml,omitempty"`
	Error   string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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