disk

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage represents disk storage.

func New

func New(m monitor.Monitor) *Storage

New creates a new disk-backed storage which internally uses badger KV.

func Open

func Open(dir string, name string, monitor monitor.Monitor, options config.Badger) *Storage

Open creates a disk storage and open the directory

func (*Storage) Append

func (s *Storage) Append(key key.Key, value []byte, ttl time.Duration) error

Append adds an event into the storage.

func (*Storage) Close

func (s *Storage) Close() error

Close is used to gracefully close the connection.

func (*Storage) Delete

func (s *Storage) Delete(keys ...key.Key) error

Delete deletes one or multiple keys from the storage.

func (*Storage) GC

func (s *Storage) GC(ctx context.Context) (interface{}, error)

GC runs the garbage collection on the storage

func (*Storage) Open

func (s *Storage) Open(dir string, options config.Badger) error

Open opens a directory.

func (*Storage) Range

func (s *Storage) Range(seek, until key.Key, f func(key, value []byte) bool) error

Range performs a range query against the storage. It calls f sequentially for each key and value present in the store. If f returns false, range stops the iteration. The API is designed to be very similar to the concurrent map. The implementation must guarantee that the keys are lexigraphically sorted.

Jump to

Keyboard shortcuts

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