boltstore

package
v0.2024.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package boltstore provides an implementation of history.Store with records stored in a bolthold database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromDb

func NewFromDb(ctx context.Context, db *bolthold.Store, source string, opts ...Option) (history.Store, error)

Types

type Option

type Option func(*Store)

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger is an option to set the logger used by the 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.

type Store

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

func (*Store) Append

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

func (Store) Len

func (s Store) Len(ctx context.Context) (int, error)

func (Store) Read

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

Read returns up to len(into) records, starting from the oldest record that is newer than from.

func (Store) Slice

func (s 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