Documentation ¶
Overview ¶
Package local is a persistent local storage backend for Shade.
It stores files and chunks locally to disk. You may define full filepaths to store the files and chunks in the config, or via flag. If you define neither, the flags will choose sensible defaults for your operating system.
Index ¶
- func NewClient(c drive.Config) (drive.Client, error)
- type Chunk
- type Drive
- func (s *Drive) GetChunk(sha256sum []byte, f *shade.File) ([]byte, error)
- func (s *Drive) GetConfig() drive.Config
- func (s *Drive) GetFile(sha256sum []byte) ([]byte, error)
- func (s *Drive) ListFiles() ([][]byte, error)
- func (s *Drive) Local() bool
- func (s *Drive) Persistent() bool
- func (s *Drive) PutChunk(sha256sum []byte, data []byte, f *shade.File) error
- func (s *Drive) PutFile(sha256sum, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
Chunk describes an object cached to the filesystem, in a way that the btree implementaiton can sort it. This allows garbage collection by mtime.
type Drive ¶
type Drive struct { sync.RWMutex // serializes accesses to the directories on local disk // contains filtered or unexported fields }
Drive implements the drive.Client interface by storing Files and Chunks to the local filesystem. It treats the ChunkParentID and FileParentID as filepaths to the directory to store data in.
func (*Drive) ListFiles ¶
ListFiles retrieves all of the File objects known to the client. The return values are the sha256sum of the file object. The keys may be passed to GetChunk() to retrieve the corresponding shade.File.
func (*Drive) Persistent ¶
Persistent returns whether the storage is persistent across task restarts.