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: 6 Imported by: 0

Documentation

Overview

Package memory provides a deterministic process-local reference backend. It is not a distributed coordination backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Clock   lease.Clock
	MaxKeys uint32
}

Options bounds and configures the process-local reference backend.

type Store

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

Store is a deterministic, concurrency-safe reference backend.

func New

func New(options Options) (*Store, error)

New constructs a bounded process-local store.

func (*Store) Release

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

Release idempotently deactivates only the matching owner and token.

func (*Store) Renew

func (store *Store) Renew(
	ctx context.Context,
	owned lease.Record,
	ttl time.Duration,
) (lease.Record, error)

Renew extends a lease only while owner, token, and deadline remain current.

func (*Store) TryAcquire

func (store *Store) TryAcquire(
	ctx context.Context,
	key lease.Key,
	owner string,
	ttl time.Duration,
) (lease.Record, error)

TryAcquire acquires an absent, released, or expired lease.

func (*Store) Validate

func (store *Store) Validate(ctx context.Context, owned lease.Record) (lease.Record, error)

Validate proves that owner and token are current and unexpired.

Jump to

Keyboard shortcuts

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