dirent

package
v0.0.0-...-36df34d Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ID_LENGTH = 32
	IV_LENGTH = 12 // Standard

	EMPTY_ID = Id("")

	ROOT_ID   = EMPTY_ID
	ROOT_NAME = ""
)
View Source
const (
	FILE_SEPARATOR = "/"
)

Variables

This section is empty.

Functions

func BuildDirs

func BuildDirs(fat map[Id]*Dirent) map[Id][]*Dirent

Take in the FULL fat and create a mapping of directories to their children. This is not a tree, just a straight up map. Only directories will be keys and every directory will be represented.

func RemoveChild

func RemoveChild(dirs map[Id][]*Dirent, target *Dirent)

Types

type Dirent

type Dirent struct {
	Id              Id
	IsFile          bool
	IV              []byte
	Owner           identity.UserId
	Group           identity.GroupId
	Name            string
	CreateTimestamp int64
	ModTimestamp    int64
	AccessTimestamp int64
	AccessCount     uint
	Permissions     Permissions
	Size            uint64 // bytes
	Md5             string
	Parent          Id
}

Anything that can be in a directory.

func NewDir

func NewDir(id Id, name string, parent Id,
	owner identity.UserId, group identity.GroupId,
	timestamp int64) *Dirent

func NewFile

func NewFile(id Id, name string, parent Id,
	owner identity.UserId, group identity.GroupId,
	timestamp int64) *Dirent

func (*Dirent) CanExecute

func (this *Dirent) CanExecute(user *identity.User, group *identity.Group) bool

Can the specified user execute the dirent.

func (*Dirent) CanRead

func (this *Dirent) CanRead(user *identity.User, group *identity.Group) bool

Can the specified user read the dirent.

func (*Dirent) CanWrite

func (this *Dirent) CanWrite(user *identity.User, group *identity.Group) bool

Can the specified user write to this dirent.

type Id

type Id string

The unique name of the encrypted file.

func NewId

func NewId() Id

type Permissions

type Permissions uint32
const (
	PERM_SU Permissions = 1 << (12 - iota) // Set UID
	PERM_SG                                // Set GID
	PERM_ST                                // Sticky
	PERM_UR
	PERM_UW
	PERM_UX
	PERM_GR
	PERM_GW
	PERM_GX
	PERM_OR
	PERM_OW
	PERM_OX

	EMPTY_PERMISSIONS Permissions = 0
	// 0660
	DEFAULT_FILE_PERMISSIONS Permissions = EMPTY_PERMISSIONS | PERM_UR | PERM_UW | PERM_GR | PERM_GR
	// 0770
	DEFAULT_DIR_PERMISSIONS Permissions = DEFAULT_FILE_PERMISSIONS | PERM_UX | PERM_GX
)

func PermissionsFromFileMode

func PermissionsFromFileMode(mode os.FileMode) Permissions

func PermissionsFromString

func PermissionsFromString(rawPerms string) (Permissions, error)

Convert a string of the style: 775 in permissions. Takes four or three digit strings.

func (Permissions) Has

func (this Permissions) Has(permissions Permissions) bool

Check if this permissions contains some permissions.

func (Permissions) String

func (this Permissions) String() string

Jump to

Keyboard shortcuts

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