interfaces

package
v0.0.0-...-33abfaa Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlobContentConfigError = errors.New("bad store configuration")
View Source
var BlobContentNotFoundError = errors.New("blob content missing")
View Source
var BlobMetadataError = errors.New("blob metadata issue")
View Source
var MethodNotSupportedError = errors.New("method not supported")
View Source
var NoMatchingBlobsError = errors.New("no matching blobs")

Functions

This section is empty.

Types

type BlobStore

type BlobStore interface {

	// If false, this blob store doesn't contain the given blob,
	ContainsBlob(*models.Blob) (bool, error)

	// Removes the content associated with a blob.
	// If the content cannot be deleted, return an error and leave the
	// blob's content intact. Under no other circumstances should we
	// return an error.
	DeleteBlobContent(*models.Blob) error
	// Writes content associated with a blob
	// Updates metadata at the end.
	WriteBlobContent(*models.Blob, io.Reader) (*models.Blob, int64, error)
	// Writes content to the end of a blob
	AppendBlobContent(*models.Blob, io.Reader) (*models.Blob, int64, error)
	// Adds content at an arbitrary position within the file
	InsertBlobContent(*models.Blob, int64, io.Reader) (*models.Blob, int64, error)
	// Retrieves a URL to access the blob's content
	RetrieveURLForBlobContent(*models.Blob, *mux.Router) (string, error)
	// Retrieves a blob's content
	RetrieveBlobContent(*models.Blob, io.Writer) (int64, error)
}

type CombinedStore

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

CombinedStore takes a content store and metadata store and updates one after another. It complies the with the BlobStore interface

func CreateCombinedStore

func CreateCombinedStore(metadataStore MetadataStore, contentStore ContentStore) *CombinedStore

CreateCombinedStore combines a metadataStore and a contentStore together.

func (*CombinedStore) AppendBlobContent

func (c *CombinedStore) AppendBlobContent(b *models.Blob, reader io.Reader) (*models.Blob, int64, error)

func (*CombinedStore) DeleteBlobContent

func (c *CombinedStore) DeleteBlobContent(blob *models.Blob) error

DeleteBlobContent removes a file's content and metadata from Repositron

func (*CombinedStore) InsertBlobContent

func (c *CombinedStore) InsertBlobContent(b *models.Blob, offset int64, buf io.Reader) (*models.Blob, int64, error)

func (*CombinedStore) RetrieveBlobContent

func (c *CombinedStore) RetrieveBlobContent(b *models.Blob, w io.Writer) (int64, error)

func (*CombinedStore) RetrieveURLForBlobContent

func (c *CombinedStore) RetrieveURLForBlobContent(b *models.Blob, r *mux.Router) (string, error)

func (*CombinedStore) WriteBlobContent

func (c *CombinedStore) WriteBlobContent(b *models.Blob, in io.Reader) (*models.Blob, int64, error)

type ContentStore

type ContentStore interface {
	ContainsBlob(*models.Blob) (bool, error)

	// Removes the content associated with a blob
	DeleteBlobContent(*models.Blob) error
	// WriteBlobContent replaces or creates content associated with a record.
	// i.e. if the content doesn't exist, it's created,
	// if it does exist, it's overwritten by the new content.
	// The Size field of the models.Blob argument should be ignored
	// The size returned should be the size of what was written using
	// the io.Reader.
	WriteBlobContent(*models.Blob, io.Reader) (*models.Blob, error)
	// Writes content to the end of a blob
	AppendBlobContent(*models.Blob, io.Reader) (*models.Blob, error)
	// Adds content at an arbitrary position within the file
	InsertBlobContent(*models.Blob, int64, io.Reader) (*models.Blob, error)
	// Retrieves a URL to access the blob's content
	RetrieveURLForBlobContent(*models.Blob, *mux.Router) (string, error)
	// Retrieves a blob's content
	RetrieveBlobContent(*models.Blob, io.Writer) (int64, error)
}

ContentStore combines a separate MetadataStore and a BlobStore into something useful.

type EnumerableContentStore

type EnumerableContentStore interface {
	ContentStore
	// RetrieveAllBlobs retrieves details of all Blobs in this ContentStore,
	// starts writing it into a channel. Blocks until all elements are wrtten
	// to the output channel.
	RetrieveAllBlobs(out chan *models.Blob) error
}

type EstimatableContentStore

type EstimatableContentStore interface {
	ContentStore
	// EstimateSizeOfManagedContent returns a size estimate of the
	// amount of stuff managed in this contentStore.
	EstimateSizeOfManagedContent() (int64, error)
}

type MetadataStore

type MetadataStore interface {
	// StoreBlobRecord commit WIP metadata to the database, returns a new Blob
	StoreBlobRecord(blob *models.Blob) (*models.Blob, error)
	// FinalizeBlobRecord stores the final file size,
	FinalizeBlobRecord(blob *models.Blob) (*models.Blob, error)

	// EstimateSizeOfManagedContent returns an overall size estimate for the
	// amount of stuff stored in the database.
	EstimateSizeOfManagedContent() (int64, error)

	DeleteBlobById(id int64) error
	RetrieveBlobById(id int64) (*models.Blob, error)

	GetBlobIdsMatchingChecksum(checksum string) ([]int64, error)
	GetBlobIdsMatchingName(name string) ([]int64, error)
	GetBlobIdsMatchingBucket(name string) ([]int64, error)

	// Retrieves each distinct bucket name.
	GetAllBuckets() ([]string, error)

	Close() error
}

type SynchronizationStore

type SynchronizationStore interface {

	// Holds the requesting resource until the identified resource is available.
	// Returns an error if it's not possible.
	Lock(int64) error

	// Releases the hold on the resource.
	Unlock(int64) error
}

Jump to

Keyboard shortcuts

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