fsstore

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndMakeBasepath

func CheckAndMakeBasepath(basepath string) error

Types

type Store

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

Store is implements storage.ReadableStorage and storage.WritableStorage, as well as quite a few of the other extended storage feature interfaces, backing it with simple filesystem operations.

This implementation uses golang's usual `os` package for IO, so it should be highly portable.

Both the sharding and escaping functions are configurable, but a typical recommended setup is to use base32 encoding, and a sharding function that returns two shards of two characters each. The escaping and sharding functions should be chosen with regard to each other -- the sharding function is applied to the escaped form.

func (*Store) Get

func (store *Store) Get(ctx context.Context, key string) ([]byte, error)

Get implements go-ipld-prime/storage.ReadableStorage.Get.

func (*Store) GetStream

func (store *Store) GetStream(ctx context.Context, key string) (io.ReadCloser, error)

GetStream implements go-ipld-prime/storage.StreamingReadableStorage.GetStream.

func (*Store) Has

func (store *Store) Has(ctx context.Context, key string) (bool, error)

Has implements go-ipld-prime/storage.Storage.Has.

func (*Store) Init

func (store *Store) Init(
	basepath string,
	escapingFunc func(string) string,
	shardingFunc func(key string, shards *[]string),
) error

func (*Store) InitDefaults

func (store *Store) InitDefaults(basepath string) error

func (*Store) Put

func (store *Store) Put(ctx context.Context, key string, content []byte) error

Put implements go-ipld-prime/storage.WritableStorage.Put.

func (*Store) PutStream

func (store *Store) PutStream(ctx context.Context) (io.Writer, func(string) error, error)

PutStream implements go-ipld-prime/storage.StreamingWritableStorage.PutStream.

Jump to

Keyboard shortcuts

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