metadata

package
v0.0.0-...-b142f4f Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeFile      = 1 // type for regular file
	TypeDirectory = 2 // type for directory
	TypeSymlink   = 3 // type for symlink
	TypeFIFO      = 4 // type for FIFO node
	TypeBlockDev  = 5 // type for block device
	TypeCharDev   = 6 // type for character device
	TypeSocket    = 7 // type for socket
)
View Source
const CurInode = "nextinode"
View Source
const TotalInode = "totalinode"
View Source
const TotalSpace = "totalspace"
View Source
const UsedSpace = "usedspace"

Variables

This section is empty.

Functions

func CopySomeAttr

func CopySomeAttr(src, dst *Attr)

func GetFiletype

func GetFiletype(mode uint16) uint8

func SetTime

func SetTime(time *uint64, timensec *uint32, t time.Time)

SetTime set given time and timesec to given time.Time

func ToAttrOut

func ToAttrOut(ino Ino, attr *Attr, out *fuse.Attr)

func TypeToStatType

func TypeToStatType(_type uint8) uint32

Types

type Attr

type Attr struct {
	Flags     uint8  `json:"flags,omitempty"`     // reserved flags
	Typ       uint8  `json:"type,omitempty"`      // type of a node
	Mode      uint16 `json:"mode,omitempty"`      // permission mode
	Uid       uint32 `json:"uid,omitempty"`       // owner id
	Gid       uint32 `json:"gid,omitempty"`       // group id of owner
	Atime     uint64 `json:"atime,omitempty"`     // last access time
	Mtime     uint64 `json:"mtime,omitempty"`     // last modified time
	Ctime     uint64 `json:"ctime,omitempty"`     // last change time for meta
	Atimensec uint32 `json:"atimensec,omitempty"` // nanosecond part of atime
	Mtimensec uint32 `json:"mtimensec,omitempty"` // nanosecond part of mtime
	Ctimensec uint32 `json:"ctimensec,omitempty"` // nanosecond part of ctime
	Nlink     uint32 `json:"nlink,omitempty"`     // number of links (sub-directories or hardlinks)
	Length    uint64 `json:"length,omitempty"`    // length of regular file
	Rdev      uint32 `json:"rdev,omitempty"`      // device number
}

Attr is inode attributes information

func (Attr) SMode

func (a Attr) SMode() uint32

SMode is the file mode including type and unix permission.

type ChunkAttr

type ChunkAttr struct {
	Offset      int64  `json:"offset"`
	Length      int    `json:"length"`
	StoragePath string `json:"storagePath"`
}

type Dentry

type Dentry struct {
	DentryData
	// contains filtered or unexported fields
}

type DentryData

type DentryData struct {
	Ino Ino   `json:"inode"`
	Typ uint8 `json:"type"`
}

type DirStream

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

func NewDirStream

func NewDirStream(ctx context.Context, ino Ino, meta *RedisMeta) (*DirStream, error)

func (*DirStream) Close

func (ds *DirStream) Close()

func (*DirStream) HasNext

func (ds *DirStream) HasNext() bool

func (*DirStream) Next

func (ds *DirStream) Next() (de fuse.DirEntry, eno syscall.Errno)

type Ino

type Ino int64

func (Ino) String

func (i Ino) String() string

type RedisMeta

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

func NewRedisMeta

func NewRedisMeta(url string) (*RedisMeta, error)

NewRedisMeta create a new meta instenance

func (*RedisMeta) CurInodeCount

func (r *RedisMeta) CurInodeCount(ctx context.Context) (uint64, error)

func (*RedisMeta) DelDentry

func (r *RedisMeta) DelDentry(ctx context.Context, parent Ino, name string) error

func (*RedisMeta) DeleteChunkMeta

func (r *RedisMeta) DeleteChunkMeta(ctx context.Context, inode Ino, pageNum int64) error

func (*RedisMeta) GetAllDentries

func (r *RedisMeta) GetAllDentries(ctx context.Context, ino Ino) ([]*Dentry, error)

GetAllDentries return all dentries of the directory with specified inode

func (*RedisMeta) GetChunkMeta

func (r *RedisMeta) GetChunkMeta(ctx context.Context, inode Ino, pageNum int64) (*ChunkAttr, bool, error)

func (*RedisMeta) GetDentry

func (r *RedisMeta) GetDentry(ctx context.Context, parent Ino, name string) (*Dentry, bool, error)

GetDentry check if directory parent have a dentry with the name, if have, return the dentry

func (*RedisMeta) GetDirectoryLength

func (r *RedisMeta) GetDirectoryLength(ctx context.Context, ino Ino) (int64, error)

GetDirectoryLength get the dentries' number of the directory with specified inode

func (*RedisMeta) Getattr

func (r *RedisMeta) Getattr(ctx context.Context, ino Ino) (*Attr, syscall.Errno)

Getattr return the attributes of the specified inode

func (*RedisMeta) Init

func (r *RedisMeta) Init(ctx context.Context) error
func (r *RedisMeta) Link(ctx context.Context, parent Ino, target Ino, name string) (*Attr, syscall.Errno)

func (*RedisMeta) MkNod

func (r *RedisMeta) MkNod(ctx context.Context, parent Ino, _type uint8, name string, mode uint32, dev uint32) (*Attr, Ino, syscall.Errno)

MkNod create a new inode

func (*RedisMeta) Ref

func (r *RedisMeta) Ref(ctx context.Context, inode Ino) syscall.Errno

func (*RedisMeta) RefDel

func (r *RedisMeta) RefDel(ctx context.Context, inode Ino) error

func (*RedisMeta) RefGet

func (r *RedisMeta) RefGet(ctx context.Context, inode Ino) (string, error)

func (*RedisMeta) RefSet

func (r *RedisMeta) RefSet(ctx context.Context, inode Ino, value string) error

func (*RedisMeta) Rename

func (r *RedisMeta) Rename(ctx context.Context, parent Ino, oldName string, newParent Ino, newName string) syscall.Errno

func (*RedisMeta) Rmdir

func (r *RedisMeta) Rmdir(ctx context.Context, parent Ino, name string) syscall.Errno

Rmdir remove a directory with name in parent inode

func (*RedisMeta) SetChunkMeta

func (r *RedisMeta) SetChunkMeta(ctx context.Context, inode Ino, pageNum int64, offset int64, lens int, storagePath string) error

SetChunkMeta inode[pagenum] -> { offset. length, storagePath }

func (*RedisMeta) SetDentry

func (r *RedisMeta) SetDentry(ctx context.Context, parent Ino, name string, inode Ino, typ uint8) error

func (*RedisMeta) SetTotalInodeCount

func (r *RedisMeta) SetTotalInodeCount(ctx context.Context, totalInodeCount uint64) error

func (*RedisMeta) SetTotalSpace

func (r *RedisMeta) SetTotalSpace(ctx context.Context, totalSpace uint64) error

func (*RedisMeta) SetattrDirectly

func (r *RedisMeta) SetattrDirectly(ctx context.Context, ino Ino, attr *Attr) error

func (*RedisMeta) TotalInodeCount

func (r *RedisMeta) TotalInodeCount(ctx context.Context) (uint64, error)

func (*RedisMeta) TotalSpace

func (r *RedisMeta) TotalSpace(ctx context.Context) (uint64, error)

func (*RedisMeta) TruncateChunkMeta

func (r *RedisMeta) TruncateChunkMeta(ctx context.Context, inode Ino, lastPageNum int64, lastPageLength int) error
func (r *RedisMeta) Unlink(ctx context.Context, parent Ino, name string) syscall.Errno

func (*RedisMeta) UpdateUsedSpace

func (r *RedisMeta) UpdateUsedSpace(ctx context.Context, size int64) error

func (*RedisMeta) UsedSpace

func (r *RedisMeta) UsedSpace(ctx context.Context) (uint64, error)

Jump to

Keyboard shortcuts

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