memory

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package memory provides a deterministic process-local lease store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store keeps fenced leases in memory for tests and single-process tools.

func New

func New() *Store

New constructs an empty memory lease store.

func (*Store) Acquire

func (store *Store) Acquire(
	ctx context.Context,
	key string,
	owner string,
	ttl time.Duration,
	now time.Time,
) (lease.Lease, error)

Acquire creates or takes over an expired lease.

func (*Store) Capabilities

func (*Store) Capabilities() lease.Capabilities

Capabilities reports the memory store's safety properties.

func (*Store) Heartbeat

func (store *Store) Heartbeat(
	ctx context.Context,
	owned lease.Lease,
	ttl time.Duration,
	now time.Time,
) (lease.Lease, error)

Heartbeat extends a lease held by its current owner.

func (*Store) Inspect

func (store *Store) Inspect(ctx context.Context, key string) (lease.Lease, error)

Inspect returns the current lease for a key.

func (*Store) Recover

func (store *Store) Recover(ctx context.Context, key string, fencingToken uint64) error

Recover removes a lease only when its observed fencing token still matches.

func (*Store) Release

func (store *Store) Release(ctx context.Context, owned lease.Lease) error

Release removes a lease only when ownership still matches.

Jump to

Keyboard shortcuts

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