registry

package
v0.2.2-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEntryNotFound should be returned when a registry key does not exist
	// in the registry.
	ErrEntryNotFound = errors.New("entry not found")

	// ErrNotEnoughSpace should be returned when the registry is full and
	// there is no more space to store a new entry.
	ErrNotEnoughSpace = errors.New("not enough space")
)

Functions

This section is empty.

Types

type Manager

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

A Manager manages registry entries stored in a RegistryStore.

func NewManager

func NewManager(privkey types.PrivateKey, store Store, log *zap.Logger) *Manager

NewManager returns a new registry manager.

func (*Manager) Close

func (r *Manager) Close() error

Close closes the registry store.

func (*Manager) Entries

func (r *Manager) Entries() (count uint64, total uint64, err error)

Entries returns the current and maximum number of entries the registry can hold.

func (*Manager) Get

func (r *Manager) Get(key rhp3.RegistryKey) (value rhp3.RegistryValue, err error)

Get returns the registry value for the provided key.

func (*Manager) Put

func (r *Manager) Put(entry rhp3.RegistryEntry, expirationHeight uint64) (rhp3.RegistryValue, error)

Put creates or updates the registry value for the provided key. If err is nil the new value is returned, otherwise the previous value is returned.

type Store

type Store interface {
	// GetRegistryValue returns the registry value for the given key. If the key is not
	// found should return ErrEntryNotFound.
	GetRegistryValue(key rhp3.RegistryKey) (entry rhp3.RegistryValue, _ error)
	// SetRegistryValue sets the registry value for the given key. If the
	// value would exceed the maximum number of entries, should return
	// ErrNotEnoughSpace.
	SetRegistryValue(entry rhp3.RegistryEntry, expiration uint64) error
	// RegistryEntries returns the current number of entries as well as the
	// maximum number of entries the registry can hold.
	RegistryEntries() (count uint64, total uint64, err error)

	IncrementRegistryAccess(read, write uint64) error
}

A Store stores host registry entries. The registry is a key/value store for small data.

Jump to

Keyboard shortcuts

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