var ( ErrNoBucketInName = errors.New("no bucket name found in the name") ErrFileClosed = errors.New("file is closed") ErrOutOfRange = errors.New("out of range") ErrObjectDoesNotExist = errors.New("storage: object doesn't exist") ErrEmptyObjectName = errors.New("storage: object name is empty") ErrFileNotFound = syscall.ENOENT )
func NewGcsFS(ctx context.Context, opts ...option.ClientOption) (afero.Fs, error)
NewGcsFS creates a GCS file system, automatically instantiating and decorating the storage client. You can provide additional options to be passed to the client creation, as per cloud.google.com/go/storage documentation
func NewGcsFSFromClient(ctx context.Context, client *storage.Client) (afero.Fs, error)
NewGcsFSFromClient creates a GCS file system from a given storage client
func NewGcsFSFromClientWithSeparator(ctx context.Context, client *storage.Client, folderSeparator string) (afero.Fs, error)
NewGcsFSFromClientWithSeparator is the same as NewGcsFSFromClient, but the file system will use the provided folder separator.
func NewGcsFSWithSeparator(ctx context.Context, folderSeparator string, opts ...option.ClientOption) (afero.Fs, error)
NewGcsFSWithSeparator is the same as NewGcsFS, but the files system will use the provided folder separator.
type ByName []*FileInfo
func (a ByName) Len() int
func (a ByName) Less(i, j int) bool
func (a ByName) Swap(i, j int)
type FileInfo struct {
// contains filtered or unexported fields
}
func (fi *FileInfo) IsDir() bool
func (fi *FileInfo) ModTime() time.Time
func (fi *FileInfo) Mode() os.FileMode
func (fi *FileInfo) Name() string
func (fi *FileInfo) Size() int64
func (fi *FileInfo) Sys() interface{}
Fs is a Fs implementation that uses functions provided by google cloud storage
type Fs struct {
// contains filtered or unexported fields
}
func NewGcsFs(ctx context.Context, client stiface.Client) *Fs
func NewGcsFsWithSeparator(ctx context.Context, client stiface.Client, folderSep string) *Fs
func (fs *Fs) Chmod(_ string, _ os.FileMode) error
func (fs *Fs) Chown(_ string, _, _ int) error
func (fs *Fs) Chtimes(_ string, _, _ time.Time) error
func (fs *Fs) Create(name string) (*GcsFile, error)
func (fs *Fs) Mkdir(name string, _ os.FileMode) error
func (fs *Fs) MkdirAll(path string, perm os.FileMode) error
func (fs *Fs) Name() string
func (fs *Fs) Open(name string) (*GcsFile, error)
func (fs *Fs) OpenFile(name string, flag int, fileMode os.FileMode) (*GcsFile, error)
func (fs *Fs) Remove(name string) error
func (fs *Fs) RemoveAll(path string) error
func (fs *Fs) Rename(oldName, newName string) error
func (fs *Fs) Stat(name string) (os.FileInfo, error)
GcsFs is the Afero version adapted for GCS
type GcsFile struct { ReadDirIt stiface.ObjectIterator // contains filtered or unexported fields }
func NewGcsFile( ctx context.Context, fs *Fs, obj stiface.ObjectHandle, openFlags int, fileMode os.FileMode, name string, ) *GcsFile
func NewGcsFileFromOldFH( openFlags int, fileMode os.FileMode, oldFile *gcsFileResource, ) *GcsFile
func (o *GcsFile) Close() error
func (o *GcsFile) Name() string
func (o *GcsFile) Read(p []byte) (n int, err error)
func (o *GcsFile) ReadAt(p []byte, off int64) (n int, err error)
func (o *GcsFile) Readdir(count int) ([]os.FileInfo, error)
func (o *GcsFile) Readdirnames(n int) ([]string, error)
func (o *GcsFile) Seek(newOffset int64, whence int) (int64, error)
func (o *GcsFile) Stat() (os.FileInfo, error)
func (o *GcsFile) Sync() error
func (o *GcsFile) Truncate(wantedSize int64) error
func (o *GcsFile) Write(p []byte) (n int, err error)
func (o *GcsFile) WriteAt(b []byte, off int64) (n int, err error)
func (o *GcsFile) WriteString(s string) (ret int, err error)
type GcsFs struct {
// contains filtered or unexported fields
}
func (fs *GcsFs) Chmod(name string, mode os.FileMode) error
func (fs *GcsFs) Chown(name string, uid, gid int) error
func (fs *GcsFs) Chtimes(name string, atime time.Time, mtime time.Time) error
func (fs *GcsFs) Create(name string) (afero.File, error)
func (fs *GcsFs) Mkdir(name string, perm os.FileMode) error
func (fs *GcsFs) MkdirAll(path string, perm os.FileMode) error
func (fs *GcsFs) Name() string
func (fs *GcsFs) Open(name string) (afero.File, error)
func (fs *GcsFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
func (fs *GcsFs) Remove(name string) error
func (fs *GcsFs) RemoveAll(path string) error
func (fs *GcsFs) Rename(oldname, newname string) error
func (fs *GcsFs) Stat(name string) (os.FileInfo, error)