blobs

package
v0.0.0-...-83edfdb Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlobNotFound = errors.New("the specified blob does not exist")

ErrBlobNotFound indicates that the requested blob did not exit

Functions

This section is empty.

Types

type Blob

type Blob struct {
	ID          string `json:"blob_id,omitempty"`
	ContentType string `json:"content_type,omitempty"`
	Length      int64  `json:"length,omitempty"`
}

Blob encapsulates details of a blob in a remote store

type Server

type Server struct {
	Engine *gin.Engine
	// contains filtered or unexported fields
}

Server encapsulates the blob server

func NewFromEngine

func NewFromEngine(store Store, engine *gin.Engine) *Server

NewFromEngine creates a new blob service from an existing gin engine

type Store

type Store interface {
	// Read Read a blob from a BlobDatum from the store
	Read(prefix string, blobID string) (io.Reader, error)

	// Create creates a new blob object associated with a given graph
	Create(prefix string, contentType string, content io.Reader) (*Blob, error)
}

Store is an abstraction for user data persistence user data is a pure blob with no semantics

func NewInMemBlobStore

func NewInMemBlobStore() Store

NewInMemBlobStore creates an in-mem blob store - use this _only_ for testing - it will eat ur RAMz

func NewSQLBlobStore

func NewSQLBlobStore(db *sqlx.DB) (Store, error)

NewSQLBlobStore creates a new blob store on the given DB , the DB should already have tables in place

Jump to

Keyboard shortcuts

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