Help us shape the future of Go! Take the 2026 Go Developer Survey

refgraph

package
v0.57.27 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package refgraph stores the garbage collection ownership graph as plain records in a transactional key-value store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

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

Graph stores graph records in one transactional key/value namespace.

func NewGraph

func NewGraph(store kvtx.Store) *Graph

NewGraph constructs a graph over store.

func (*Graph) AddBlockRef

func (g *Graph) AddBlockRef(ctx context.Context, source, target *block.BlockRef) error

AddBlockRef preserves the collector's canonical block identity vocabulary.

func (*Graph) AddObjectRoot

func (g *Graph) AddObjectRoot(ctx context.Context, objectKey string, ref *block.BlockRef) error

AddObjectRoot links an object identity to its current content root.

func (*Graph) AddRef

func (g *Graph) AddRef(ctx context.Context, subject, object string) error

AddRef atomically inserts both edge directions and endpoint inventory records.

func (*Graph) AddRoot

func (g *Graph) AddRoot(ctx context.Context, node string) error

AddRoot records a permanent inventory entry and root membership atomically.

func (*Graph) ApplyRefBatch

func (g *Graph) ApplyRefBatch(
	ctx context.Context,
	adds, removes []block_gc.RefEdge,
) error

ApplyRefBatch commits a bounded ownership transition atomically. Larger transitions commit slices in add-before-remove order and report an exact uncommitted suffix if a later slice fails.

func (*Graph) Close

func (g *Graph) Close() error

Close leaves the shared volume engine's lifetime with its volume owner.

func (*Graph) GetIncomingRefs

func (g *Graph) GetIncomingRefs(ctx context.Context, node string) ([]string, error)

GetIncomingRefs returns all current owners of one complete target identity.

func (*Graph) GetOutgoingRefs

func (g *Graph) GetOutgoingRefs(ctx context.Context, node string) ([]string, error)

GetOutgoingRefs returns all current targets of one complete source identity.

func (*Graph) GetRootNodes

func (g *Graph) GetRootNodes(ctx context.Context) ([]string, error)

GetRootNodes supplies the collector's registered roots.

func (*Graph) GetUnreferencedNodes

func (g *Graph) GetUnreferencedNodes(ctx context.Context) ([]string, error)

GetUnreferencedNodes returns nodes tracked for collector reconsideration.

func (*Graph) HasIncomingRefs

func (g *Graph) HasIncomingRefs(ctx context.Context, node string) (bool, error)

HasIncomingRefs ignores the bookkeeping edge from the unreferenced root.

func (*Graph) HasIncomingRefsExcluding

func (g *Graph) HasIncomingRefsExcluding(ctx context.Context, node string, excluded ...string) (bool, error)

HasIncomingRefsExcluding stops at the first owner outside the caller's exclusions.

func (*Graph) IterateNodes

func (g *Graph) IterateNodes(ctx context.Context) ([]string, error)

IterateNodes supplies the explicit full node inventory requested by marking.

func (*Graph) RemoveNode

func (g *Graph) RemoveNode(ctx context.Context, node string) error

RemoveNode removes inventory after the collector has handled its edges.

func (*Graph) RemoveNodeRefs

func (g *Graph) RemoveNodeRefs(ctx context.Context, node string, markOrphaned bool) ([]string, error)

RemoveNodeRefs removes the observed outgoing targets in bounded transactions. New unrelated edges may be added after this operation's initial snapshot.

func (*Graph) RemoveObjectRoot

func (g *Graph) RemoveObjectRoot(ctx context.Context, objectKey string, ref *block.BlockRef) error

RemoveObjectRoot removes an exact object-to-block ownership edge.

func (*Graph) RemoveRef

func (g *Graph) RemoveRef(ctx context.Context, subject, object string) error

RemoveRef removes an exact edge without creating an orphan mark.

func (*Graph) RemoveRoot

func (g *Graph) RemoveRoot(ctx context.Context, node string) error

RemoveRoot removes root membership without changing the node's edges.

Jump to

Keyboard shortcuts

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