Documentation ¶
Index ¶
- type Stash
- func (s *Stash) Clear()
- func (s *Stash) Clone(ctx context.Context, key cas.Key, typ string, level uint8, size uint32) (cas.Key, *chunks.Chunk, error)
- func (s *Stash) Drop(key cas.Key)
- func (s *Stash) Get(ctx context.Context, key cas.Key, typ string, level uint8) (*chunks.Chunk, error)
- func (s *Stash) Save(ctx context.Context, key cas.Key) (cas.Key, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stash ¶
type Stash struct {
// contains filtered or unexported fields
}
Stash is a proxy for a chunks.Store, but it keeps Private Keys local, only saving them to the Store when Save is called.
func (*Stash) Clear ¶
func (s *Stash) Clear()
Clear drops all the Private chunks held in this Stash. This is useful e.g. when the contents of a Blob are completely rewritten.
func (*Stash) Clone ¶
func (s *Stash) Clone(ctx context.Context, key cas.Key, typ string, level uint8, size uint32) (cas.Key, *chunks.Chunk, error)
Clone is like Get but clones the chunk if it's not already private. Chunks that are already private are returned as-is.
A cloned chunk will have a buffer of size bytes. This is intended to use for re-inflating zero-trimmed chunks.
Modifying the returned chunk *will* cause the locally stored data to change. This is the intended usage of a stash.
func (*Stash) Drop ¶
Drop forgets a Private chunk. The key may be reused, so caller must not remember the old key.
func (*Stash) Get ¶
func (s *Stash) Get(ctx context.Context, key cas.Key, typ string, level uint8) (*chunks.Chunk, error)
Get returns a chunk either from the local stash, or from the Store (for Private keys).
For Private keys, modifying the returned chunk *will* cause the locally stored data to change. This is the intended usage of a stash.