Documentation ¶
Index ¶
- Variables
- type AccountingContentStore
- func (a *AccountingContentStore) AppendBlobContent(b *models.Blob, r io.Reader) (*models.Blob, error)
- func (a *AccountingContentStore) ContainsBlob(b *models.Blob) (bool, error)
- func (a *AccountingContentStore) DeleteBlobContent(b *models.Blob) error
- func (a *AccountingContentStore) EstimatedSizeOfManagedContent() (int64, error)
- func (a *AccountingContentStore) InsertBlobContent(b *models.Blob, position int64, r io.Reader) (*models.Blob, error)
- func (a *AccountingContentStore) RetrieveBlobContent(m *models.Blob, w io.Writer) (int64, error)
- func (a *AccountingContentStore) RetrieveURLForBlobContent(b *models.Blob) (string, error)
- func (a *AccountingContentStore) WriteBlobContent(b *models.Blob, r io.Reader) (*models.Blob, error)
- type BufferedRequestType
- type FileSystemContentStore
- func (s *FileSystemContentStore) AppendBlobContent(m *models.Blob, r io.Reader) (*models.Blob, error)
- func (s *FileSystemContentStore) ContainsBlob(m *models.Blob) (bool, error)
- func (s *FileSystemContentStore) DeleteBlobContent(m *models.Blob) error
- func (s *FileSystemContentStore) InsertBlobContent(m *models.Blob, offset int64, r io.Reader) (*models.Blob, error)
- func (s *FileSystemContentStore) RetrieveBlobContent(m *models.Blob, w io.Writer) (int64, error)
- func (s *FileSystemContentStore) RetrieveURLForBlobContent(m *models.Blob, r *mux.Router) (string, error)
- func (s *FileSystemContentStore) WriteBlobContent(m *models.Blob, r io.Reader) (*models.Blob, error)
- type NullContentStore
- func (n *NullContentStore) AppendBlobContent(*models.Blob, io.Reader) (*models.Blob, error)
- func (n *NullContentStore) ContainsBlob(m *models.Blob) (bool, error)
- func (n *NullContentStore) DeleteBlobContent(m *models.Blob) error
- func (n *NullContentStore) InsertBlobContent(*models.Blob, int64, io.Reader) (*models.Blob, error)
- func (n *NullContentStore) RetrieveBlobContent(blob *models.Blob, w io.Writer) (int64, error)
- func (n *NullContentStore) RetrieveURLForBlobContent(*models.Blob, *mux.Router) (string, error)
- func (n *NullContentStore) WriteBlobContent(*models.Blob, io.Reader) (*models.Blob, error)
- type ReadHeavyBufferedContentStore
- func (r *ReadHeavyBufferedContentStore) AppendBlobContent(m *models.Blob, ri io.Reader) (*models.Blob, int64, error)
- func (r *ReadHeavyBufferedContentStore) DeleteBlobContent(m *models.Blob) error
- func (r *ReadHeavyBufferedContentStore) InsertBlobContent(m *models.Blob, pos int64, ri io.Reader) (*models.Blob, int64, error)
- func (r *ReadHeavyBufferedContentStore) RetrieveBlobContent(m *models.Blob, w io.Writer) (int64, error)
- func (r *ReadHeavyBufferedContentStore) RetrieveURLForBlobContent(m *models.Blob, route *mux.Router) (string, error)
- func (r *ReadHeavyBufferedContentStore) WriteBlobContent(m *models.Blob, ri io.Reader) (*models.Blob, int64, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 (*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 (*FileSystemContentStore) RetrieveBlobContent ¶
func (*FileSystemContentStore) RetrieveURLForBlobContent ¶
func (*FileSystemContentStore) WriteBlobContent ¶
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 (*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 (*NullContentStore) RetrieveBlobContent ¶
func (*NullContentStore) RetrieveURLForBlobContent ¶
func (*NullContentStore) WriteBlobContent ¶
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.