needle

package
v0.0.0-...-f66ea8c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KvNeedleStoreCreator

func KvNeedleStoreCreator(kvCreator func(path string) (kv.Store, error)) func(path string) (Store, error)

Types

type Id

type Id uint64

func (*Id) Bytes

func (id *Id) Bytes() []byte

func (*Id) String

func (id *Id) String() string

type KvNeedleStore

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

func NewKvStore

func NewKvStore(kv kv.Store) (*KvNeedleStore, error)

func (*KvNeedleStore) Close

func (s *KvNeedleStore) Close() error

func (*KvNeedleStore) Delete

func (s *KvNeedleStore) Delete(id Id) error

func (*KvNeedleStore) Get

func (s *KvNeedleStore) Get(id Id) (*Needle, error)

func (*KvNeedleStore) Put

func (s *KvNeedleStore) Put(n *Needle) error

func (*KvNeedleStore) Size

func (s *KvNeedleStore) Size() uint64

type Needle

type Needle struct {
	Id
	Offset uint64
	Size   uint64
}

func FromBytes

func FromBytes(b []byte) (n *Needle, err error)

func (*Needle) ToBytes

func (n *Needle) ToBytes() []byte

type Store

type Store interface {
	Put(n *Needle) error
	Get(id Id) (*Needle, error)
	Delete(id Id) error
	Size() uint64
	Close() error
}

type StoreCreator

type StoreCreator func(path string) (Store, error)

Jump to

Keyboard shortcuts

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