Documentation ¶
Index ¶
- Constants
- type CreateDirEntry
- type DirEntryAttribute
- type DirEntryOps
- type DirOps
- type FSOps
- type FileHandler
- type FileHandlerMode
- type FileOps
- type SpaceDirectory
- type SpaceFS
- func (fs *SpaceFS) CreateEntry(ctx context.Context, req CreateDirEntry) (DirEntryOps, error)
- func (fs *SpaceFS) LookupPath(ctx context.Context, path string) (DirEntryOps, error)
- func (fs *SpaceFS) Open(ctx context.Context, path string, mode FileHandlerMode) (FileHandler, error)
- func (fs *SpaceFS) Root(ctx context.Context) (DirEntryOps, error)
- type SpaceFile
Constants ¶
const ( ReadMode = FileHandlerMode(0) WriteMode )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateDirEntry ¶
type DirEntryAttribute ¶
type DirEntryAttribute interface { Name() string // base name of the file Size() uint64 // length in bytes for files; can be anything for directories Mode() os.FileMode // file mode bits Ctime() time.Time // creation time ModTime() time.Time // modification time IsDir() bool }
DirEntryAttribute similar to the FileInfo in the os.Package
type DirEntryOps ¶
type DirEntryOps interface { // Path should return the absolute path string for directory or file // Directory path's should end in `/` Path() string // Attribute should return the metadata information for the file Attribute() (DirEntryAttribute, error) }
DirEntryOps are the list of actions to be invoked on a directry entry A directory entry is either a file or a folder. See DirOps and FileOps for operations specific to those types
type DirOps ¶
type DirOps interface { DirEntryOps ReadDir(ctx context.Context) ([]DirEntryOps, error) }
DirOps are the list of actions that can be done on a directory
type FSOps ¶
type FSOps interface { // Root should return the root directory entry Root(ctx context.Context) (DirEntryOps, error) // LookupPath should return the directory entry at that particular path LookupPath(ctx context.Context, path string) (DirEntryOps, error) // Open a file at specific path, with specified mode Open(ctx context.Context, path string, mode FileHandlerMode) (FileHandler, error) // CreateEntry should create an directory entry and return either a FileOps or DirOps entry // depending on the mode CreateEntry(ctx context.Context, req CreateDirEntry) (DirEntryOps, error) }
FSOps represents the filesystem operations
type FileHandler ¶
type FileHandler interface { io.ReadWriteSeeker io.Closer }
FileHandler is in charge of reading, writing and closing access to a file It should handle locking and track read and write offsets till it is closed
type FileHandlerMode ¶
type FileHandlerMode uint8
type FileOps ¶
type FileOps interface { DirEntryOps Open(ctx context.Context, mode FileHandlerMode) (FileHandler, error) }
FileOps are the list of actions that can be done on a file
type SpaceDirectory ¶
type SpaceDirectory struct {
// contains filtered or unexported fields
}
SpaceDirectory is a directory managed by space
func (*SpaceDirectory) Attribute ¶
func (dir *SpaceDirectory) Attribute() (DirEntryAttribute, error)
Attribute implements DirEntryOps Attribute() and fetches the metadata of the directory
func (*SpaceDirectory) Path ¶
func (dir *SpaceDirectory) Path() string
Path implements DirEntryOps Path() and return the path of the directory
func (*SpaceDirectory) ReadDir ¶
func (dir *SpaceDirectory) ReadDir(ctx context.Context) ([]DirEntryOps, error)
ReadDir implements DirOps ReadDir and returns the list of entries in a directory
type SpaceFS ¶
type SpaceFS struct {
// contains filtered or unexported fields
}
SpaceFS is represents the filesystem that FUSE Interacts with It implements the FSOps interface And is responsible for managing file access, encryption and decryption
func New ¶
func New(store fsds.FSDataSource) (*SpaceFS, error)
New initializes a SpaceFS instance using store as it source of informatioin
func (*SpaceFS) CreateEntry ¶
func (fs *SpaceFS) CreateEntry(ctx context.Context, req CreateDirEntry) (DirEntryOps, error)
func (*SpaceFS) LookupPath ¶
LookupPath implements the FsOps interface for looking up information in a directory
func (*SpaceFS) Open ¶
func (fs *SpaceFS) Open(ctx context.Context, path string, mode FileHandlerMode) (FileHandler, error)
Open a file at specified path
type SpaceFile ¶
type SpaceFile struct {
// contains filtered or unexported fields
}
SpaceFile is a file managed by space
func (*SpaceFile) Attribute ¶
func (f *SpaceFile) Attribute() (DirEntryAttribute, error)
Attribute implements DirEntryOps Attribute() and fetches the metadata of the directory
func (*SpaceFile) Open ¶
func (f *SpaceFile) Open(ctx context.Context, mode FileHandlerMode) (FileHandler, error)
Open implements FileOps Open It should download/cache the content of the file and return a fileHandler that can read the cached content.