gc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector performs background garbage collection on storage data.

func NewCollector

func NewCollector(store storage.Backend, cfg *config.Config) *Collector

NewCollector creates a new garbage collector.

func (*Collector) RunAll

func (c *Collector) RunAll(ctx context.Context) *GCResults

RunAll runs all garbage collection tasks immediately. This is useful for manual/CLI invocations.

func (*Collector) RunContextHistoryCleanup

func (c *Collector) RunContextHistoryCleanup(ctx context.Context) int64

RunContextHistoryCleanup removes old context version history entries.

func (*Collector) RunConversationCleanup

func (c *Collector) RunConversationCleanup(ctx context.Context) int64

RunConversationCleanup removes old conversations based on retention policy.

func (*Collector) RunEntityPruning

func (c *Collector) RunEntityPruning(ctx context.Context) int64

RunEntityPruning removes stale entities based on retention policy.

func (*Collector) RunOrphanedChunkCleanup

func (c *Collector) RunOrphanedChunkCleanup(ctx context.Context) int64

RunOrphanedChunkCleanup removes chunks whose parent documents no longer exist.

func (*Collector) RunRunContextCleanup

func (c *Collector) RunRunContextCleanup(ctx context.Context) int64

RunRunContextCleanup removes old run-scoped context entries.

func (*Collector) RunTTLCleanup

func (c *Collector) RunTTLCleanup(ctx context.Context) int64

RunTTLCleanup removes context entries past their TTL expiration. This runs more frequently than the main GC cycle.

func (*Collector) Start

func (c *Collector) Start()

Start begins the background garbage collection goroutines.

func (*Collector) Stop

func (c *Collector) Stop()

Stop gracefully stops the garbage collector.

type GCResults

type GCResults struct {
	ExpiredTTL        int64
	OldConversations  int64
	StaleEntities     int64
	OrphanedChunks    int64
	OldContextHistory int64
	OldRunContext     int64
}

GCResults holds the results of a garbage collection run.

Jump to

Keyboard shortcuts

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