meta

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	UnknownType     = NodeType(0)
	DirType         = NodeType(syscall.S_IFDIR)
	RegularType     = NodeType(syscall.S_IFREG)
	BlockDeviceType = NodeType(syscall.S_IFBLK)
	CharDeviceType  = NodeType(syscall.S_IFCHR)
	SocketType      = NodeType(syscall.S_IFSOCK)
	FIFOType        = NodeType(syscall.S_IFIFO)
	LinkType        = NodeType(syscall.S_IFLNK)
)
View Source
const (
	//TraverseLimit capnp message traverse limit
	TraverseLimit = ^uint64(0)

	SQLiteDBName = "flistdb.sqlite3"

	DirCacheSize    = 1024
	AccessCacheSize = 64
)

Variables

View Source
var (
	//DefaultAccess fallback
	DefaultAccess = Access{
		Mode: 0400,
		UID:  1000,
		GID:  1000,
	}
)
View Source
var (

	//ErrNotFound in case of an entry miss
	ErrNotFound = fmt.Errorf("not found")
)

Functions

This section is empty.

Types

type Access

type Access struct {
	UID  uint32
	GID  uint32
	Mode uint32
}

type BlockInfo

type BlockInfo struct {
	Key      []byte
	Decipher []byte
}

type Dir

type Dir struct {
	np.Dir
	// contains filtered or unexported fields
}

Dir represents a dir inode

func (*Dir) Blocks

func (d *Dir) Blocks() []BlockInfo

Blocks return file block, nil in case of a dir

func (*Dir) Children

func (d *Dir) Children() []Meta

Children return items in this dir

func (*Dir) ID

func (d *Dir) ID() string

ID empty string for a dir

func (*Dir) Info

func (d *Dir) Info() MetaInfo

Info return meta info for this dir

func (*Dir) IsDir

func (d *Dir) IsDir() bool

IsDir returns true for a dir

func (*Dir) Name

func (d *Dir) Name() string

Name return file name

type File

type File struct {
	np.Inode
	// contains filtered or unexported fields
}

File represents a file inode

func (*File) Blocks

func (f *File) Blocks() []BlockInfo

Blocks loads and return blocks of file

func (*File) Children

func (f *File) Children() []Meta

Children nil for files

func (*File) ID

func (f *File) ID() string

ID returns file ID

func (*File) Info

func (f *File) Info() MetaInfo

Info return meta info for this dir

func (*File) IsDir

func (f *File) IsDir() bool

IsDir false for files

func (*File) Name

func (f *File) Name() string

Name return file name

type Link struct {
	np.Inode
	// contains filtered or unexported fields
}

func (*Link) Blocks

func (l *Link) Blocks() []BlockInfo

Blocks returns empty list

func (*Link) Children

func (l *Link) Children() []Meta

Children returns empty list

func (*Link) ID

func (l *Link) ID() string

ID link id

func (*Link) Info

func (l *Link) Info() MetaInfo

Info returns empty list

func (*Link) IsDir

func (l *Link) IsDir() bool

IsDir returns false

func (*Link) Name

func (l *Link) Name() string

Name link name

type Meta

type Meta interface {
	fmt.Stringer
	//base name
	ID() string
	Name() string
	IsDir() bool
	Blocks() []BlockInfo

	Info() MetaInfo

	Children() []Meta
}

type MetaInfo

type MetaInfo struct {
	//Common
	CreationTime     uint32
	ModificationTime uint32
	Access           Access
	Type             NodeType
	Size             uint64

	//Link
	LinkTarget string

	//File
	FileBlockSize uint64

	//Special
	SpecialData string
}

type MetaStore

type MetaStore interface {
	// Populate(entry Entry) error
	Get(name string) (Meta, bool)
}

func Layered

func Layered(store ...MetaStore) MetaStore

Layered return a meta store that layer the given stores in a way that last store is on top Example:

store = Layered(s1, s2)
store.Get(p) will search s2 first, then s1

func NewStore

func NewStore(p string) (MetaStore, error)

NewStore creates a new meta store with path p

type NodeType

type NodeType uint32

func (NodeType) String

func (nt NodeType) String() string

type Special

type Special struct {
	np.Inode
	// contains filtered or unexported fields
}

func (*Special) Blocks

func (s *Special) Blocks() []BlockInfo

Blocks returns empty list

func (*Special) Children

func (s *Special) Children() []Meta

Children returns empty list

func (*Special) ID

func (s *Special) ID() string

ID link id

func (*Special) Info

func (s *Special) Info() MetaInfo

Info returns empty list

func (*Special) IsDir

func (s *Special) IsDir() bool

IsDir returns false

func (*Special) Name

func (s *Special) Name() string

Name link name

Jump to

Keyboard shortcuts

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