Documentation ¶
Index ¶
- type CStore
- func (cs *CStore) Bucket() *storage.BucketHandle
- func (cs *CStore) Client() *storage.Client
- func (cs *CStore) CopyFile(srcName string, destcs *CStore, dest string) error
- func (cs *CStore) CreateDownloadURL(minutes int, path string) (string, error)
- func (cs *CStore) DeleteCloudFile(fn string) error
- func (cs *CStore) DeleteOldFiles(path string, ageh int) (int, error)
- func (cs *CStore) DownloadFiles(files []string, dest string) error
- func (cs *CStore) FileExists(fn string) bool
- func (cs *CStore) GetFileInfo(path string) ([]storage.ObjectAttrs, error)
- func (cs *CStore) GetFileReader(fn string) (*storage.Reader, int64, error)
- func (cs *CStore) GetFiles(path string) ([]string, error)
- func (cs *CStore) GetFilesWithSuffix(path string, suffix string) ([]string, error)
- func (cs *CStore) GetFilteredFiles(path string, pf func(oa *storage.ObjectAttrs) bool) error
- func (cs *CStore) WriteCloudFile(fn string, content []byte, ftype string) error
- func (cs *CStore) WriteFile(fn string, content string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CStore ¶
type CStore struct {
// contains filtered or unexported fields
}
func NewCStore ¶
NewCStore - creates an object suitable for accessing a predefined Bucket in GCP Cloud Storage
func NewCStoreP ¶ added in v0.2.6
NewCStoreP - creates an object suitable for accessing a predefined Bucket in GCP Cloud Storage, assumes permissions exist, no credentials required note - it will reuse the default client for any subsequent calls.
func (*CStore) Bucket ¶ added in v0.2.11
func (cs *CStore) Bucket() *storage.BucketHandle
func (*CStore) CreateDownloadURL ¶
CreateDownloadURL - create a signed, time limited url to access the specified file https://cloud.google.com/storage/docs/access-control/signing-urls-manually https://cloud.google.com/storage/docs/authentication/canonical-requests
func (*CStore) DeleteCloudFile ¶
DeleteCloudFile -
func (*CStore) DeleteOldFiles ¶
DeleteOldFiles - delete all files within the specified path that are older than age in hours returns # files deleted. Will stop if an error occurs
func (*CStore) DownloadFiles ¶
DownloadFiles - assumes list of files contains folder names dest is local file path
func (*CStore) GetFileInfo ¶
func (cs *CStore) GetFileInfo(path string) ([]storage.ObjectAttrs, error)
GetFileInfo - returns slice of files within the bucket
func (*CStore) GetFileReader ¶
GetFileReader - remember to close the Reader after use. returns error if file not found second parameter is file size in bytes, if found
func (*CStore) GetFilesWithSuffix ¶
GetFilesWithSuffix - returns list of files from the the specified path where the file name ends with suffix
func (*CStore) GetFilteredFiles ¶
GetFilteredFiles - walk through the objects within specified path, passing each filename to a function continues as long as pf result is true
func (*CStore) WriteCloudFile ¶
WriteCloudFile - write data to a file in the google cloud fn is the dest filename/path content - what to write ftype is the Mime contentType