content

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: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotCachedError = errors.New("not in cache")

Functions

This section is empty.

Types

type AccountingContentStore

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

AccountingContentStore wraps another ContentStore, but adds tracking so that you can determine how much is stored there.

func CreateAccountingContentStore

func CreateAccountingContentStore(underlyingStore interfaces.EstimatableContentStore) (*AccountingContentStore, error)

CreateAccountingBlobStore returns a new AccountingBlobStore.

To track the amount of content stored, it needs to know how much is already present in the store, so it uses a contentStores's EstimateSizeOfManagedContent method to work that out. If an error occurs whilst calling this method, the size estimate is set to zero and the error is returned, alongside a functioning AccountingContentStore.

func (*AccountingContentStore) AppendBlobContent

func (a *AccountingContentStore) AppendBlobContent(b *models.Blob, r io.Reader) (*models.Blob, error)

AppendBlobContent appends content to a given Blob, if possible.

func (*AccountingContentStore) ContainsBlob

func (a *AccountingContentStore) ContainsBlob(b *models.Blob) (bool, error)

ContainsBlob returns whether the wrapped store contains this item.

func (*AccountingContentStore) DeleteBlobContent

func (a *AccountingContentStore) DeleteBlobContent(b *models.Blob) error

DeleteBlobContent removes the content from the underlying store.

func (*AccountingContentStore) EstimatedSizeOfManagedContent

func (a *AccountingContentStore) EstimatedSizeOfManagedContent() (int64, error)

EstimatedSizeOfManagedContent - return the estimate.

func (*AccountingContentStore) InsertBlobContent

func (a *AccountingContentStore) InsertBlobContent(b *models.Blob, position int64, r io.Reader) (*models.Blob, error)

InsertBlobContent inserts content at an arbitrary offset.

func (*AccountingContentStore) RetrieveBlobContent

func (a *AccountingContentStore) RetrieveBlobContent(m *models.Blob, w io.Writer) (int64, error)

RetrieveBlobContent retrieves the content of a Blob.

func (*AccountingContentStore) RetrieveURLForBlobContent

func (a *AccountingContentStore) RetrieveURLForBlobContent(b *models.Blob) (string, error)

RetrieveURLForBlobContent retrieves a URL from the underlying store.

func (*AccountingContentStore) WriteBlobContent

func (a *AccountingContentStore) WriteBlobContent(b *models.Blob, r io.Reader) (*models.Blob, error)

WriteBlobContent replaces or overwites the content of a given blob.

type BufferedRequestType

type BufferedRequestType int

type FileSystemContentStore

type FileSystemContentStore struct {
	PrefixPath string
}

FileSystemContentStore lives in a local directory on this machine.

func CreateStore

func CreateStore(staticDir string) (*FileSystemContentStore, error)

func (*FileSystemContentStore) AppendBlobContent

func (s *FileSystemContentStore) AppendBlobContent(m *models.Blob, r io.Reader) (*models.Blob, error)

func (*FileSystemContentStore) ContainsBlob

func (s *FileSystemContentStore) ContainsBlob(m *models.Blob) (bool, error)

func (*FileSystemContentStore) DeleteBlobContent

func (s *FileSystemContentStore) DeleteBlobContent(m *models.Blob) error

func (*FileSystemContentStore) InsertBlobContent

func (s *FileSystemContentStore) InsertBlobContent(m *models.Blob, offset int64, r io.Reader) (*models.Blob, error)

func (*FileSystemContentStore) RetrieveBlobContent

func (s *FileSystemContentStore) RetrieveBlobContent(m *models.Blob, w io.Writer) (int64, error)

func (*FileSystemContentStore) RetrieveURLForBlobContent

func (s *FileSystemContentStore) RetrieveURLForBlobContent(m *models.Blob, r *mux.Router) (string, error)

func (*FileSystemContentStore) WriteBlobContent

func (s *FileSystemContentStore) WriteBlobContent(m *models.Blob, r io.Reader) (*models.Blob, error)

type NullContentStore

type NullContentStore struct {
}

NullContentStore swallows all writes but does conform to the ContentStore interface. It's useful for when you're chaining things.

func (*NullContentStore) AppendBlobContent

func (n *NullContentStore) AppendBlobContent(*models.Blob, io.Reader) (*models.Blob, error)

func (*NullContentStore) ContainsBlob

func (n *NullContentStore) ContainsBlob(m *models.Blob) (bool, error)

func (*NullContentStore) DeleteBlobContent

func (n *NullContentStore) DeleteBlobContent(m *models.Blob) error

func (*NullContentStore) InsertBlobContent

func (n *NullContentStore) InsertBlobContent(*models.Blob, int64, io.Reader) (*models.Blob, error)

func (*NullContentStore) RetrieveBlobContent

func (n *NullContentStore) RetrieveBlobContent(blob *models.Blob, w io.Writer) (int64, error)

func (*NullContentStore) RetrieveURLForBlobContent

func (n *NullContentStore) RetrieveURLForBlobContent(*models.Blob, *mux.Router) (string, error)

func (*NullContentStore) WriteBlobContent

func (n *NullContentStore) WriteBlobContent(*models.Blob, io.Reader) (*models.Blob, error)

type ReadHeavyBufferedContentStore

type ReadHeavyBufferedContentStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ReadHeavyBufferedContentSTore is a ContentStore that writes to disk immediately, but also maintains a least-recently-used cache of file contents.

func (*ReadHeavyBufferedContentStore) AppendBlobContent

func (r *ReadHeavyBufferedContentStore) AppendBlobContent(m *models.Blob, ri io.Reader) (*models.Blob, int64, error)

AppendBlobContent dumps any current record from the cache and dispatches the write.

func (*ReadHeavyBufferedContentStore) DeleteBlobContent

func (r *ReadHeavyBufferedContentStore) DeleteBlobContent(m *models.Blob) error

DeleteBlobContent removes the selected blob from underlying storage and removes the blob from the cache too.

func (*ReadHeavyBufferedContentStore) InsertBlobContent

func (r *ReadHeavyBufferedContentStore) InsertBlobContent(m *models.Blob, pos int64, ri io.Reader) (*models.Blob, int64, error)

InsertBlobContent dumps any current record from the cache and dispatches the write.

func (*ReadHeavyBufferedContentStore) RetrieveBlobContent

func (r *ReadHeavyBufferedContentStore) RetrieveBlobContent(m *models.Blob, w io.Writer) (int64, error)

RetrieveBlobContent updates the last accessed time and generates a link.

func (*ReadHeavyBufferedContentStore) RetrieveURLForBlobContent

func (r *ReadHeavyBufferedContentStore) RetrieveURLForBlobContent(m *models.Blob, route *mux.Router) (string, error)

RetrieveURLForBlobContent update the last accessed time and generates a link.

func (*ReadHeavyBufferedContentStore) WriteBlobContent

func (r *ReadHeavyBufferedContentStore) WriteBlobContent(m *models.Blob, ri io.Reader) (*models.Blob, int64, error)

WriteBlobContent dumps any current record from the cache and dispatches the write to the store.

Jump to

Keyboard shortcuts

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