graph

package
v1.10.11 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	From NodeID
	To   NodeID
	Type string // "contains", "references", etc.
}

type EntityType

type EntityType string
const (
	EntitySnapshot    EntityType = "snapshot"
	EntityLogicalFile EntityType = "logical_file"
	EntityChunk       EntityType = "chunk"
	EntityContainer   EntityType = "container"
)

type GCRootOptions

type GCRootOptions struct {
	ExcludeSnapshots []string
}

GCRootOptions configures root collection for GC mark traversal.

type NodeID

type NodeID struct {
	Type EntityType
	ID   int64
	SID  string
}

func (NodeID) SnapshotID

func (n NodeID) SnapshotID() string

type Service

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

func NewService

func NewService(db *sql.DB) *Service

func (*Service) CurrentLogicalFileRoots

func (s *Service) CurrentLogicalFileRoots(ctx context.Context) ([]NodeID, error)

CurrentLogicalFileRoots returns logical-file roots from the current repository state (physical_file table).

func (*Service) GCRoots

func (s *Service) GCRoots(ctx context.Context, opts GCRootOptions) ([]NodeID, error)

GCRoots returns the full GC root set: current logical files plus snapshot logical files, with optional snapshot exclusions.

func (*Service) GetOutgoing

func (s *Service) GetOutgoing(ctx context.Context, n NodeID) ([]NodeID, error)

func (*Service) GetReachableChunks

func (s *Service) GetReachableChunks(ctx context.Context, snapshotIDs []string) (map[int64]struct{}, error)

func (*Service) GetReverseReferences

func (s *Service) GetReverseReferences(ctx context.Context, target NodeID) ([]NodeID, error)

func (*Service) ReachableChunksFromRoots

func (s *Service) ReachableChunksFromRoots(ctx context.Context, roots []NodeID) (map[int64]struct{}, error)

ReachableChunksFromRoots traverses the graph from arbitrary roots and returns all reachable chunk IDs.

func (*Service) ReachableChunksFromRootsWithOptions

func (s *Service) ReachableChunksFromRootsWithOptions(ctx context.Context, roots []NodeID, opts TraversalOptions) (map[int64]struct{}, error)

func (*Service) SnapshotRoots

func (s *Service) SnapshotRoots(ctx context.Context, excludeSnapshotIDs []string) ([]NodeID, error)

SnapshotRoots returns logical-file roots retained by snapshots, excluding any snapshot IDs explicitly listed in excludeSnapshotIDs.

func (*Service) Traverse

func (s *Service) Traverse(
	ctx context.Context,
	start []NodeID,
	visit func(NodeID) error,
) error

func (*Service) TraverseWithOptions

func (s *Service) TraverseWithOptions(
	ctx context.Context,
	start []NodeID,
	visit func(NodeID) error,
	opts TraversalOptions,
) error

type TraceEvent

type TraceEvent struct {
	Step     string
	Node     NodeID
	Message  string
	Metadata map[string]any
}

type TraceFunc

type TraceFunc func(TraceEvent)

type TraversalOptions

type TraversalOptions struct {
	Trace TraceFunc
}

Jump to

Keyboard shortcuts

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