registry

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	UUID      string         `json:"uuid"`
	Metadata  map[string]any `json:"metadata,omitempty"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
}

Entry represents a registered UUID with its metadata

type Store

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

Store manages UUID registration with file-based persistence

func NewStore

func NewStore(dataPath string) (*Store, error)

NewStore creates a new registry store

func (*Store) Count

func (s *Store) Count() int

Count returns the number of registered entries

func (*Store) Create

func (s *Store) Create(uuid string, metadata map[string]any) (*Entry, error)

Create registers a new UUID. Returns error if duplicate.

func (*Store) Delete

func (s *Store) Delete(uuid string) error

Delete removes a registered entry

func (*Store) Exists

func (s *Store) Exists(uuid string) bool

Exists checks if a UUID is registered

func (*Store) FindOrCreate

func (s *Store) FindOrCreate(uuid string, metadata map[string]any) (*Entry, bool, error)

FindOrCreate returns existing entry or creates a new one

func (*Store) Get

func (s *Store) Get(uuid string) (*Entry, bool)

Get returns a registered entry by UUID

func (*Store) List

func (s *Store) List() []*Entry

List returns all registered entries

func (*Store) Update

func (s *Store) Update(oldUUID string, newUUID string, metadata map[string]any) (*Entry, error)

Update modifies a registered entry. UUID can change (must stay unique).

Jump to

Keyboard shortcuts

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