storeBadger

package
v0.5.1-0...-982e324 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CName = fileblockstore.CName
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Badger

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

Badger implements a block store using BadgerDB. It provides persistent storage of content-addressed blocks with indexing support. Was thinking about sqlite, but it may hard to backup and restore one big file. A few drawbacks - no concurrent writes, not sure that needed.

func New

func New(path string) *Badger

func (*Badger) Add

func (b *Badger) Add(ctx context.Context, bs []blocks.Block) error

func (*Badger) Close

func (b *Badger) Close(ctx context.Context) error

func (*Badger) Delete

func (b *Badger) Delete(ctx context.Context, c cid.Cid) error

func (*Badger) DeleteMany

func (b *Badger) DeleteMany(ctx context.Context, toDelete []cid.Cid) error

func (*Badger) Get

func (b *Badger) Get(ctx context.Context, k cid.Cid) (blocks.Block, error)

func (*Badger) GetMany

func (b *Badger) GetMany(ctx context.Context, ks []cid.Cid) <-chan blocks.Block

func (*Badger) IndexGet

func (b *Badger) IndexGet(ctx context.Context, key string) (value []byte, err error)

func (*Badger) IndexPut

func (b *Badger) IndexPut(ctx context.Context, key string, value []byte) error

IndexPut stores a value in the index with the given key.

func (*Badger) Init

func (b *Badger) Init(a *app.App) error

func (*Badger) Name

func (b *Badger) Name() string

func (*Badger) Run

func (b *Badger) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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