blobs

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 11 Imported by: 0

README

fdb-blobs

PkgGoDev CI Go Report Card

WARNING - under construction :-)

A blob store for FoundationDB that handles arbitrary size blobs by splitting the data into chunks.

Tests

Start all the services:

docker compose up -d

Run all tests:

docker compose exec blobs go test

Run a specific test:

docker compose exec blobs go test -run TestCreate

Sending arguments to go test:

docker compose exec blobs go test -cover

Running fuzz tests:

docker compose exec blobs go test -fuzz FuzzChunkSizes

MIT License

Copyright (c) 2023 Sune Simonsen mailto:sune@we-knowhow.dk

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlobNotFoundError = errors.New("blob not found")

Functions

This section is empty.

Types

type BlobReader

type BlobReader interface {
	io.Reader
}

type BlobStore

type BlobStore interface {
	Read(cxt context.Context, id Id) ([]byte, error)
	Upload(ctx context.Context, r io.Reader) (UploadToken, error)
	CommitUpload(tr fdb.Transaction, uploadToken UploadToken) Id
	Create(ctx context.Context, r io.Reader) (Id, error)
	BlobReader(id Id) (BlobReader, error)
	Len(id Id) (uint64, error)
	CreatedAt(id Id) (time.Time, error)
}

func NewFdbStore

func NewFdbStore(db fdb.Database, ns string, opts ...Option) (BlobStore, error)

type Id added in v0.2.0

type Id string

func (Id) FDBKey added in v0.2.0

func (id Id) FDBKey() fdb.Key

type Option

type Option func(br *fdbBlobStore) error

func WithChunkSize

func WithChunkSize(chunkSize int) Option

func WithChunksPerTransaction

func WithChunksPerTransaction(chunksPerTransaction int) Option

type UploadToken added in v0.4.0

type UploadToken interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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