storage

package
v0.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2022 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

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

func NewCStore(cred []byte, bucketName string) (*CStore, error)

NewCStore - creates an object suitable for accessing a predefined Bucket in GCP Cloud Storage

func NewCStoreP added in v0.2.6

func NewCStoreP(bucketName string) (*CStore, error)

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) Client added in v0.2.11

func (cs *CStore) Client() *storage.Client

func (*CStore) CopyFile

func (cs *CStore) CopyFile(srcName string, destcs *CStore, dest string) error

CopyFile - from/to locations within the cloud

func (*CStore) CreateDownloadURL

func (cs *CStore) CreateDownloadURL(minutes int, path string) (string, error)

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

func (cs *CStore) DeleteCloudFile(fn string) error

DeleteCloudFile -

func (*CStore) DeleteOldFiles

func (cs *CStore) DeleteOldFiles(path string, ageh int) (int, error)

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

func (cs *CStore) DownloadFiles(files []string, dest string) error

DownloadFiles - assumes list of files contains folder names dest is local file path

func (*CStore) FileExists

func (cs *CStore) FileExists(fn string) bool

FileExists -

func (*CStore) GetFileInfo

func (cs *CStore) GetFileInfo(path string) ([]storage.ObjectAttrs, error)

GetFileInfo - returns slice of files within the bucket

func (*CStore) GetFileReader

func (cs *CStore) GetFileReader(fn string) (*storage.Reader, int64, error)

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) GetFiles

func (cs *CStore) GetFiles(path string) ([]string, error)

GetFiles - return list of files within specified bucket / path

func (*CStore) GetFilesWithSuffix

func (cs *CStore) GetFilesWithSuffix(path string, suffix string) ([]string, error)

GetFilesWithSuffix - returns list of files from the the specified path where the file name ends with suffix

func (*CStore) GetFilteredFiles

func (cs *CStore) GetFilteredFiles(path string, pf func(oa *storage.ObjectAttrs) bool) error

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

func (cs *CStore) WriteCloudFile(fn string, content []byte, ftype string) error

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

func (*CStore) WriteFile

func (cs *CStore) WriteFile(fn string, content string) error

WriteFile creates a text file in Google Cloud Storage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL