memstore

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package memstore provides an implementation of history.Store with records stored in memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetNow

func SetNow(s *Store, now func() time.Time) func()

Types

type Option

type Option func(*Store)

func WithMaxAge

func WithMaxAge(maxAge time.Duration) Option

WithMaxAge is an option to set the maximum age of records in the store.

func WithMaxCount

func WithMaxCount(maxCount int64) Option

WithMaxCount is an option to set the maximum number of records in the store.

func WithNow

func WithNow(now func() time.Time) Option

WithNow is an option to set where the store gets the current time from.

type Store

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

func New

func New(opts ...Option) *Store

func (*Store) Append

func (s *Store) Append(_ context.Context, payload []byte) (history.Record, error)

func (Store) Len

func (rs Store) Len(_ context.Context) (int, error)

func (Store) Read

func (rs Store) Read(_ context.Context, into []history.Record) (int, error)

func (Store) Slice

func (rs Store) Slice(from, to history.Record) history.Slice

Jump to

Keyboard shortcuts

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