Documentation
¶
Overview ¶
Package gcloudstorage provides convenience wrapper over cloud.google.com/go/storage.
Index ¶
- type Option
- type Storage
- func (s *Storage) Attributes(ctx context.Context, name string) (*storage.ObjectAttributes, error)
- func (s *Storage) Close() error
- func (s *Storage) DeleteFile(ctx context.Context, name string) error
- func (s *Storage) DownloadFileBytes(ctx context.Context, name string) ([]byte, error)
- func (s *Storage) DownloadFileReader(ctx context.Context, name string) (io.ReadCloser, error)
- func (s *Storage) DownloadRangeReader(ctx context.Context, name string, offset int64, length int64) (io.ReadCloser, error)
- func (s *Storage) Downloader(ctx context.Context, name string, size int64) io.ReadSeeker
- func (s *Storage) UpdateFile(ctx context.Context, name string, attrs storage.UpdateAttributes) error
- func (s *Storage) UploadFile(ctx context.Context, name string, r io.Reader) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v1.0.8
type Option func(*Storage)
func WithChunkSize ¶ added in v1.0.2
WithChunkSize limits the maximum chunk size used by storage.Writer
Note that retries are not supported for chunk size 0.
func WithTimeout ¶ added in v1.0.2
WithTimeout sets the timeout limit on inner contexts to prevent long requests from bloating goroutines scheduler.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a storage wrapper struct exposing methods that are useful for the caller.
func (*Storage) Attributes ¶
func (*Storage) Close ¶
Close closes the inner client
Note that inner client becomes useless after that.
func (*Storage) DeleteFile ¶
DeleteFile removes file from bucket storage.
func (*Storage) DownloadFileBytes ¶
DownloadFileBytes downloads the file using file name.
func (*Storage) DownloadFileReader ¶
DownloadFileReader creates full file download reader.
func (*Storage) DownloadRangeReader ¶
func (s *Storage) DownloadRangeReader( ctx context.Context, name string, offset int64, length int64, ) (io.ReadCloser, error)
DownloadRangeReader creates range file download reader.
func (*Storage) Downloader ¶
Downloader creates io.ReadSeeker.
Useful for serving files where full content download ahead of time is expensive (e.g. with [http.ServeContent]).
func (*Storage) UpdateFile ¶
func (s *Storage) UpdateFile( ctx context.Context, name string, attrs storage.UpdateAttributes, ) error
UpdateFile updates object attributes.