fsds

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EntryNotFound = errors.New("Directory entry not found")

EntryNotFound error when a directory is not found

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 (*DirEntry) Ctime

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

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

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

type FSDataSource

type FSDataSource interface {
	// Get a single node
	Get(ctx context.Context, path string) (*DirEntry, error)
	// GetChildren returns child entries in the file
	GetChildren(ctx context.Context, path string) ([]*DirEntry, error)
	// OpenReader returns a file reader
	Open(ctx context.Context, path string) (ReadSeekCloser, 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 ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Writer
	io.Closer
}

ReadSeekCloser 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) *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

Jump to

Keyboard shortcuts

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