fs

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WriteScope = "write"
	ReadScope  = "read"
)
View Source
const (
	DefaultTrashDir = ".trash"
	CacheDir        = ".cache"
	Archive         = "archive"
	SyncFolder      = "sync"
)

DefaultTrashDir name of the trash dir

Variables

View Source
var ErrorNotFound = errors.New("not found")

ErrorNotFound not found

View Source
var ErrorWrongGeneration = errors.New("wrong generation")

ErrorWrongGeneration the geration did not match

Functions

func SignURLParams added in v0.0.5

func SignURLParams(parts []string, key []byte) (string, error)

SignURLParams signs url params

func UpdateTree added in v0.0.14

func UpdateTree(tree *models.HashTree, storage *LocalBlobStorage, treeMutation func(t *models.HashTree) error) error

func VerifyURLParams added in v0.0.5

func VerifyURLParams(parts []string, exp, signature string, key []byte) error

VerifyURLParams verify the signature and expiry

Types

type App added in v0.0.5

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

App file system document storage

func NewApp added in v0.0.5

func NewApp(cfg *config.Config, fs *FileSystemStorage) *App

NewApp StorageApp various storage routes

func (*App) RegisterRoutes added in v0.0.5

func (app *App) RegisterRoutes(router *gin.Engine)

RegisterRoutes blah

type FileSystemStorage added in v0.0.5

type FileSystemStorage struct {
	Cfg *config.Config
}

FileSystemStorage store everything to disk

func NewStorage added in v0.0.4

func NewStorage(cfg *config.Config) *FileSystemStorage

NewStorage new file system storage

func (*FileSystemStorage) BlobStorage added in v0.0.14

func (fs *FileSystemStorage) BlobStorage(uid string) *LocalBlobStorage

func (*FileSystemStorage) CreateBlobDocument added in v0.0.5

func (fs *FileSystemStorage) CreateBlobDocument(uid, filename, parent string, stream io.Reader) (doc *storage.Document, err error)

CreateBlobDocument creates a new document

func (*FileSystemStorage) CreateBlobFolder added in v0.0.12

func (fs *FileSystemStorage) CreateBlobFolder(uid, foldername, parent string) (doc *storage.Document, err error)

CreateBlobFolder creates a new folder

func (*FileSystemStorage) CreateDocument added in v0.0.5

func (fs *FileSystemStorage) CreateDocument(uid, filename, parent string, stream io.Reader) (doc *storage.Document, err error)

CreateDocument creates a new document

func (*FileSystemStorage) CreateFolder added in v0.0.12

func (fs *FileSystemStorage) CreateFolder(uid, name, parent string) (*storage.Document, error)

func (*FileSystemStorage) DeleteBlobDocument added in v0.0.12

func (fs *FileSystemStorage) DeleteBlobDocument(uid, docID string) (err error)

DeleteBlobDocument deletes blob document

func (*FileSystemStorage) Export added in v0.0.5

func (fs *FileSystemStorage) Export(uid, docid string) (r io.ReadCloser, err error)

Export exports a document

func (*FileSystemStorage) ExportDocument added in v0.0.5

func (fs *FileSystemStorage) ExportDocument(uid, id, outputType string, exportOption storage.ExportOption) (io.ReadCloser, error)

ExportDocument Exports a document to the outputType

func (*FileSystemStorage) GetAllMetadata added in v0.0.5

func (fs *FileSystemStorage) GetAllMetadata(uid string) (result []*messages.RawMetadata, err error)

GetAllMetadata load all metadata

func (*FileSystemStorage) GetBlobURL added in v0.0.5

func (fs *FileSystemStorage) GetBlobURL(uid, blobid string, write bool) (docurl string, exp time.Time, err error)

GetBlobURL return a url for a file to store

func (*FileSystemStorage) GetCachedTree added in v0.0.12

func (fs *FileSystemStorage) GetCachedTree(uid string) (t *models.HashTree, err error)

GetCachedTree returns the cached blob tree for the user

func (*FileSystemStorage) GetDocument added in v0.0.5

func (fs *FileSystemStorage) GetDocument(uid, id string) (io.ReadCloser, error)

GetDocument Opens a document by id

func (*FileSystemStorage) GetMetadata added in v0.0.5

func (fs *FileSystemStorage) GetMetadata(uid, id string) (*messages.RawMetadata, error)

GetMetadata loads a document's metadata

func (*FileSystemStorage) GetStorageURL added in v0.0.5

func (fs *FileSystemStorage) GetStorageURL(uid, id string) (docurl string, expiration time.Time, err error)

GetStorageURL the storage url

func (*FileSystemStorage) GetUser added in v0.0.5

func (fs *FileSystemStorage) GetUser(uid string) (user *model.User, err error)

GetUser retrieves a user from the storage

func (*FileSystemStorage) GetUsers added in v0.0.5

func (fs *FileSystemStorage) GetUsers() (users []*model.User, err error)

GetUsers gets all users

func (*FileSystemStorage) LoadBlob added in v0.0.5

func (fs *FileSystemStorage) LoadBlob(uid, blobid string) (reader io.ReadCloser, gen int64, size int64, err error)

LoadBlob Opens a blob by id

func (*FileSystemStorage) RegisterUser added in v0.0.5

func (fs *FileSystemStorage) RegisterUser(u *model.User) (err error)

RegisterUser blah

func (*FileSystemStorage) RemoveDocument added in v0.0.5

func (fs *FileSystemStorage) RemoveDocument(uid, id string) error

RemoveDocument removes document (moves it to trash)

func (*FileSystemStorage) RemoveUser added in v0.0.8

func (fs *FileSystemStorage) RemoveUser(uid string) (err error)

RemoveUser remove the user and their data

func (*FileSystemStorage) SaveCachedTree added in v0.0.12

func (fs *FileSystemStorage) SaveCachedTree(uid string, t *models.HashTree) error

SaveCachedTree saves the cached tree

func (*FileSystemStorage) StoreBlob added in v0.0.5

func (fs *FileSystemStorage) StoreBlob(uid, id string, stream io.Reader, lastGen int64) (generation int64, err error)

StoreBlob stores a document

func (*FileSystemStorage) StoreDocument added in v0.0.5

func (fs *FileSystemStorage) StoreDocument(uid, id string, stream io.ReadCloser) error

StoreDocument stores a document

func (*FileSystemStorage) UpdateBlobDocument added in v0.0.12

func (fs *FileSystemStorage) UpdateBlobDocument(uid, docID, name, parent string) (err error)

UpdateBlobDocument updates metadata

func (*FileSystemStorage) UpdateMetadata added in v0.0.5

func (fs *FileSystemStorage) UpdateMetadata(uid string, r *messages.RawMetadata) error

UpdateMetadata updates the metadata of a document

func (*FileSystemStorage) UpdateUser added in v0.0.5

func (fs *FileSystemStorage) UpdateUser(u *model.User) (err error)

UpdateUser updates the user

type LocalBlobStorage added in v0.0.5

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

LocalBlobStorage local file system storage

func (*LocalBlobStorage) GetReader added in v0.0.5

func (p *LocalBlobStorage) GetReader(hash string) (io.ReadCloser, error)

GetReader reader for a given hash

func (*LocalBlobStorage) GetRootIndex added in v0.0.5

func (p *LocalBlobStorage) GetRootIndex() (hash string, gen int64, err error)

GetRootIndex the hash of the root index

func (*LocalBlobStorage) Write added in v0.0.5

func (p *LocalBlobStorage) Write(hash string, r io.Reader) error

Write stores the reader in the hash

func (*LocalBlobStorage) WriteRootIndex added in v0.0.5

func (p *LocalBlobStorage) WriteRootIndex(generation int64, roothash string) (int64, error)

WriteRootIndex writes the root index

type StorageClaim added in v0.0.5

type StorageClaim struct {
	DocumentID string `json:"documentId"`
	UserID     string `json:"userId"`
	jwt.StandardClaims
}

StorageClaim used for file retrieval

Jump to

Keyboard shortcuts

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