dentry

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootEntryID   = 1
	RootEntryName = "root"
)

Variables

This section is empty.

Functions

func Access2Mode

func Access2Mode(access types.Access) (mode uint32)

func BuildEntryEvent

func BuildEntryEvent(actionType string, en Entry) *types.Event

func IsAccess

func IsAccess(access types.Access, callerUid, callerGid int64, mask uint32) error

func IsFileOpened

func IsFileOpened(fid int64) bool

func MatchUserGroup

func MatchUserGroup(callerUid, targetGid int64) bool

func PublicEntryActionEvent

func PublicEntryActionEvent(actionType string, en Entry)

func PublicFileActionEvent

func PublicFileActionEvent(actionType string, en Entry)

func UpdateAccessWithMode

func UpdateAccessWithMode(access *types.Access, mode uint32)

func UpdateAccessWithOwnID

func UpdateAccessWithOwnID(access *types.Access, uid, gid int64)

Types

type Attr

type Attr struct {
	Read   bool
	Write  bool
	Create bool
	Trunc  bool
	Direct bool
}

type CacheResetter

type CacheResetter interface {
	ResetEntry(entry Entry)
}

type ChangeParentAttr

type ChangeParentAttr struct {
	Replace  bool
	Exchange bool
}

type Entry

type Entry interface {
	Metadata() *types.Metadata
	GetExtendData(ctx context.Context) (types.ExtendData, error)
	UpdateExtendData(ctx context.Context, ed types.ExtendData) error
	GetExtendField(ctx context.Context, fKey string) (*string, error)
	SetExtendField(ctx context.Context, fKey, fVal string) error
	RemoveExtendField(ctx context.Context, fKey string) error
	IsGroup() bool
	IsMirror() bool
	Group() Group
}

type EntryAttr

type EntryAttr struct {
	Name   string
	Dev    int64
	Kind   types.Kind
	Access types.Access
}

type File

type File interface {
	Entry

	GetAttr() Attr
	WriteAt(ctx context.Context, data []byte, off int64) (int64, error)
	ReadAt(ctx context.Context, dest []byte, off int64) (int64, error)
	Fsync(ctx context.Context) error
	Flush(ctx context.Context) error
	Close(ctx context.Context) (err error)
}

type Group

type Group interface {
	FindEntry(ctx context.Context, name string) (Entry, error)
	CreateEntry(ctx context.Context, attr EntryAttr) (Entry, error)
	UpdateEntry(ctx context.Context, en Entry) error
	RemoveEntry(ctx context.Context, en Entry) error
	ListChildren(ctx context.Context) ([]Entry, error)
}

type Manager

type Manager interface {
	Root(ctx context.Context) (Entry, error)
	GetEntry(ctx context.Context, id int64) (Entry, error)
	CreateEntry(ctx context.Context, parent Entry, attr EntryAttr) (Entry, error)
	RemoveEntry(ctx context.Context, parent, en Entry) error
	DestroyEntry(ctx context.Context, en Entry) error
	CleanEntryData(ctx context.Context, en Entry) error
	MirrorEntry(ctx context.Context, src, dstParent Entry, attr EntryAttr) (Entry, error)
	ChangeEntryParent(ctx context.Context, targetEntry, overwriteEntry, oldParent, newParent Entry, newName string, opt ChangeParentAttr) error
	Open(ctx context.Context, en Entry, attr Attr) (File, error)
	ChunkCompact(ctx context.Context, en Entry) error
	SetCacheResetter(r CacheResetter)
	MustCloseAll()
}

func NewManager

func NewManager(store metastore.ObjectStore, cfg config.Config) (Manager, error)

Jump to

Keyboard shortcuts

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