ladybug

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPebbleGraphMaxOpen = 16

Variables

View Source
var (
	ErrNodeNotFound         = errors.New("ladybug node not found")
	ErrRelationshipNotFound = errors.New("ladybug relationship not found")
)
View Source
var ErrLazyPebbleGraphClosing = errors.New("lazy pebble graph is closing")

Functions

func EscapeKey added in v0.3.0

func EscapeKey(value string) string

func NodePlanIndexKey added in v0.3.0

func NodePlanIndexKey(projectID string, label string, planID string, id string) string

NodePlanIndexKey is the composite plan_id secondary index key. It enables ListNodes(label, {project_id, plan_id}) to be a prefix scan instead of a full np: scan + Go post-filter. Critical for WorkTask queries where a plan has 14-17 tasks but the project has 1400+ — the scan drops from 1400 to 17.

func NodeStatusIndexKey added in v0.3.0

func NodeStatusIndexKey(projectID string, label string, status string, id string) string

NodeStatusIndexKey is the composite status secondary index key. It enables ListNodes(label, {project_id, status}) to be a prefix scan instead of a full np: scan + Go post-filter. Written/deleted alongside np: in the same batch, so status mutations atomically evict the old key and write the new one.

func NodeStorageKey added in v0.3.0

func NodeStorageKey(label string, id string) string

func PebbleGraphPath added in v0.1.10

func PebbleGraphPath(path string) string

func PrefixUpperBound added in v0.3.0

func PrefixUpperBound(prefix []byte) []byte

func ProjectNodeIndexKey added in v0.3.0

func ProjectNodeIndexKey(projectID string, label string, id string) string

Types

type BatchGraph

type BatchGraph interface {
	Batch(context.Context, func(Graph) error) error
}

type Graph

type Graph interface {
	Bootstrap(context.Context, schema.GraphSchema) error
	PutNode(context.Context, Node) error
	GetNode(context.Context, string, string) (Node, error)
	ListNodes(context.Context, string, map[string]string) ([]Node, error)
	DeleteNodes(context.Context, string, map[string]string) error
	DeleteDerivedFileNodes(context.Context, string, string) error
	PutRelationship(context.Context, Relationship) error
	ListRelationships(context.Context, string, RelationshipFilter) ([]Relationship, error)
}

type LazyPebbleGraph added in v0.1.10

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

func NewLazyPebbleGraph added in v0.1.10

func NewLazyPebbleGraph(path string, manager *PebbleGraphLRU) *LazyPebbleGraph

func (*LazyPebbleGraph) Batch added in v0.1.10

func (graph *LazyPebbleGraph) Batch(ctx context.Context, fn func(Graph) error) error

func (*LazyPebbleGraph) Bootstrap added in v0.1.10

func (graph *LazyPebbleGraph) Bootstrap(ctx context.Context, graphSchema schema.GraphSchema) error

func (*LazyPebbleGraph) Close added in v0.1.10

func (graph *LazyPebbleGraph) Close() error

func (*LazyPebbleGraph) DeleteDerivedFileNodes added in v0.1.10

func (graph *LazyPebbleGraph) DeleteDerivedFileNodes(ctx context.Context, projectID string, repoFileID string) error

func (*LazyPebbleGraph) DeleteNodes added in v0.1.10

func (graph *LazyPebbleGraph) DeleteNodes(ctx context.Context, label string, filter map[string]string) error

func (*LazyPebbleGraph) Diagnostics added in v0.1.10

func (graph *LazyPebbleGraph) Diagnostics() LazyPebbleGraphDiagnostics

func (*LazyPebbleGraph) GetNode added in v0.1.10

func (graph *LazyPebbleGraph) GetNode(ctx context.Context, label string, id string) (Node, error)

func (*LazyPebbleGraph) IsOpenForTest added in v0.1.10

func (graph *LazyPebbleGraph) IsOpenForTest() bool

func (*LazyPebbleGraph) ListNodes added in v0.1.10

func (graph *LazyPebbleGraph) ListNodes(ctx context.Context, label string, filter map[string]string) ([]Node, error)

func (*LazyPebbleGraph) ListRelationships added in v0.1.10

func (graph *LazyPebbleGraph) ListRelationships(ctx context.Context, relationshipType string, filter RelationshipFilter) ([]Relationship, error)

func (*LazyPebbleGraph) PutNode added in v0.1.10

func (graph *LazyPebbleGraph) PutNode(ctx context.Context, node Node) error

func (*LazyPebbleGraph) PutRelationship added in v0.1.10

func (graph *LazyPebbleGraph) PutRelationship(ctx context.Context, relationship Relationship) error

type LazyPebbleGraphDiagnostics added in v0.1.10

type LazyPebbleGraphDiagnostics struct {
	Open         bool `json:"open"`
	Leases       int  `json:"leases"`
	OpenTotal    int  `json:"open_total"`
	CloseTotal   int  `json:"close_total"`
	BlockedClose int  `json:"blocked_close"`
}

type MemoryGraph

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

func NewMemoryGraph

func NewMemoryGraph() *MemoryGraph

func (*MemoryGraph) Bootstrap

func (graph *MemoryGraph) Bootstrap(_ context.Context, graphSchema schema.GraphSchema) error

func (*MemoryGraph) DeleteDerivedFileNodes

func (graph *MemoryGraph) DeleteDerivedFileNodes(_ context.Context, projectID string, repoFileID string) error

func (*MemoryGraph) DeleteNodes

func (graph *MemoryGraph) DeleteNodes(_ context.Context, label string, filter map[string]string) error

func (*MemoryGraph) GetNode

func (graph *MemoryGraph) GetNode(_ context.Context, label string, id string) (Node, error)

func (*MemoryGraph) GetRelationship

func (graph *MemoryGraph) GetRelationship(_ context.Context, relationshipType string, from NodeRef, to NodeRef) (Relationship, error)

func (*MemoryGraph) ListNodes

func (graph *MemoryGraph) ListNodes(_ context.Context, label string, filter map[string]string) ([]Node, error)

func (*MemoryGraph) ListRelationships

func (graph *MemoryGraph) ListRelationships(_ context.Context, relationshipType string, filter RelationshipFilter) ([]Relationship, error)

func (*MemoryGraph) PutNode

func (graph *MemoryGraph) PutNode(_ context.Context, node Node) error

func (*MemoryGraph) PutRelationship

func (graph *MemoryGraph) PutRelationship(_ context.Context, relationship Relationship) error

func (*MemoryGraph) SchemaSnapshot

func (graph *MemoryGraph) SchemaSnapshot() schema.GraphSchema

type NativeRuntimeStatus

type NativeRuntimeStatus struct {
	Available bool
	Reason    string
}

func NativeStatus

func NativeStatus() NativeRuntimeStatus

type Node

type Node struct {
	Label      string
	ID         string
	Properties map[string]string
}

type NodeRef

type NodeRef struct {
	Label string
	ID    string
}

type PebbleGraph added in v0.1.10

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

func OpenPebbleGraph added in v0.1.10

func OpenPebbleGraph(path string) (*PebbleGraph, error)

func (*PebbleGraph) Batch added in v0.1.10

func (graph *PebbleGraph) Batch(ctx context.Context, fn func(Graph) error) error

func (*PebbleGraph) Bootstrap added in v0.1.10

func (graph *PebbleGraph) Bootstrap(ctx context.Context, graphSchema schema.GraphSchema) error

func (*PebbleGraph) Close added in v0.1.10

func (graph *PebbleGraph) Close() error

func (*PebbleGraph) DeleteDerivedFileNodes added in v0.1.10

func (graph *PebbleGraph) DeleteDerivedFileNodes(ctx context.Context, projectID string, repoFileID string) error

func (*PebbleGraph) DeleteNodes added in v0.1.10

func (graph *PebbleGraph) DeleteNodes(ctx context.Context, label string, filter map[string]string) error

func (*PebbleGraph) GetNode added in v0.1.10

func (graph *PebbleGraph) GetNode(ctx context.Context, label string, id string) (Node, error)

func (*PebbleGraph) ListNodes added in v0.1.10

func (graph *PebbleGraph) ListNodes(ctx context.Context, label string, filter map[string]string) ([]Node, error)

func (*PebbleGraph) ListRelationships added in v0.1.10

func (graph *PebbleGraph) ListRelationships(ctx context.Context, relationshipType string, filter RelationshipFilter) ([]Relationship, error)

func (*PebbleGraph) PutNode added in v0.1.10

func (graph *PebbleGraph) PutNode(ctx context.Context, node Node) error

func (*PebbleGraph) PutRelationship added in v0.1.10

func (graph *PebbleGraph) PutRelationship(ctx context.Context, relationship Relationship) error

type PebbleGraphLRU added in v0.1.10

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

func NewPebbleGraphLRU added in v0.1.10

func NewPebbleGraphLRU(maxOpen int) *PebbleGraphLRU

func (*PebbleGraphLRU) CloseAll added in v0.1.10

func (lru *PebbleGraphLRU) CloseAll() error

func (*PebbleGraphLRU) Diagnostics added in v0.1.10

func (lru *PebbleGraphLRU) Diagnostics() PebbleGraphLRUDiagnostics

type PebbleGraphLRUDiagnostics added in v0.1.10

type PebbleGraphLRUDiagnostics struct {
	MaxOpen      int `json:"max_open"`
	Tracked      int `json:"tracked"`
	Open         int `json:"open"`
	Leased       int `json:"leased"`
	IdleOpen     int `json:"idle_open"`
	OpenTotal    int `json:"open_total"`
	CloseTotal   int `json:"close_total"`
	BlockedClose int `json:"blocked_close"`
}

type PersistentGraph

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

func OpenPersistentGraph

func OpenPersistentGraph(path string) (*PersistentGraph, error)

func (*PersistentGraph) Batch

func (graph *PersistentGraph) Batch(ctx context.Context, fn func(Graph) error) error

func (*PersistentGraph) Bootstrap

func (graph *PersistentGraph) Bootstrap(ctx context.Context, graphSchema schema.GraphSchema) error

func (*PersistentGraph) DeleteDerivedFileNodes

func (graph *PersistentGraph) DeleteDerivedFileNodes(ctx context.Context, projectID string, repoFileID string) error

func (*PersistentGraph) DeleteNodes

func (graph *PersistentGraph) DeleteNodes(ctx context.Context, label string, filter map[string]string) error

func (*PersistentGraph) Diagnostics added in v0.1.10

func (graph *PersistentGraph) Diagnostics() PersistentGraphDiagnostics

func (*PersistentGraph) GetNode

func (graph *PersistentGraph) GetNode(ctx context.Context, label string, id string) (Node, error)

func (*PersistentGraph) GetRelationship

func (graph *PersistentGraph) GetRelationship(ctx context.Context, relationshipType string, from NodeRef, to NodeRef) (Relationship, error)

func (*PersistentGraph) ListNodes

func (graph *PersistentGraph) ListNodes(ctx context.Context, label string, filter map[string]string) ([]Node, error)

func (*PersistentGraph) ListRelationships

func (graph *PersistentGraph) ListRelationships(ctx context.Context, relationshipType string, filter RelationshipFilter) ([]Relationship, error)

func (*PersistentGraph) PutNode

func (graph *PersistentGraph) PutNode(ctx context.Context, node Node) error

func (*PersistentGraph) PutRelationship

func (graph *PersistentGraph) PutRelationship(ctx context.Context, relationship Relationship) error

func (*PersistentGraph) SchemaSnapshot

func (graph *PersistentGraph) SchemaSnapshot() schema.GraphSchema

type PersistentGraphDiagnostics added in v0.1.10

type PersistentGraphDiagnostics struct {
	IgnoredPartialJournalRecords int `json:"ignored_partial_journal_records"`
}

type Relationship

type Relationship struct {
	Type       string
	From       NodeRef
	To         NodeRef
	Properties map[string]string
}

type RelationshipFilter

type RelationshipFilter struct {
	From       *NodeRef
	To         *NodeRef
	Properties map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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