blob

package
v0.0.0-...-ec69b9d Latest Latest
Warning

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

Go to latest
Published: May 1, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sha1Digest

func Sha1Digest(r io.Reader) string

Sha1Digest calculates the sha1 digest for the io.Reader

Types

type Driver

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

func New

func New(crate_url string) (*Driver, error)

New creates a new connection with crate server

func (*Driver) GetTable

func (d *Driver) GetTable(name string) (*Table, error)

Get an existing table from the crate server or error when this table does not exist

func (*Driver) NewTable

func (d *Driver) NewTable(name string, shards ...int) (*Table, error)

NewTable create new blob table with name and extra int to specify shards(the second argument) and replicas(by the third int argument)

type Record

type Record struct {
	Digest       string
	LastModified time.Time
}

type Table

type Table struct {
	Name string
	// contains filtered or unexported fields
}

func (*Table) Delete

func (t *Table) Delete(digest string) error

Delete a blob in a blob table with the specific digest

func (*Table) Download

func (t *Table) Download(digest string) (io.ReadCloser, error)

Download a blob in a blob table with the specific digest

func (*Table) Drop

func (t *Table) Drop() error

Drop the blob table

func (*Table) Has

func (t *Table) Has(digest string) (bool, error)

Is the blob specified by the digest exist in the table

func (*Table) List

func (t *Table) List() (*sql.Rows, error)

List all blobs inside a blob table

func (*Table) Upload

func (t *Table) Upload(digest string, r io.Reader) (*Record, error)

Upload upload the blob(r) with sha1 hash(digest)

func (*Table) UploadEx

func (t *Table) UploadEx(r io.ReadSeeker) (*Record, error)

UploadEx upload a io.ReadSeeker, and computes the sha1 hash automatically

Jump to

Keyboard shortcuts

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