blob

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 14 Imported by: 4

Documentation

Overview

Package blob is used to read/write data from blob stores.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist = errors.New("not exist")

ErrNotExist is the error returned when attempting to query blob data that does not exist.

Functions

This section is empty.

Types

type Bucket

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

The Bucket type represents a bucket of blob data that can be arbitrarily written to and read using a key.

func OpenBucket

func OpenBucket(ctx context.Context, dsn string) (*Bucket, error)

OpenBucket opens the bucket identified by the URL given.

func (*Bucket) Close

func (bkt *Bucket) Close() error

Close the connection to the bucket.

func (*Bucket) Delete

func (bkt *Bucket) Delete(ctx context.Context, key string) error

Delete deletes the blob stored at key. Returns ErrNotExist if the key does not exist.

func (*Bucket) NewRangeReader

func (bkt *Bucket) NewRangeReader(ctx context.Context, key string, offset, length int64) (*Reader, error)

NewRangeReader returns a Reader to read content from the blob stored at key from one offset to a certain number of bytes.

func (*Bucket) NewReader

func (bkt *Bucket) NewReader(ctx context.Context, key string) (*Reader, error)

NewReader returns a Reader to read content from the blob stored at key.

func (*Bucket) NewWriter

func (bkt *Bucket) NewWriter(ctx context.Context, key string) (*Writer, error)

NewWriter returns a Writer that writes to the blob stored at key.

func (*Bucket) Ping

func (bkt *Bucket) Ping() error

Ping is a basic check to ensure the connection to the bucket is healthy.

type Reader

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

The Reader type is able to read blob data for a desired key. It is instrumented to write spans to the tracer when blob data is read.

func (*Reader) Close

func (r *Reader) Close() error

Close the blob reader, this will finish the traced span.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read implements io.Reader (https://golang.org/pkg/io/#Reader).

type Writer

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

The Writer type is able to write blob data for a desired key. It is instrumented to write spans to the tracer when blob data is written.

func (*Writer) Close

func (w *Writer) Close() error

Close the blob writer.

func (*Writer) ReadFrom

func (w *Writer) ReadFrom(r io.Reader) (int64, error)

ReadFrom reads from r and writes to w until EOF or error. The return value is the number of bytes read from r.

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Write the bytes in p to the blob store.

Jump to

Keyboard shortcuts

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