Documentation
¶
Index ¶
- Variables
- type DirEntry
- func (d *DirEntry) Ctime() time.Time
- func (d *DirEntry) Gid() string
- func (d *DirEntry) IsDir() bool
- func (d *DirEntry) ModTime() time.Time
- func (d *DirEntry) Mode() os.FileMode
- func (d *DirEntry) Name() string
- func (d *DirEntry) Path() string
- func (d *DirEntry) Size() uint64
- func (d *DirEntry) Uid() string
- type FSDataSource
- type FSDataSourceConfig
- type FileReadWriterCloser
- type SpaceFSDataSource
- func (d *SpaceFSDataSource) CreateEntry(ctx context.Context, path string, mode os.FileMode) (*DirEntry, error)
- func (d *SpaceFSDataSource) Get(ctx context.Context, path string) (*DirEntry, error)
- func (d *SpaceFSDataSource) GetChildren(ctx context.Context, path string) ([]*DirEntry, error)
- func (d *SpaceFSDataSource) Open(ctx context.Context, path string) (FileReadWriterCloser, error)
- type TLFDataSource
Constants ¶
This section is empty.
Variables ¶
var DefaultBucketName = "personal"
var EntryNotFound = syscall.ENOENT // errors.New("Directory entry not found")
EntryNotFound error when a directory is not found
var RestrictedDirAccessMode = os.ModeDir | 0500 // dr-x------ only allow reading and opening directory for user
var StandardDirAccessMode = os.ModeDir | 0700 // drwx------
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 NewDirEntryWithMode ¶ added in v0.0.19
func (*DirEntry) Ctime ¶
Ctime implements the DirEntryAttribute Interface It returns the time the directory was created
func (*DirEntry) IsDir ¶
IsDir implement DirEntryAttribute And returns if the directory is a boolean or not
func (*DirEntry) Mode ¶
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
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) GetChildren ¶
GetChildren returns list of entries in a path
func (*SpaceFSDataSource) Open ¶
func (d *SpaceFSDataSource) Open(ctx context.Context, path string) (FileReadWriterCloser, error)
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.