sharedstore

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package sharedstore implements ext.SharedStore, the key/value store core hands to extensions, on the gateway's configured storage backend.

Index

Constants

View Source
const SweepInterval = time.Hour

SweepInterval is how often expired entries are deleted. Reads already hide them, so the sweep only bounds the table's size.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store validates calls, hides closed generations, and sweeps expired entries in front of a backend.

func New

func New(ctx context.Context, shared storage.Storage) (*Store, error)

New opens the shared store on the gateway's storage connection and starts the expiry sweep. Close stops the sweep; the connection stays owned by the storage layer.

func (*Store) Close

func (s *Store) Close() error

Close stops the sweep and fails every later call with ext.ErrSharedStoreClosed, so an extension still holding this generation's store never reaches a closed connection.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, namespace, key string) error

Delete removes key.

func (*Store) Get

func (s *Store) Get(ctx context.Context, namespace, key string) ([]byte, bool, error)

Get returns the live value under key.

func (*Store) List

func (s *Store) List(ctx context.Context, namespace string) ([]ext.SharedEntry, error)

List returns every live entry of namespace.

func (*Store) Put

func (s *Store) Put(ctx context.Context, namespace, key string, value []byte, expiresAt time.Time) error

Put stores value under key until expiresAt (zero: until deleted). A non-zero expiresAt that is not in the future deletes the entry.

Jump to

Keyboard shortcuts

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