b2fs

package module
v0.0.0-...-5e028bc Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 11 Imported by: 0

README

b2fs

A go-billy wrapper around backblaze b2 storage

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConcurrentReadWrite = errors.New("concurrent read/write not supported")
	ErrSeekOpenFile        = errors.New("cannot seek on open file")
)

Functions

This section is empty.

Types

type Client

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

func NewFromB2

func NewFromB2(client *b2.Client) *Client

func (*Client) NewFS

func (c *Client) NewFS(ctx context.Context, bucket string) (*FS, error)

NewFS creates a new filesystem for the given bucket.

type FS

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

func (*FS) Billy

func (f *FS) Billy() billy.Filesystem

Billy returns a billy.Filesystem for the given bucket. This automatically polyfills any missing interfaces.

func (*FS) Chroot

func (f *FS) Chroot(path string) (billy.Filesystem, error)

Chroot returns a new filesystem rooted at the given path.

func (*FS) Create

func (*FS) Create(filename string) (billy.File, error)

Create implements billy.Filesystem.

func (*FS) Join

func (*FS) Join(elem ...string) string

Join implements billy.Filesystem.

func (*FS) MkdirAll

func (f *FS) MkdirAll(filename string, perm fs.FileMode) error

MkdirAll implements billy.Filesystem.

func (*FS) Open

func (*FS) Open(filename string) (billy.File, error)

Open implements billy.Filesystem.

func (*FS) OpenFile

func (*FS) OpenFile(filename string, flag int, perm fs.FileMode) (billy.File, error)

OpenFile implements billy.Filesystem.

func (*FS) ReadDir

func (f *FS) ReadDir(path string) ([]fs.FileInfo, error)

ReadDir implements billy.Filesystem.

func (*FS) Remove

func (*FS) Remove(filename string) error

Remove implements billy.Filesystem.

func (*FS) Rename

func (*FS) Rename(oldpath string, newpath string) error

Rename implements billy.Filesystem.

func (*FS) Root

func (*FS) Root() string

Root implements billy.Filesystem.

func (*FS) Stat

func (*FS) Stat(filename string) (fs.FileInfo, error)

Stat implements billy.Filesystem.

type File

type File struct {
	b2.Object
	// contains filtered or unexported fields
}

func (*File) Close

func (f *File) Close() error

Close any open readers and writers. If you've opened a reader or writer, you must call Close() before it is garbage collected.

func (*File) Lock

func (*File) Lock() error

Lock is not supported by B2.

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

Read implements billy.File.

func (*File) ReadAt

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

ReadAt implements billy.File.

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

Seek implements billy.File.

func (*File) Truncate

func (*File) Truncate(size int64) error

Truncate implements billy.File.

func (*File) Unlock

func (*File) Unlock() error

Unlock is not supported by B2.

func (*File) Write

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

Write implements billy.File.

Jump to

Keyboard shortcuts

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