ufs

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBlockSize   = int64(64 * 1024 * 1024)
	DefaultReplication = 3
)
View Source
const (
	TypeFile      = 1 // type for regular file
	TypeDirectory = 2 // type for directory
)
View Source
const (
	Delimiter        = "/"
	MaxKeys          = 1000
	AwsDefaultRegion = "us-east-1"
	TmpPath          = "./tmp/pfs/"
	MaxFileSize      = 5 * 1024 * 1024 * 1024 * 1024 // s3: support upto 5 TiB file size
	// mpu
	MPURetryTimes   = 2
	MPUThreshold    = 200 * 1024 * 1024      // customized for performance
	MPUChunkSize    = 1 * 1024 * 1024 * 1024 // chunk size 1 GiB
	MPUMinPartSize  = 5 * 1024 * 1024        // s3: Each part must be at least 5 MB ~ 5 GB in size (except for the last part)
	MPUMaxPartSize  = 5 * 1024 * 1024 * 1024 // s3: Each part must be at least 5 MB ~ 5 GB in size (except for the last part)
	MPUMaxPartNum   = 10000                  // s3: between 1~10,000
	DefaultDirMode  = 0755
	DefaultFileMode = 0644
)
View Source
const GiB int64 = 1024 * 1024 * 1024
View Source
const (
	Krb5ConfTemplate = `` /* 238-byte string literal not displayed */

)
View Source
const MiB int64 = 1024 * 1024

Variables

View Source
var Group string
View Source
var Owner string

Functions

func IsSuccessOrBenignError

func IsSuccessOrBenignError(err error) bool

Returns true if err==nil or err is expected (benign) error which should be propagated directoy to the caller

func NewKerberosClientWithKeyTab

func NewKerberosClientWithKeyTab(kerberosConf *KerberosConf) (*krb.Client, error)

func RegisterUFS

func RegisterUFS(_type string, creator Creator)

Types

type Attr added in v0.14.3

type Attr struct {
	Type      uint8  // type of a node
	Mode      uint32 // permission mode
	Uid       uint32 // owner id
	Gid       uint32 // group id of owner
	Rdev      uint64 // device number
	Atime     int64  // last access time
	Mtime     int64  // last modified time
	Ctime     int64  // last change time for meta
	Atimensec uint32 // nanosecond part of atime
	Mtimensec uint32 // nanosecond part of mtime
	Ctimensec uint32 // nanosecond part of ctime
	Nlink     uint64 // number of links (sub-directories or hardlinks)
	Size      uint64 // size of regular file
	Blksize   int64  // 目录默认4096 文件为0
	Block     int64  // 文件size的大小/512
}

Attr represents attributes of a node.

type Creator

type Creator func(properties map[string]interface{}) (UnderFileStorage, error)

type DirEntry added in v0.14.3

type DirEntry struct {
	Attr *Attr
	// Name is the basename of the file in the directory.
	Name string
}

type FileHandle

type FileHandle interface {
	Read(dest []byte, off uint64) (int, error)
	Write(data []byte, off uint64) (written uint32, code error)

	// Flush is called for close() call on a file descriptor. In
	// case of duplicated descriptor, it may be called more than
	// once for a file.
	Flush() error

	// This is called to before the file handle is forgotten. This
	// method has no return value, so nothing can synchronizes on
	// the call. Any cleanup that requires specific synchronization or
	// could fail with I/O errors should happen in Flush instead.
	Release()
	Fsync(flags int) error

	// The methods below may be called on closed files, due to
	// concurrency.  In that case, you should return EBADF.
	Truncate(size uint64) error
	Allocate(off uint64, size uint64, mode uint32) error
}

type Ino added in v0.14.3

type Ino uint64

type KerberosConf

type KerberosConf struct {
	Realm                  string
	Kdc                    string
	Principal              string
	NameNodePrincipal      string
	DataTransferProtection string
	KeyTabData             string
}

type LocalFileSystem added in v0.14.6

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

func (*LocalFileSystem) Access added in v0.14.6

func (fs *LocalFileSystem) Access(name string, mode, callerUid, callerGid uint32) error

func (*LocalFileSystem) Chmod added in v0.14.6

func (fs *LocalFileSystem) Chmod(name string, mode uint32) error

These should update the file's ctime too.

func (*LocalFileSystem) Chown added in v0.14.6

func (fs *LocalFileSystem) Chown(name string, uid uint32, gid uint32) error

func (*LocalFileSystem) Create added in v0.14.6

func (fs *LocalFileSystem) Create(name string, flags uint32, mode uint32) (fd FileHandle, err error)

func (*LocalFileSystem) Get added in v0.14.6

func (fs *LocalFileSystem) Get(name string, flags uint32, off, limit int64) (io.ReadCloser, error)

func (*LocalFileSystem) GetAttr added in v0.14.6

func (fs *LocalFileSystem) GetAttr(name string) (*base.FileInfo, error)

Attributes. This function is the main entry point, through which FUSE discovers which files and directories exist.

If the filesystem wants to implement hard-links, it should return consistent non-zero FileInfo.Ino data. Using hardlinks incurs a performance hit.

func (*LocalFileSystem) GetPath added in v0.14.6

func (fs *LocalFileSystem) GetPath(relPath string) string

func (*LocalFileSystem) GetXAttr added in v0.14.6

func (fs *LocalFileSystem) GetXAttr(name string, attribute string) (data []byte, err error)

Extended attributes.

func (fs *LocalFileSystem) Link(oldName string, newName string) error

Tree structure

func (*LocalFileSystem) ListXAttr added in v0.14.6

func (fs *LocalFileSystem) ListXAttr(name string) (attributes []string, err error)

func (*LocalFileSystem) Mkdir added in v0.14.6

func (fs *LocalFileSystem) Mkdir(name string, mode uint32) error

func (*LocalFileSystem) Mknod added in v0.14.6

func (fs *LocalFileSystem) Mknod(name string, mode uint32, dev uint32) error

func (*LocalFileSystem) Open added in v0.14.6

func (fs *LocalFileSystem) Open(name string, flags uint32, size uint64) (FileHandle, error)

File handling. If opening for writing, the file's mtime should be updated too.

func (*LocalFileSystem) Put added in v0.14.6

func (fs *LocalFileSystem) Put(name string, reader io.Reader) error

func (*LocalFileSystem) ReadDir added in v0.14.6

func (fs *LocalFileSystem) ReadDir(name string) (stream []DirEntry, err error)

Directory handling

func (fs *LocalFileSystem) Readlink(name string) (string, error)

func (*LocalFileSystem) RemoveXAttr added in v0.14.6

func (fs *LocalFileSystem) RemoveXAttr(name string, attr string) error

func (*LocalFileSystem) Rename added in v0.14.6

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

func (*LocalFileSystem) Rmdir added in v0.14.6

func (fs *LocalFileSystem) Rmdir(name string) error

func (*LocalFileSystem) SetXAttr added in v0.14.6

func (fs *LocalFileSystem) SetXAttr(name string, attr string, data []byte, flags int) error

func (*LocalFileSystem) StatFs added in v0.14.6

func (fs *LocalFileSystem) StatFs(name string) *base.StatfsOut

func (*LocalFileSystem) String added in v0.14.6

func (fs *LocalFileSystem) String() string

Used for pretty printing.

func (fs *LocalFileSystem) Symlink(value string, linkName string) error

Symlinks.

func (*LocalFileSystem) Truncate added in v0.14.6

func (fs *LocalFileSystem) Truncate(name string, size uint64) error
func (fs *LocalFileSystem) Unlink(name string) error

func (*LocalFileSystem) Utimens added in v0.14.6

func (fs *LocalFileSystem) Utimens(name string, Atime *time.Time, Mtime *time.Time) error

type UnderFileStorage

type UnderFileStorage interface {
	// Used for pretty printing.
	String() string

	// Attributes.  This function is the main entry point, through
	// which FUSE discovers which files and directories exist.
	//
	// If the filesystem wants to implement hard-links, it should
	// return consistent non-zero FileInfo.Ino data.  Using
	// hardlinks incurs a performance hit.
	GetAttr(name string) (*base.FileInfo, error)

	// These should update the file's ctime too.
	// Note: raw FUSE setattr is translated into Chmod/Chown/Utimens in the higher level APIs.
	Chmod(name string, mode uint32) error
	Chown(name string, uid uint32, gid uint32) error
	Utimens(name string, Atime *time.Time, Mtime *time.Time) error

	Truncate(name string, size uint64) error

	Access(name string, mode, callerUid, callerGid uint32) error

	// Tree structure
	Link(oldName string, newName string) error
	Mkdir(name string, mode uint32) error
	Mknod(name string, mode uint32, dev uint32) error
	Rename(oldName string, newName string) error
	Rmdir(name string) error
	Unlink(name string) error

	// Extended attributes.
	GetXAttr(name string, attribute string) (data []byte, err error)
	ListXAttr(name string) (attributes []string, err error)
	RemoveXAttr(name string, attr string) error
	SetXAttr(name string, attr string, data []byte, flags int) error

	// File handling.  If opening for writing, the file's mtime
	// should be updated too.
	Open(name string, flags uint32, size uint64) (FileHandle, error)
	Create(name string, flags uint32, mode uint32) (FileHandle, error)

	// Directory handling
	ReadDir(name string) (stream []DirEntry, err error)

	// Symlinks.
	Symlink(value string, linkName string) error
	Readlink(name string) (string, error)

	StatFs(name string) *base.StatfsOut

	Get(name string, flags uint32, off, limit int64) (io.ReadCloser, error)

	Put(name string, reader io.Reader) error
}

under file storage interface, copy from pathfs.FileSystem, and remove api OnMount and OnUnmount

func NewHdfsFileSystem

func NewHdfsFileSystem(properties map[string]interface{}) (UnderFileStorage, error)

func NewHdfsWithKerberosFileSystem

func NewHdfsWithKerberosFileSystem(properties map[string]interface{}) (UnderFileStorage, error)

func NewLocalFileSystem

func NewLocalFileSystem(properties map[string]interface{}) (UnderFileStorage, error)

A FUSE filesystem that shunts all request to an underlying file system. Its main purpose is to provide test coverage without having to build a synthetic filesystem.

func NewLocalMountFileSystem added in v0.14.3

func NewLocalMountFileSystem(properties map[string]interface{}) (UnderFileStorage, error)

func NewObjectFileSystem added in v0.14.6

func NewObjectFileSystem(properties map[string]interface{}) (UnderFileStorage, error)

func NewS3FileSystem

func NewS3FileSystem(properties map[string]interface{}) (UnderFileStorage, error)

func NewSftpFileSystem

func NewSftpFileSystem(properties map[string]interface{}) (UnderFileStorage, error)

func NewUFS

func NewUFS(_type string, properties map[string]interface{}) (UnderFileStorage, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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