Documentation ¶
Index ¶
- func NewClient(c drive.Config) (drive.Client, error)
- type ChunkLister
- 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) NewChunkLister() drive.ChunkLister
- func (s *Drive) Persistent() bool
- func (s *Drive) PutChunk(sha256sum []byte, chunk []byte, f *shade.File) error
- func (s *Drive) PutFile(sha256sum, contents []byte) error
- func (s *Drive) ReleaseChunk(sha256sum []byte) error
- func (s *Drive) ReleaseFile(sha256sum []byte) error
- func (s *Drive) Warm(chunks [][]byte, f *shade.File)
- type Endpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChunkLister ¶
type ChunkLister struct {
// contains filtered or unexported fields
}
ChunkLister allows iterating the chunks in the Drive.
func (*ChunkLister) Err ¶
func (c *ChunkLister) Err() error
Err returns any error, if it is encountered.
func (*ChunkLister) Sha256 ¶
func (c *ChunkLister) Sha256() []byte
Sha256 returns the chunk pointed to by the pointer.
type Drive ¶
type Drive struct {
// contains filtered or unexported fields
}
Drive is a representation of the Amazon Cloud storage system.
func (*Drive) GetChunk ¶
GetChunk retrieves a chunk with a given SHA-256 sum. It first gets the ID of the chunk with the named sha256sum, possibly from a cache. If then fetches the contents of the chunk from Drive.
The cache is especially helpful for shade.File objects, which are efficiently looked up on each call of ListFiles.
func (*Drive) GetFile ¶
GetFile retrieves a file by sha256sum, as returned by ListFiles(). f should be marshalled JSON, and may be encrypted.
func (*Drive) ListFiles ¶
ListFiles retrieves all of the File objects known to the client, and returns the corresponding sha256sum of the file object. Those may be passed to GetFile() to retrieve the corresponding shade.File.
func (*Drive) NewChunkLister ¶
func (s *Drive) NewChunkLister() drive.ChunkLister
NewChunkLister returns an iterator which returns all chunks in Drive.
func (*Drive) Persistent ¶
Persistent returns whether the storage is persistent across task restarts.
func (*Drive) PutFile ¶
PutFile writes the manifest describing a new file. f should be marshalled JSON, and may be encrypted.
func (*Drive) ReleaseChunk ¶
ReleaseChunk removes a chunk file.
func (*Drive) ReleaseFile ¶
ReleaseFile removes a file.
type Endpoint ¶
Endpoint provides the URLs the drive service should talk to.
It provides threadsafe methods to get the Content and Metadata URLs, to lookup new ones, and to keep them persistently up to date.
func NewEndpoint ¶
NewEndpoint returns an initialized Endpoint, or an error.
func (*Endpoint) ContentURL ¶
func (*Endpoint) GetEndpoint ¶
GetEndpoint requests the URL for this user to send queries to.
func (*Endpoint) MetadataURL ¶
func (*Endpoint) RefreshEndpoint ¶
func (ep *Endpoint) RefreshEndpoint()
refreshEndpoint periodically calls GetEndpoint This needs to be run every 3-5 days, per: https://developer.amazon.com/public/apis/experience/cloud-drive/content/account
TODO(asjoyner): cache this, and save 1 RPC for every invocation of throw