dentry

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 24 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, entry *types.Metadata) *types.EntryEvent

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 UpdateAccessWithMode

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

func UpdateAccessWithOwnID

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

Types

type File

type File interface {
	GetAttr() types.OpenAttr
	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) (*types.Metadata, error)
	CreateEntry(ctx context.Context, attr types.EntryAttr) (*types.Metadata, error)
	UpdateEntry(ctx context.Context, entry *types.Metadata) error
	RemoveEntry(ctx context.Context, entryID int64) error
	ListChildren(ctx context.Context) ([]*types.Metadata, error)
}

type Manager

type Manager interface {
	Root(ctx context.Context) (*types.Metadata, error)

	GetEntry(ctx context.Context, id int64) (*types.Metadata, error)
	GetEntryByUri(ctx context.Context, uri string) (*types.Metadata, error)
	CreateEntry(ctx context.Context, parentId int64, attr types.EntryAttr) (*types.Metadata, error)
	RemoveEntry(ctx context.Context, parentId, entryId int64) error
	DestroyEntry(ctx context.Context, entryId int64) error
	CleanEntryData(ctx context.Context, entryId int64) error
	MirrorEntry(ctx context.Context, srcId, dstParentId int64, attr types.EntryAttr) (*types.Metadata, error)
	ChangeEntryParent(ctx context.Context, targetEntryId int64, overwriteEntryId *int64, oldParentId, newParentId int64, newName string, opt types.ChangeParentAttr) error

	GetEntryExtendData(ctx context.Context, id int64) (types.ExtendData, error)
	UpdateEntryExtendData(ctx context.Context, id int64, ed types.ExtendData) error
	GetEntryExtendField(ctx context.Context, id int64, fKey string) (*string, bool, error)
	SetEntryExtendField(ctx context.Context, id int64, fKey, fVal string, encoded bool) error
	RemoveEntryExtendField(ctx context.Context, id int64, fKey string) error
	GetEntryLabels(ctx context.Context, id int64) (types.Labels, error)
	UpdateEntryLabels(ctx context.Context, id int64, labels types.Labels) error

	Open(ctx context.Context, entryId int64, attr types.OpenAttr) (File, error)
	OpenGroup(ctx context.Context, entryID int64) (Group, error)
	ChunkCompact(ctx context.Context, entryId int64) error

	MustCloseAll()
}

func NewManager

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

Jump to

Keyboard shortcuts

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