snapshot

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SnapshotCalculator

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

SnapshotCalculator handles the calculation and storage of vulnerability snapshots

func NewSnapshotCalculator

func NewSnapshotCalculator(kvStore store.KVStore) *SnapshotCalculator

NewSnapshotCalculator creates a new SnapshotCalculator instance

func (*SnapshotCalculator) CalculateSnapshot

func (sc *SnapshotCalculator) CalculateSnapshot(snapshotID string) (*store.VulnerabilitySnapshot, error)

CalculateSnapshot queries PostgreSQL and generates snapshot snapshotID can be empty (will auto-generate timestamp-based ID) or a specific ID

func (*SnapshotCalculator) SaveSnapshot

func (sc *SnapshotCalculator) SaveSnapshot(ctx context.Context, snapshot *store.VulnerabilitySnapshot) error

SaveSnapshot stores snapshot in Valkey

type SnapshotManager

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

SnapshotManager handles snapshot CRUD operations and lifecycle management

func NewSnapshotManager

func NewSnapshotManager(kvStore store.KVStore) *SnapshotManager

NewSnapshotManager creates a new SnapshotManager instance

func (*SnapshotManager) CleanupOldSnapshots

func (sm *SnapshotManager) CleanupOldSnapshots(ctx context.Context) error

CleanupOldSnapshots keeps only the 10 most recent snapshots

func (*SnapshotManager) CreateSnapshot

func (sm *SnapshotManager) CreateSnapshot(ctx context.Context, snapshotID string) (*store.VulnerabilitySnapshot, error)

CreateSnapshot generates and stores a new snapshot snapshotID can be empty (will auto-generate timestamp-based ID) or a specific ID

func (*SnapshotManager) GetLatestSnapshot

func (sm *SnapshotManager) GetLatestSnapshot(ctx context.Context) (*store.VulnerabilitySnapshot, error)

GetLatestSnapshot retrieves the most recent snapshot

func (*SnapshotManager) GetSnapshot

func (sm *SnapshotManager) GetSnapshot(ctx context.Context, snapshotID string) (*store.VulnerabilitySnapshot, error)

GetSnapshot retrieves a specific snapshot by snapshot ID

func (*SnapshotManager) GetTrendData

func (sm *SnapshotManager) GetTrendData(ctx context.Context, limit int) ([]*store.VulnerabilitySnapshot, error)

GetTrendData retrieves multiple snapshots for trend analysis Returns up to the specified number of most recent snapshots

func (*SnapshotManager) ListSnapshots

func (sm *SnapshotManager) ListSnapshots(ctx context.Context) ([]string, error)

ListSnapshots retrieves all available snapshot IDs

Jump to

Keyboard shortcuts

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