...

Package gcsfs

import "github.com/spf13/afero/gcsfs"
Overview
Index

Overview ▾

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
    func (a ByName) Len() int
    func (a ByName) Less(i, j int) bool
    func (a ByName) Swap(i, j int)
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)

Package files

errors.go file.go file_info.go file_resource.go fs.go gcs.go gcs_mocks.go

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
)

func NewGcsFS

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

func NewGcsFSFromClient(ctx context.Context, client *storage.Client) (afero.Fs, error)

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.

type ByName

type ByName []*FileInfo

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type FileInfo

type FileInfo struct {
    // contains filtered or unexported fields
}

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (fi *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (fi *FileInfo) Name() string

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

func (*FileInfo) Sys

func (fi *FileInfo) Sys() interface{}

type Fs

Fs is a Fs implementation that uses functions provided by google cloud storage

type Fs struct {
    // contains filtered or unexported fields
}

func NewGcsFs

func NewGcsFs(ctx context.Context, client stiface.Client) *Fs

func NewGcsFsWithSeparator

func NewGcsFsWithSeparator(ctx context.Context, client stiface.Client, folderSep string) *Fs

func (*Fs) Chmod

func (fs *Fs) Chmod(_ string, _ os.FileMode) error

func (*Fs) Chown

func (fs *Fs) Chown(_ string, _, _ int) error

func (*Fs) Chtimes

func (fs *Fs) Chtimes(_ string, _, _ time.Time) error

func (*Fs) Create

func (fs *Fs) Create(name string) (*GcsFile, error)

func (*Fs) Mkdir

func (fs *Fs) Mkdir(name string, _ os.FileMode) error

func (*Fs) MkdirAll

func (fs *Fs) MkdirAll(path string, perm os.FileMode) error

func (*Fs) Name

func (fs *Fs) Name() string

func (*Fs) Open

func (fs *Fs) Open(name string) (*GcsFile, error)

func (*Fs) OpenFile

func (fs *Fs) OpenFile(name string, flag int, fileMode os.FileMode) (*GcsFile, error)

func (*Fs) Remove

func (fs *Fs) Remove(name string) error

func (*Fs) RemoveAll

func (fs *Fs) RemoveAll(path string) error

func (*Fs) Rename

func (fs *Fs) Rename(oldName, newName string) error

func (*Fs) Stat

func (fs *Fs) Stat(name string) (os.FileInfo, error)

type GcsFile

GcsFs is the Afero version adapted for GCS

type GcsFile struct {
    ReadDirIt stiface.ObjectIterator
    // contains filtered or unexported fields
}

func NewGcsFile

func NewGcsFile(
    ctx context.Context,
    fs *Fs,
    obj stiface.ObjectHandle,
    openFlags int,

    fileMode os.FileMode,
    name string,
) *GcsFile

func NewGcsFileFromOldFH

func NewGcsFileFromOldFH(
    openFlags int,
    fileMode os.FileMode,
    oldFile *gcsFileResource,
) *GcsFile

func (*GcsFile) Close

func (o *GcsFile) Close() error

func (*GcsFile) Name

func (o *GcsFile) Name() string

func (*GcsFile) Read

func (o *GcsFile) Read(p []byte) (n int, err error)

func (*GcsFile) ReadAt

func (o *GcsFile) ReadAt(p []byte, off int64) (n int, err error)

func (*GcsFile) Readdir

func (o *GcsFile) Readdir(count int) ([]os.FileInfo, error)

func (*GcsFile) Readdirnames

func (o *GcsFile) Readdirnames(n int) ([]string, error)

func (*GcsFile) Seek

func (o *GcsFile) Seek(newOffset int64, whence int) (int64, error)

func (*GcsFile) Stat

func (o *GcsFile) Stat() (os.FileInfo, error)

func (*GcsFile) Sync

func (o *GcsFile) Sync() error

func (*GcsFile) Truncate

func (o *GcsFile) Truncate(wantedSize int64) error

func (*GcsFile) Write

func (o *GcsFile) Write(p []byte) (n int, err error)

func (*GcsFile) WriteAt

func (o *GcsFile) WriteAt(b []byte, off int64) (n int, err error)

func (*GcsFile) WriteString

func (o *GcsFile) WriteString(s string) (ret int, err error)

type GcsFs

type GcsFs struct {
    // contains filtered or unexported fields
}

func (*GcsFs) Chmod

func (fs *GcsFs) Chmod(name string, mode os.FileMode) error

func (*GcsFs) Chown

func (fs *GcsFs) Chown(name string, uid, gid int) error

func (*GcsFs) Chtimes

func (fs *GcsFs) Chtimes(name string, atime time.Time, mtime time.Time) error

func (*GcsFs) Create

func (fs *GcsFs) Create(name string) (afero.File, error)

func (*GcsFs) Mkdir

func (fs *GcsFs) Mkdir(name string, perm os.FileMode) error

func (*GcsFs) MkdirAll

func (fs *GcsFs) MkdirAll(path string, perm os.FileMode) error

func (*GcsFs) Name

func (fs *GcsFs) Name() string

func (*GcsFs) Open

func (fs *GcsFs) Open(name string) (afero.File, error)

func (*GcsFs) OpenFile

func (fs *GcsFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

func (*GcsFs) Remove

func (fs *GcsFs) Remove(name string) error

func (*GcsFs) RemoveAll

func (fs *GcsFs) RemoveAll(path string) error

func (*GcsFs) Rename

func (fs *GcsFs) Rename(oldname, newname string) error

func (*GcsFs) Stat

func (fs *GcsFs) Stat(name string) (os.FileInfo, error)