Documentation
¶
Index ¶
- Constants
- Variables
- func Backup(m meta.Meta, blob object.ObjectStorage, interval time.Duration, skipTrash bool)
- func CollectMetrics(registry *prometheus.Registry) []byte
- func Compact(conf chunk.Config, store chunk.ChunkStore, slices []meta.Slice, id uint64) error
- func GetInternalNodeByName(name string) (Ino, *Attr)
- func InitMemoryBufferMetrics(writer DataWriter, reader DataReader, registerer prometheus.Registerer)
- func InitMetrics(registerer prometheus.Registerer)
- func IsSpecialName(name string) bool
- func IsSpecialNode(ino Ino) bool
- type AnonymousAccount
- type Attr
- type CacheAction
- type CacheFiller
- type CacheResponse
- type Config
- type Context
- type DataReader
- type DataWriter
- type Entry
- type FileReader
- type FileWriter
- type FuseOptions
- type InfoResponse
- type Ino
- type LogContext
- type Port
- type SecurityConfig
- type Statfs
- type SummaryReponse
- type VFS
- func (v *VFS) Access(ctx Context, ino Ino, mask int) (err syscall.Errno)
- func (v *VFS) CopyFileRange(ctx Context, nodeIn Ino, fhIn, offIn uint64, nodeOut Ino, ...) (copied uint64, err syscall.Errno)
- func (v *VFS) Create(ctx Context, parent Ino, name string, mode uint16, cumask uint16, flags uint32) (entry *meta.Entry, fh uint64, err syscall.Errno)
- func (v *VFS) Fallocate(ctx Context, ino Ino, mode uint8, off, size int64, fh uint64) (err syscall.Errno)
- func (v *VFS) Flock(ctx Context, ino Ino, fh uint64, owner uint64, typ uint32, block bool) (err syscall.Errno)
- func (v *VFS) Flush(ctx Context, ino Ino, fh uint64, lockOwner uint64) (err syscall.Errno)
- func (v *VFS) FlushAll(path string) (err error)
- func (v *VFS) Fsync(ctx Context, ino Ino, datasync int, fh uint64) (err syscall.Errno)
- func (v *VFS) GetAttr(ctx Context, ino Ino, opened uint8) (entry *meta.Entry, err syscall.Errno)
- func (v *VFS) GetXattr(ctx Context, ino Ino, name string, size uint32) (value []byte, err syscall.Errno)
- func (v *VFS) Getlk(ctx Context, ino Ino, fh uint64, owner uint64, start, len *uint64, typ *uint32, ...) (err syscall.Errno)
- func (v *VFS) Ioctl(ctx Context, ino Ino, cmd uint32, arg uint64, bufIn, bufOut []byte) (err syscall.Errno)
- func (v *VFS) Link(ctx Context, ino Ino, newparent Ino, newname string) (entry *meta.Entry, err syscall.Errno)
- func (v *VFS) ListXattr(ctx Context, ino Ino, size int) (data []byte, err syscall.Errno)
- func (v *VFS) Lookup(ctx Context, parent Ino, name string) (entry *meta.Entry, err syscall.Errno)
- func (v *VFS) Mkdir(ctx Context, parent Ino, name string, mode uint16, cumask uint16) (entry *meta.Entry, err syscall.Errno)
- func (v *VFS) Mknod(ctx Context, parent Ino, name string, mode uint16, cumask uint16, rdev uint32) (entry *meta.Entry, err syscall.Errno)
- func (v *VFS) ModifiedSince(ino Ino, start time.Time) bool
- func (v *VFS) Open(ctx Context, ino Ino, flags uint32) (entry *meta.Entry, fh uint64, err syscall.Errno)
- func (v *VFS) Opendir(ctx Context, ino Ino, flags uint32) (fh uint64, err syscall.Errno)
- func (v *VFS) Read(ctx Context, ino Ino, buf []byte, off uint64, fh uint64) (n int, err syscall.Errno)
- func (v *VFS) Readdir(ctx Context, ino Ino, size uint32, off int, fh uint64, plus bool) (entries []*meta.Entry, readAt time.Time, err syscall.Errno)
- func (v *VFS) Readlink(ctx Context, ino Ino) (path []byte, err syscall.Errno)
- func (v *VFS) Release(ctx Context, ino Ino, fh uint64)
- func (v *VFS) ReleaseHandler(ino Ino, fh uint64)
- func (v *VFS) Releasedir(ctx Context, ino Ino, fh uint64) int
- func (v *VFS) RemoveXattr(ctx Context, ino Ino, name string) (err syscall.Errno)
- func (v *VFS) Rename(ctx Context, parent Ino, name string, newparent Ino, newname string, ...) (err syscall.Errno)
- func (v *VFS) Rmdir(ctx Context, parent Ino, name string) (err syscall.Errno)
- func (v *VFS) SetAttr(ctx Context, ino Ino, set int, fh uint64, mode, uid, gid uint32, ...) (entry *meta.Entry, err syscall.Errno)
- func (v *VFS) SetXattr(ctx Context, ino Ino, name string, value []byte, flags uint32) (err syscall.Errno)
- func (v *VFS) Setlk(ctx Context, ino Ino, fh uint64, owner uint64, start, end uint64, typ uint32, ...) (err syscall.Errno)
- func (v *VFS) StatFS(ctx Context, ino Ino) (st *Statfs, err syscall.Errno)
- func (v *VFS) Symlink(ctx Context, path string, parent Ino, name string) (entry *meta.Entry, err syscall.Errno)
- func (v *VFS) Truncate(ctx Context, ino Ino, size int64, fh uint64, attr *Attr) (err syscall.Errno)
- func (v *VFS) Unlink(ctx Context, parent Ino, name string) (err syscall.Errno)
- func (v *VFS) UpdateLength(inode Ino, attr *meta.Attr)
- func (v *VFS) UpdateReaddirOffset(ctx Context, ino Ino, fh uint64, off int)
- func (v *VFS) Write(ctx Context, ino Ino, buf []byte, off, fh uint64) (err syscall.Errno)
Constants ¶
View Source
const ( MODE_MASK_R = 4 MODE_MASK_W = 2 MODE_MASK_X = 1 )
View Source
const ( StatsInode = minInternalNode + 3 ConfigInode = minInternalNode + 4 )
View Source
const ( NEW = iota BUSY REFRESH BREAK READY INVALID )
* state of sliceReader * * <-- REFRESH * | | * NEW -> BUSY -> READY * | | * BREAK ---> INVALID
View Source
const F_UNLCK = syscall.F_UNLCK
View Source
const O_ACCMODE = syscall.O_ACCMODE
View Source
const O_RECOVERED = 1 << 31 // is recovered fd
View Source
const O_TMPFILE = 020000000
Variables ¶
View Source
var ( LastBackupTimeG = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "last_successful_backup", Help: "Last successful backup.", }) LastBackupDurationG = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "last_backup_duration", Help: "Last backup duration.", }) )
Functions ¶
func CollectMetrics ¶ added in v0.1.3
func CollectMetrics(registry *prometheus.Registry) []byte
func GetInternalNodeByName ¶
func InitMemoryBufferMetrics ¶ added in v0.1.3
func InitMemoryBufferMetrics(writer DataWriter, reader DataReader, registerer prometheus.Registerer)
func InitMetrics ¶
func InitMetrics(registerer prometheus.Registerer)
func IsSpecialName ¶
func IsSpecialNode ¶
Types ¶
type AnonymousAccount ¶ added in v0.1.3
type CacheAction ¶
type CacheAction uint8
const ( WarmupCache CacheAction = iota EvictCache CheckCache = 2 )
func (CacheAction) String ¶
func (act CacheAction) String() string
type CacheFiller ¶ added in v0.1.3
type CacheFiller struct {
// contains filtered or unexported fields
}
func NewCacheFiller ¶ added in v0.1.3
func NewCacheFiller(conf *Config, meta meta.Meta, store chunk.ChunkStore) *CacheFiller
func (*CacheFiller) Cache ¶ added in v0.1.3
func (c *CacheFiller) Cache(ctx meta.Context, action CacheAction, paths []string, threads int, resp *CacheResponse)
type CacheResponse ¶
type CacheResponse struct {
sync.Mutex
FileCount uint64
SliceCount uint64
TotalBytes uint64
MissBytes uint64 // for check op
Locations map[string]uint64
}
func (*CacheResponse) Add ¶
func (resp *CacheResponse) Add(other *CacheResponse)
type Config ¶
type Config struct {
Meta *meta.Config
Format meta.Format
Chunk *chunk.Config
Security *SecurityConfig
Port *Port
Version string
AttrTimeout time.Duration
DirEntryTimeout time.Duration
NegEntryTimeout time.Duration
EntryTimeout time.Duration
ReaddirCache bool
BackupMeta time.Duration
BackupSkipTrash bool
FastResolve bool `json:",omitempty"`
AccessLog string `json:",omitempty"`
Subdir string `json:",omitempty"`
PrefixInternal bool
HideInternal bool
RootSquash *AnonymousAccount `json:",omitempty"`
AllSquash *AnonymousAccount `json:",omitempty"`
NonDefaultPermission bool `json:",omitempty"`
UMask uint16
Pid int
PPid int
CommPath string `json:",omitempty"`
StatePath string `json:",omitempty"`
FuseOpts *FuseOptions `json:",omitempty"`
}
type Context ¶
type Context = LogContext
type DataReader ¶
type DataReader interface {
Open(inode Ino, length uint64) FileReader
Truncate(inode Ino, length uint64)
Invalidate(inode Ino, off, length uint64)
}
func NewDataReader ¶
func NewDataReader(conf *Config, m meta.Meta, store chunk.ChunkStore) DataReader
type DataWriter ¶
type DataWriter interface {
Open(inode Ino, fleng uint64) FileWriter
Flush(ctx meta.Context, inode Ino) syscall.Errno
GetLength(inode Ino) uint64
Truncate(inode Ino, length uint64)
UpdateMtime(inode Ino, mtime time.Time)
FlushAll() error
}
func NewDataWriter ¶
func NewDataWriter(conf *Config, m meta.Meta, store chunk.ChunkStore, reader DataReader) DataWriter
type Entry ¶
Entry is an alias of meta.Entry, which is used to generate the string representation lazily.
type FileReader ¶
type FileWriter ¶
type FuseOptions ¶
type FuseOptions struct {
AllowOther bool
Options []string
MaxBackground int
MaxWrite int
MaxReadAhead int
IgnoreSecurityLabels bool // ignoring labels should be provided as a fusermount mount option.
RememberInodes bool
FsName string
Name string
SingleThreaded bool
DisableXAttrs bool
Debug bool
Logger *log.Logger `json:"-"`
EnableLocks bool
EnableSymlinkCaching bool `json:",omitempty"`
ExplicitDataCacheControl bool
SyncRead bool `json:",omitempty"`
DirectMount bool
DirectMountStrict bool `json:",omitempty"`
DirectMountFlags uintptr
EnableAcl bool
DisableReadDirPlus bool `json:",omitempty"`
EnableWriteback bool
EnableIoctl bool `json:",omitempty"`
DontUmask bool
OtherCaps uint32
NoAllocForRead bool
Timeout time.Duration
}
FuseOptions contains options for fuse mount, keep the same structure with `fuse.MountOptions`
func (FuseOptions) StripOptions ¶
func (o FuseOptions) StripOptions() FuseOptions
type InfoResponse ¶
type LogContext ¶
LogContext is an interface to add duration on meta.Context.
func NewLogContext ¶
func NewLogContext(ctx meta.Context) LogContext
NewLogContext creates an LogContext starting from now.
type SecurityConfig ¶ added in v0.1.3
type SummaryReponse ¶
type SummaryReponse struct {
Errno syscall.Errno
Tree meta.TreeSummary
}
type VFS ¶
type VFS struct {
Conf *Config
Meta meta.Meta
Store chunk.ChunkStore
InvalidateEntry func(parent meta.Ino, name string) syscall.Errno
UpdateFormat func(*meta.Format)
// contains filtered or unexported fields
}
func NewVFS ¶
func NewVFS(conf *Config, m meta.Meta, store chunk.ChunkStore, registerer prometheus.Registerer, registry *prometheus.Registry) *VFS
func (*VFS) CopyFileRange ¶
func (*VFS) ReleaseHandler ¶
func (*VFS) RemoveXattr ¶
func (*VFS) UpdateReaddirOffset ¶
Click to show internal directories.
Click to hide internal directories.