Documentation ¶
Overview ¶
Package google provides a Shade storage implementation for Google Drive.
You may optionally configure a FileParentID and ChunkParentID to indicate where to store the files and chunks. These values are Drive's alphanumeric unique identifiers for directories. You can find the ID for a directory in the URL when viewing the file in the Google Drive web UI. These can be set to the same value, and AppProperties will be used to disambiguate files from chunks
To store Files and Chunks as AppData storage, so that they are not visible in the Google Drive web UI, set FileParentID and ChunkParentID to 'appDataFolder'. You can optionally reduce the scope to only 'https://www.googleapis.com/auth/drive.appfolder'.
The following configuration values are not directly supported:
MaxFiles MaxChunkBytes RsaPublicKey RsaPrivateKey Children
To encrypt the contents written to Google Drive, wrap the configuration stanza with the github.com/asjoyner/shade/drive/encrypt package.
This package supports overriding all of the OAuth configuration parameters.
Index ¶
- func GetOAuthClient(c drive.Config) *http.Client
- func NewClient(c drive.Config) (drive.Client, error)
- type ChunkLister
- type Drive
- func (s *Drive) GetChunk(sha256sum []byte, file *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, content []byte, f *shade.File) error
- func (s *Drive) PutFile(sha256sum, content []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)
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 Google Drive.
func (*ChunkLister) Err ¶
func (c *ChunkLister) Err() error
Err returns the error encountered, if any.
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 represents access to the Google Drive storage system.
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 GetChunk() to retrieve the corresponding shade.File.
func (*Drive) NewChunkLister ¶
func (s *Drive) NewChunkLister() drive.ChunkLister
NewChunkLister returns an iterator which returns all chunks in Google Drive.
func (*Drive) Persistent ¶
Persistent returns whether the storage is persistent across task restarts.
func (*Drive) PutFile ¶
PutFile writes the metadata describing a new file. content should be marshalled JSON, and may be encrypted.
func (*Drive) ReleaseChunk ¶
ReleaseChunk removes a chunk file from Google Drive.
func (*Drive) ReleaseFile ¶
ReleaseFile removes a file from Google Drive.