fsds

package
v0.0.24-dev Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBucketName = "personal"
View Source
var EntryNotFound = syscall.ENOENT // errors.New("Directory entry not found")

EntryNotFound error when a directory is not found

View Source
var RestrictedDirAccessMode = os.ModeDir | 0500 // dr-x------ only allow reading and opening directory for user
View Source
var StandardDirAccessMode = os.ModeDir | 0700 // drwx------
View Source
var StandardFileAccessMode os.FileMode = 0600 // -rw-------

Functions

This section is empty.

Types

type DirEntry

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

DirEntry implements the DirEntryOps

func NewDirEntry

func NewDirEntry(entry domain.DirEntry) *DirEntry

func NewDirEntryWithMode added in v0.0.19

func NewDirEntryWithMode(entry domain.DirEntry, mode os.FileMode) *DirEntry

func (*DirEntry) Ctime

func (d *DirEntry) Ctime() time.Time

Ctime implements the DirEntryAttribute Interface It returns the time the directory was created

func (*DirEntry) Gid added in v0.0.19

func (d *DirEntry) Gid() string

func (*DirEntry) IsDir

func (d *DirEntry) IsDir() bool

IsDir implement DirEntryAttribute And returns if the directory is a boolean or not

func (*DirEntry) ModTime

func (d *DirEntry) ModTime() time.Time

ModTime returns the modification time

func (*DirEntry) Mode

func (d *DirEntry) Mode() os.FileMode

Mode implements the DirEntryAttribute Interface Currently if it is a file, returns all access permission 0766 but ideally should restrict the permission if owner is not the same as file

func (*DirEntry) Name

func (d *DirEntry) Name() string

Name implements the DirEntryAttribute Interface

func (*DirEntry) Path

func (d *DirEntry) Path() string

func (*DirEntry) Size

func (d *DirEntry) Size() uint64

Size implements the DirEntryAttribute Interface and return the size of the item

func (*DirEntry) Uid added in v0.0.19

func (d *DirEntry) Uid() string

type FSDataSource

type FSDataSource interface {
	// Get a single node, this can be called on either a file or folder entry
	// This is typically used by the OS for lookup of the information about the entry at path
	Get(ctx context.Context, path string) (*DirEntry, error)
	// GetChildren returns child entries in the directory/folder
	GetChildren(ctx context.Context, path string) ([]*DirEntry, error)
	// OpenReader returns a file reader
	Open(ctx context.Context, path string) (FileReadWriterCloser, error)
	// CreateEntry should create a directory or file based on the mode at the path
	CreateEntry(ctx context.Context, path string, mode os.FileMode) (*DirEntry, error)
}

FSDataSource is data source of file/directories and their information It is used as a local/remote cache for looking up information about the directories. It should also ensure that the user in the context has permission to data that is being request

type FSDataSourceConfig added in v0.0.19

type FSDataSourceConfig func(config *dataSourceConfig)

func WithFilesDataSources added in v0.0.19

func WithFilesDataSources(service space.Service) FSDataSourceConfig

Configure the default 'Files` data source to be included as a data source

func WithSharedWithMeDataSources added in v0.0.19

func WithSharedWithMeDataSources(service space.Service) FSDataSourceConfig

Configure the default 'Shared With Me` data source to be included as a data source

func WithTLFDataSource added in v0.0.19

func WithTLFDataSource(source *TLFDataSource) FSDataSourceConfig

type FileReadWriterCloser added in v0.0.19

type FileReadWriterCloser interface {
	Read(ctx context.Context, data []byte, offset int64) (int, error)
	Write(ctx context.Context, data []byte, offset int64) (int, error)
	Close(ctx context.Context) error
}

FileReadWriterCloser implements interfaces to read, copy, seek and close.

type SpaceFSDataSource

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

SpaceFSDataSource is an implementation of the FSDataSource It interacts with the Space Service Layer to provide data

func NewSpaceFSDataSource

func NewSpaceFSDataSource(service space.Service, configOptions ...FSDataSourceConfig) *SpaceFSDataSource

func (*SpaceFSDataSource) CreateEntry

func (d *SpaceFSDataSource) CreateEntry(ctx context.Context, path string, mode os.FileMode) (*DirEntry, error)

CreateEntry creates a directory or file based on the mode at the path

func (*SpaceFSDataSource) Get

func (d *SpaceFSDataSource) Get(ctx context.Context, path string) (*DirEntry, error)

Get returns the DirEntry information for item at path

func (*SpaceFSDataSource) GetChildren

func (d *SpaceFSDataSource) GetChildren(ctx context.Context, path string) ([]*DirEntry, error)

GetChildren returns list of entries in a path

func (*SpaceFSDataSource) Open

Open is invoked to read the content of a file

type TLFDataSource added in v0.0.19

type TLFDataSource struct {
	FSDataSource
	// contains filtered or unexported fields
}

TLFDataSource represents a data source handler for a particular top level file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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