driver

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: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_AWS_CRED_PATH = "config/elfs-wasabi-credentials"
	DEFAULT_AWS_ENDPOINT  = ""
	DEFAULT_AWS_PROFILE   = "elfsapi"
	DEFAULT_AWS_REGION    = "us-east-1"
)
View Source
const (
	FAT_ID        = "fat"
	USERS_ID      = "users"
	GROUPS_ID     = "groups"
	SHADOW_SUFFIX = "shadow"

	// Offset the initial IV for each table.
	IV_OFFSET_USERS  = 100
	IV_OFFSET_GROUPS = 200
	IV_OFFSET_CACHE  = 300
	IV_OFFSET_FAT    = 500
)

Variables

This section is empty.

Functions

func GetDriverFromArgs

func GetDriverFromArgs() (*Driver, *Args)

This is meant to be called from a command line. This will just exit on bad args. The caller is responsible for closing the driver when done.

Types

type Args

type Args struct {
	AwsCredPath   string
	AwsEndpoint   string
	AwsProfile    string
	AwsRegion     string
	ConnectorType string
	Key           []byte
	IV            []byte
	Path          string
	User          string
	Pass          string
	Force         bool
}

type AuthError

type AuthError struct {
	// contains filtered or unexported fields
}

func NewAuthError

func NewAuthError(message string) *AuthError

func (*AuthError) Error

func (this *AuthError) Error() string

type DoesntExistError

type DoesntExistError struct {
	// contains filtered or unexported fields
}

func NewDoesntExistError

func NewDoesntExistError(message string) *DoesntExistError

func (*DoesntExistError) Error

func (this *DoesntExistError) Error() string

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func NewLocalDriver

func NewLocalDriver(key []byte, iv []byte, path string, force bool) (*Driver, error)

func NewS3Driver

func NewS3Driver(key []byte, iv []byte, bucket string, credentialsPath string, awsProfile string, region string, endpoint string, force bool) (*Driver, error)

func (*Driver) AddGroup

func (this *Driver) AddGroup(contextUser identity.UserId, name string) (identity.GroupId, error)

func (*Driver) AddUser

func (this *Driver) AddUser(contextUser identity.UserId, name string, weakhash string) (identity.UserId, error)

func (*Driver) ChangeGroup

func (this *Driver) ChangeGroup(userId identity.UserId, direntId dirent.Id, newGroupId identity.GroupId) error

func (*Driver) ChangeOwner

func (this *Driver) ChangeOwner(userId identity.UserId, direntId dirent.Id, newOwnerId identity.UserId) error

func (*Driver) ChangePermissions

func (this *Driver) ChangePermissions(userId identity.UserId, direntId dirent.Id, perms dirent.Permissions) error

func (*Driver) Close

func (this *Driver) Close()

func (*Driver) ConnectionString

func (this *Driver) ConnectionString() string

func (*Driver) CreateFilesystem

func (this *Driver) CreateFilesystem(rootPasshash string) error

Create a new filesystem.

func (*Driver) DeleteGroup

func (this *Driver) DeleteGroup(contextUser identity.UserId, groupId identity.GroupId) error

func (*Driver) FetchChildByName

func (this *Driver) FetchChildByName(userId identity.UserId, parentId dirent.Id, name string) (*dirent.Dirent, error)

func (*Driver) GetDirent

func (this *Driver) GetDirent(userId identity.UserId, direntId dirent.Id) (*dirent.Dirent, error)

func (*Driver) GetGroups

func (this *Driver) GetGroups() map[identity.GroupId]*identity.Group

func (*Driver) GetUsers

func (this *Driver) GetUsers() map[identity.UserId]*identity.User

func (*Driver) JoinGroup

func (this *Driver) JoinGroup(contextUser identity.UserId, targetUser identity.UserId, groupId identity.GroupId) error

func (*Driver) KickUser

func (this *Driver) KickUser(contextUser identity.UserId, targetUser identity.UserId, groupId identity.GroupId) error

func (*Driver) List

func (this *Driver) List(userId identity.UserId, direntId dirent.Id) ([]*dirent.Dirent, error)

func (*Driver) MakeDir

func (this *Driver) MakeDir(userId identity.UserId, name string, parentId dirent.Id) (dirent.Id, error)

func (*Driver) Move

func (this *Driver) Move(userId identity.UserId, targetId dirent.Id, newParentId dirent.Id) error

func (*Driver) PromoteUser

func (this *Driver) PromoteUser(contextUser identity.UserId, targetUser identity.UserId, groupId identity.GroupId) error

Promote a user to be the owner of a group.

func (*Driver) Put

func (this *Driver) Put(
	userId identity.UserId,
	name string, clearbytes io.Reader,
	parentId dirent.Id) (dirent.Id, error)

func (*Driver) Read

func (this *Driver) Read(userId identity.UserId, fileId dirent.Id) (util.ReadSeekCloser, error)

func (*Driver) RemoveDir

func (this *Driver) RemoveDir(userId identity.UserId, dirId dirent.Id) error

func (*Driver) RemoveFile

func (this *Driver) RemoveFile(userId identity.UserId, fileId dirent.Id) error

func (*Driver) RemoveUser

func (this *Driver) RemoveUser(contextUser identity.UserId, targetId identity.UserId) error

func (*Driver) Rename

func (this *Driver) Rename(userId identity.UserId, targetId dirent.Id, newName string) error

func (*Driver) SyncFromDisk

func (this *Driver) SyncFromDisk() error

Read all the metadata from disk into memory. This should only be done once when the driver initializes.

func (*Driver) SyncToDisk

func (this *Driver) SyncToDisk(force bool) error

Write all metadata to disk and clear the cache after.

func (*Driver) UserAuth

func (this *Driver) UserAuth(name string, weakhash string) (*identity.User, error)

type IllegalOperationError

type IllegalOperationError struct {
	// contains filtered or unexported fields
}

func NewIllegalOperationError

func NewIllegalOperationError(message string) *IllegalOperationError

func (*IllegalOperationError) Error

func (this *IllegalOperationError) Error() string

type PermissionsError

type PermissionsError struct {
	// contains filtered or unexported fields
}

func NewPermissionsError

func NewPermissionsError(message string) *PermissionsError

func (*PermissionsError) Error

func (this *PermissionsError) Error() string

Jump to

Keyboard shortcuts

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