filab

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

README

filab

FILe ABstraction library

Documentation

Index

Constants

View Source
const DefaultProtoMaxSize = 10000000

Variables

This section is empty.

Functions

func Exist added in v1.0.0

func Exist(ctx context.Context, p Path) (bool, error)

func MaybeAddCompression

func MaybeAddCompression(file string, w io.WriteCloser) (io.WriteCloser, error)

func MaybeAddDecompression added in v1.0.0

func MaybeAddDecompression(file string, r io.ReadCloser) (io.ReadCloser, error)

func NewReader added in v1.0.0

func NewReader(ctx context.Context, p Path) (io.ReadCloser, error)

func NewWriter added in v1.0.0

func NewWriter(ctx context.Context, p Path) (io.WriteCloser, error)

func RegisterDriver added in v1.0.0

func RegisterDriver(driver StorageDriver) error

func Walk added in v1.0.0

func Walk(ctx context.Context, p Path, w WalkFunc)

Types

type DriverType added in v1.0.0

type DriverType *string

type FileStorage added in v1.0.0

type FileStorage interface {
	RegisterDriver(driver StorageDriver) error

	FileStoreBase

	MustParse(p string) Path

	NewReaderS(p Path) (io.ReadCloser, error)
	NewPbReaderS(p Path) (pbio.ReadCloser, error)

	NewWriterS(p Path) (io.WriteCloser, error)
	NewPbWriterS(p Path) (pbio.WriteCloser, error)
}

func DefaultFileStore added in v1.0.0

func DefaultFileStore() FileStorage

func New added in v1.0.0

func New() FileStorage

type FileStoreBase added in v1.0.0

type FileStoreBase interface {
	Parse(s string) (Path, error)
	Exist(context.Context, Path) (bool, error)
	Delete(context.Context, Path) error
	NewReader(context.Context, Path) (io.ReadCloser, error)
	NewWriter(context.Context, Path) (io.WriteCloser, error)
	List(context.Context, Path) ([]Path, error)
	Walk(context.Context, Path, WalkFunc) error
}

type Path added in v1.0.0

type Path interface {
	Join(p ...string) Path
	String() string
	Copy() Path
	Dir() Path
	Type() DriverType

	DirStr() string
	BaseStr() string
}

func List added in v1.0.0

func List(ctx context.Context, p Path) ([]Path, error)

func MustParse added in v1.0.0

func MustParse(s string) Path

func Parse added in v1.0.0

func Parse(s string) (Path, error)

type StorageDriver added in v1.0.0

type StorageDriver interface {
	Name() string
	Scheme() string
	Type() DriverType

	FileStoreBase
}

type WalkFunc added in v1.0.0

type WalkFunc func(p Path, err error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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