filesystem

package module
v0.0.0-...-ef104f6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindLocal     = "file"
	KindNFS       = "nfs"
	KindCFS       = "cfs"
	KindGlusterFS = "glusterfs"
	KindS3        = "s3"
)
View Source
const (
	ConfigHost        = "host"
	ConfigAk          = "ak"
	ConfigSk          = "sk"
	ConfigToken       = "token"
	ConfigRegion      = "region"
	ConfigDisableSSL  = "disableSSL"
	ConfigDisplayHost = "displayHost"
)
View Source
const (
	MaxKeys   = 1000
	Delimiter = "/"
)

Variables

This section is empty.

Functions

func CopyRaw

func CopyRaw(sourceBS, destBS BlobStore, sourcePath, destPath string) error

Types

type BlobMeta

type BlobMeta struct {
	// Name represents last level path
	Name string `json:"name"`
	// ContentType only provides in GetMeta when using s3, since only s3.HeadObject provides this field
	ContentType string `json:"contentType"`
	// Size use byte as unit
	Size int64 `json:"size"`
	// URLPath an accessible url using Path-style access
	URLPath string `json:"urlPath"`
	// LastModified last modified time the object.
	LastModified time.Time `json:"lastModified"`
}

type BlobStore

type BlobStore interface {
	// ListMeta recursively list all object metas
	ListMeta(path string, option ListMetaOption) ([]*BlobMeta, error)

	// GetMeta get meta from path
	GetMeta(path string) (*BlobMeta, error)

	// ReadRaw retrieves a byte stream from the blob store or an error
	ReadRaw(path string) (io.ReadCloser, error)

	// WriteRaw stores a raw byte stream
	WriteRaw(path string, in io.Reader) error

	// DeleteRaw delete the path
	DeleteRaw(path string) error

	GetSignedURL(path string, expire time.Duration) (string, error)

	BuildURL(path string) (string, error)
}

func NewBlobStore

func NewBlobStore(kind Kind, endpoint string, config map[string]string) (BlobStore, error)

type Kind

type Kind string

type ListMetaOption

type ListMetaOption struct {
	// support: s3/file
	DirectoryOnly bool
	// support: s3
	// CommonPrefix与Contents均会计入MaxKeys中,如果同时开启DirectoryOnly,与CommonPrefix同级目录下的object也计入MaxKeys中
	MaxKeys int64
	// support: s3
	StartAfter string
}

Jump to

Keyboard shortcuts

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