package gcsfs
import "github.com/spf13/afero/gcsfs"
Index ¶
- Variables
- func NewGcsFS(ctx context.Context, opts ...option.ClientOption) (afero.Fs, error)
- func NewGcsFSFromClient(ctx context.Context, client *storage.Client) (afero.Fs, error)
- func NewGcsFSFromClientWithSeparator(ctx context.Context, client *storage.Client, folderSeparator string) (afero.Fs, error)
- func NewGcsFSWithSeparator(ctx context.Context, folderSeparator string, opts ...option.ClientOption) (afero.Fs, error)
- type ByName
- type FileInfo
- 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{}
- type Fs
- 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)
- type GcsFile
- 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
- 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)
Variables ¶
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 )
Functions ¶
func NewGcsFS ¶
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 ¶
NewGcsFSFromClient creates a GCS file system from a given storage client
func NewGcsFSFromClientWithSeparator ¶
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 ¶
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.
Types ¶
type ByName ¶
type ByName []*FileInfo
func (ByName) Len ¶
func (ByName) Less ¶
func (ByName) Swap ¶
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
func (*FileInfo) IsDir ¶
func (*FileInfo) ModTime ¶
func (*FileInfo) Mode ¶
func (*FileInfo) Name ¶
func (*FileInfo) Size ¶
func (*FileInfo) Sys ¶
func (fi *FileInfo) Sys() interface{}
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs is a Fs implementation that uses functions provided by google cloud storage
func NewGcsFs ¶
func NewGcsFsWithSeparator ¶
func (*Fs) Chmod ¶
func (*Fs) Chown ¶
func (*Fs) Chtimes ¶
func (*Fs) Create ¶
func (*Fs) Mkdir ¶
func (*Fs) MkdirAll ¶
func (*Fs) Name ¶
func (*Fs) Open ¶
func (*Fs) OpenFile ¶
func (*Fs) Remove ¶
func (*Fs) RemoveAll ¶
func (*Fs) Rename ¶
func (*Fs) Stat ¶
type GcsFile ¶
type GcsFile struct { ReadDirIt stiface.ObjectIterator // contains filtered or unexported fields }
GcsFs is the Afero version adapted for GCS
func NewGcsFile ¶
func NewGcsFile( ctx context.Context, fs *Fs, obj stiface.ObjectHandle, openFlags int, fileMode os.FileMode, name string, ) *GcsFile
func NewGcsFileFromOldFH ¶
func (*GcsFile) Close ¶
func (*GcsFile) Name ¶
func (*GcsFile) Read ¶
func (*GcsFile) ReadAt ¶
func (*GcsFile) Readdir ¶
func (*GcsFile) Readdirnames ¶
func (*GcsFile) Seek ¶
func (*GcsFile) Stat ¶
func (*GcsFile) Sync ¶
func (*GcsFile) Truncate ¶
func (*GcsFile) Write ¶
func (*GcsFile) WriteAt ¶
func (*GcsFile) WriteString ¶
type GcsFs ¶
type GcsFs struct {
// contains filtered or unexported fields
}
func (*GcsFs) Chmod ¶
func (*GcsFs) Chown ¶
func (*GcsFs) Chtimes ¶
func (*GcsFs) Create ¶
func (*GcsFs) Mkdir ¶
func (*GcsFs) MkdirAll ¶
func (*GcsFs) Name ¶
func (*GcsFs) Open ¶
func (*GcsFs) OpenFile ¶
func (*GcsFs) Remove ¶
func (*GcsFs) RemoveAll ¶
func (*GcsFs) Rename ¶
func (*GcsFs) Stat ¶
Source Files ¶
errors.go file.go file_info.go file_resource.go fs.go gcs.go gcs_mocks.go
Directories ¶
Path | Synopsis |
---|---|
gcsfs/internal |
- Version
- v1.12.0 (latest)
- Published
- Jan 9, 2025
- Platform
- linux/amd64
- Imports
- 17 packages
- Last checked
- 2 days ago –
Tools for package owners.