sharedstore

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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