Documentation
¶
Index ¶
- type BadgerStore
- func (s *BadgerStore) Begin() (ndn.Store, error)
- func (s *BadgerStore) Close() error
- func (s *BadgerStore) Commit() error
- func (s *BadgerStore) Get(name enc.Name, prefix bool) (wire []byte, err error)
- func (s *BadgerStore) Put(name enc.Name, wire []byte) error
- func (s *BadgerStore) Remove(name enc.Name) error
- func (s *BadgerStore) RemoveFlatRange(prefix enc.Name, first enc.Component, last enc.Component) error
- func (s *BadgerStore) RemovePrefix(prefix enc.Name) error
- func (s *BadgerStore) Rollback() error
- type MemoryFifoDir
- type MemoryStore
- func (s *MemoryStore) Begin() (ndn.Store, error)
- func (s *MemoryStore) Commit() error
- func (s *MemoryStore) Get(name enc.Name, prefix bool) ([]byte, error)
- func (s *MemoryStore) MemSize() int
- func (s *MemoryStore) Put(name enc.Name, wire []byte) error
- func (s *MemoryStore) Remove(name enc.Name) error
- func (s *MemoryStore) RemoveFlatRange(prefix enc.Name, first enc.Component, last enc.Component) error
- func (s *MemoryStore) RemovePrefix(prefix enc.Name) error
- func (s *MemoryStore) Rollback() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
Store implementation using badger
func NewBadgerStore ¶
func NewBadgerStore(path string) (*BadgerStore, error)
(AI GENERATED DESCRIPTION): Initializes a new BadgerStore by opening a Badger database at the specified path and returns the store or an error.
func (*BadgerStore) Begin ¶
func (s *BadgerStore) Begin() (ndn.Store, error)
(AI GENERATED DESCRIPTION): Starts a new write transaction on the BadgerStore and returns a store instance tied to that transaction, panicking if a transaction is already active.
func (*BadgerStore) Close ¶
func (s *BadgerStore) Close() error
(AI GENERATED DESCRIPTION): Closes the underlying Badger database of the store and returns any error.
func (*BadgerStore) Commit ¶
func (s *BadgerStore) Commit() error
(AI GENERATED DESCRIPTION): Commits the current BadgerDB transaction, writing all pending changes to the database and panicking if called when no write transaction is active.
func (*BadgerStore) Get ¶
(AI GENERATED DESCRIPTION): Retrieves a value from the Badger store by name, optionally returning the most recent entry that matches a given prefix, and panics if called while a write transaction is active.
func (*BadgerStore) Put ¶
func (s *BadgerStore) Put(name enc.Name, wire []byte) error
(AI GENERATED DESCRIPTION): Stores the supplied packet wire bytes under the key derived from the given name in the Badger database.
func (*BadgerStore) Remove ¶
func (s *BadgerStore) Remove(name enc.Name) error
(AI GENERATED DESCRIPTION): Deletes the record associated with the specified name from the BadgerStore.
func (*BadgerStore) RemoveFlatRange ¶
func (s *BadgerStore) RemoveFlatRange(prefix enc.Name, first enc.Component, last enc.Component) error
(AI GENERATED DESCRIPTION): Deletes all key‑value pairs in the Badger store whose keys fall within the flat name range between the specified first and last components for the given prefix.
func (*BadgerStore) RemovePrefix ¶
func (s *BadgerStore) RemovePrefix(prefix enc.Name) error
(AI GENERATED DESCRIPTION): Deletes all store entries whose keys begin with the given name prefix.
func (*BadgerStore) Rollback ¶
func (s *BadgerStore) Rollback() error
(AI GENERATED DESCRIPTION): Reverts any uncommitted changes in the current transaction by discarding it.
type MemoryFifoDir ¶
type MemoryFifoDir struct {
// contains filtered or unexported fields
}
MemoryFifoDir is a simple object directory that evicts the oldest name when it reaches its size size.
func NewMemoryFifoDir ¶
func NewMemoryFifoDir(size int) *MemoryFifoDir
NewMemoryFifoDir creates a new directory.
func (*MemoryFifoDir) Count ¶
func (d *MemoryFifoDir) Count() int
Count returns the number of names in the directory.
func (*MemoryFifoDir) Evict ¶
func (d *MemoryFifoDir) Evict(client ndn.Client) error
Evict removes old names from a client until it reaches the desired size.
func (*MemoryFifoDir) Pop ¶
func (d *MemoryFifoDir) Pop() enc.Name
Pop removes the oldest name from the directory and returns it. If the directory has not reached its size, it returns nil. It is recommended to use Evict() instead to remove objects from a client.
func (*MemoryFifoDir) Push ¶
func (d *MemoryFifoDir) Push(name enc.Name)
Push adds a name to the directory.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
(AI GENERATED DESCRIPTION): Creates a new MemoryStore instance initialized with an empty root node.
func (*MemoryStore) Begin ¶
func (s *MemoryStore) Begin() (ndn.Store, error)
(AI GENERATED DESCRIPTION): Begins a transaction on the MemoryStore by initializing a transaction node and locking the transaction mutex.
func (*MemoryStore) Commit ¶
func (s *MemoryStore) Commit() error
(AI GENERATED DESCRIPTION): Commits the pending transaction by merging its changes into the root store and clearing the transaction buffer.
func (*MemoryStore) Get ¶
(AI GENERATED DESCRIPTION): Retrieves the wire‑bytes for the packet named `name`; if `prefix` is true and the exact node has no stored data, it returns the newest descendant packet instead.
func (*MemoryStore) MemSize ¶
func (s *MemoryStore) MemSize() int
(AI GENERATED DESCRIPTION): Returns the total number of bytes used by all packets stored in the MemoryStore by summing the lengths of their wire-encoded representations.
func (*MemoryStore) Put ¶
func (s *MemoryStore) Put(name enc.Name, wire []byte) error
(AI GENERATED DESCRIPTION): Stores the given wire‑encoded data under the specified name in the memory store, using the active transaction if one exists, while protecting the operation with a mutex lock.
func (*MemoryStore) Remove ¶
func (s *MemoryStore) Remove(name enc.Name) error
(AI GENERATED DESCRIPTION): Removes the entry identified by the given name from the in‑memory store.
func (*MemoryStore) RemoveFlatRange ¶
func (s *MemoryStore) RemoveFlatRange(prefix enc.Name, first enc.Component, last enc.Component) error
(AI GENERATED DESCRIPTION): Removes all immediate (flat) child entries of the given prefix whose component keys fall within the inclusive range from `first` to `last`.
func (*MemoryStore) RemovePrefix ¶
func (s *MemoryStore) RemovePrefix(prefix enc.Name) error
(AI GENERATED DESCRIPTION): Removes all entries from the memory store whose names begin with the specified prefix.
func (*MemoryStore) Rollback ¶
func (s *MemoryStore) Rollback() error
(AI GENERATED DESCRIPTION): Reverts any active transaction by clearing the transaction state and releasing the transaction mutex.