filestore

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

type FileStore interface {
	CreateFile(req *model.CreateFileRequest, file io.Reader) error
	CreateDir(req *model.CreateFileRequest) error

	ListDir(req *model.ListFilesRequest) ([]*model.ListFilesResponse, error)
	ReadFile(path string) (*model.File, error)

	DeleteDir(path string) error
	DeleteFile(path string) error

	GetStoreType() utils.FileStoreType
	Close() error
}

FileStore abstracts the implementation file storage operations

type Module

type Module struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Module is responsible for managing the file storage module

func Init

func Init(auth *auth.Module) *Module

Init creates a new instance of the file store object

func (*Module) CreateDir

func (m *Module) CreateDir(project, token string, req *model.CreateFileRequest) (int, error)

CreateDir creates a directory at the provided path

func (*Module) DeleteFile

func (m *Module) DeleteFile(project, token, path string) (int, error)

DeleteFile deletes a file at the provided path

func (*Module) DownloadFile

func (m *Module) DownloadFile(project, token, path string) (int, *model.File, error)

DownloadFile downloads a file from the provided path

func (*Module) IsEnabled

func (m *Module) IsEnabled() bool

IsEnabled checks if the file store module is enabled

func (*Module) ListFiles

func (m *Module) ListFiles(project, token string, req *model.ListFilesRequest) (int, []*model.ListFilesResponse, error)

ListFiles lists all the files in the provided path

func (*Module) SetConfig

func (m *Module) SetConfig(conf *config.FileStore) error

SetConfig set the rules and secret key required by the crud block

func (*Module) UploadFile

func (m *Module) UploadFile(project, token string, req *model.CreateFileRequest, reader io.Reader) (int, error)

UploadFile uploads a file to the provided path

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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