Documentation ¶
Overview ¶
Package memory registers the "memory" blobserver storage type, storing blobs in an in-memory map.
Index ¶
- type Storage
- func (s *Storage) BlobContents(br blob.Ref) (contents string, ok bool)
- func (s *Storage) BlobrefStrings() []string
- func (s *Storage) EnumerateBlobs(ctx context.Context, dest chan<- blob.SizedRef, after string, limit int) error
- func (s *Storage) Fetch(ctx context.Context, ref blob.Ref) (file io.ReadCloser, size uint32, err error)
- func (s *Storage) NumBlobs() int
- func (s *Storage) ReceiveBlob(ctx context.Context, br blob.Ref, source io.Reader) (blob.SizedRef, error)
- func (s *Storage) RemoveBlobs(ctx context.Context, blobs []blob.Ref) error
- func (s *Storage) StatBlobs(ctx context.Context, blobs []blob.Ref, fn func(blob.SizedRef) error) error
- func (s *Storage) Stats() (blobsFetched, bytesFetched int64)
- func (s *Storage) StreamBlobs(ctx context.Context, dest chan<- blobserver.BlobAndToken, contToken string) error
- func (s *Storage) SubFetch(ctx context.Context, ref blob.Ref, offset, length int64) (io.ReadCloser, error)
- func (s *Storage) SumBlobSize() int64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is an in-memory implementation of the blobserver Storage interface. It also includes other convenience methods used by tests.
Its zero value is usable.
func NewCache ¶
NewCache returns a cache that won't store more than size bytes. Blobs are evicted in LRU order.
func (*Storage) BlobContents ¶
BlobContents returns as a string the contents of the blob br.
func (*Storage) BlobrefStrings ¶
BlobrefStrings returns the sorted stringified blobrefs stored in s.
func (*Storage) EnumerateBlobs ¶
func (*Storage) ReceiveBlob ¶
func (*Storage) RemoveBlobs ¶
func (*Storage) Stats ¶
Stats returns the number of blobs and number of bytes that were fetched from s.
func (*Storage) StreamBlobs ¶
func (s *Storage) StreamBlobs(ctx context.Context, dest chan<- blobserver.BlobAndToken, contToken string) error
func (*Storage) SumBlobSize ¶
SumBlobSize returns the total size in bytes of all the blobs in s.