registry

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: AGPL-3.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 MemoryStore

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

MemoryStore is the in-memory implementation of RegistryStore. Uses a two-level map: entryKey → ResourceEntry for O(1) lookups, plus a connection index for O(entries-in-connection) bulk deletes.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(pluginID, connectionID, resourceKey, namespace, id string) (*ResourceEntry, bool)

func (*MemoryStore) DeleteByConnection

func (s *MemoryStore) DeleteByConnection(pluginID, connectionID string) []ResourceEntry

func (*MemoryStore) Get

func (s *MemoryStore) Get(pluginID, connectionID, resourceKey, namespace, id string) (*ResourceEntry, bool)

func (*MemoryStore) Put

func (s *MemoryStore) Put(entry ResourceEntry) (old *ResourceEntry, existed bool)

func (*MemoryStore) PutIfAbsent

func (s *MemoryStore) PutIfAbsent(entry ResourceEntry) (existing *ResourceEntry, loaded bool)

func (*MemoryStore) ScanByLabel

func (s *MemoryStore) ScanByLabel(pluginID, connectionID, resourceKey string, selector map[string]string) []ResourceEntry

func (*MemoryStore) ScanByResourceKey

func (s *MemoryStore) ScanByResourceKey(pluginID, connectionID, resourceKey string) []ResourceEntry

type RegistryStore

type RegistryStore interface {
	Put(entry ResourceEntry) (old *ResourceEntry, existed bool)
	// PutIfAbsent inserts the entry only if no entry with the same key exists.
	// Returns the existing entry and true if one was already present.
	PutIfAbsent(entry ResourceEntry) (existing *ResourceEntry, loaded bool)
	Get(pluginID, connectionID, resourceKey, namespace, id string) (*ResourceEntry, bool)
	Delete(pluginID, connectionID, resourceKey, namespace, id string) (*ResourceEntry, bool)
	DeleteByConnection(pluginID, connectionID string) []ResourceEntry
	ScanByLabel(pluginID, connectionID, resourceKey string, selector map[string]string) []ResourceEntry
	ScanByResourceKey(pluginID, connectionID, resourceKey string) []ResourceEntry
}

RegistryStore abstracts the storage backend for resource entries.

type ResourceEntry

type ResourceEntry struct {
	PluginID     string
	ConnectionID string
	ResourceKey  string            // e.g. "core::v1::Pod", "ec2::Instance"
	ID           string            // resource name/identifier
	Namespace    string            // scope within connection (empty if unscoped)
	UID          string            // dedup key
	Labels       map[string]string // for selector-based relationship resolution
	CreatedAt    time.Time
}

ResourceEntry is the lightweight metadata the engine stores per resource.

func (ResourceEntry) EntryKey

func (e ResourceEntry) EntryKey() string

EntryKey returns the unique key for this entry within the registry. Format: "pluginID/connectionID/resourceKey/namespace/id"

Jump to

Keyboard shortcuts

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