repository

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The method ignored the file
	RepositoryStatusIgnored = iota - 3
	// The file was already existing
	RepositoryStatusExisting
	// The file could not be found
	RepositoryStatusNotFound
	// Everything went well
	RepositoryStatusOK
	// An internal (application) error happened
	RepositoryStatusInternalError
	// An error occurred because of the user
	RepositoryStatusUserError
)

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type PathResultMessage

type PathResultMessage struct {
	Path   string
	Status int
	Err    error
	FileId string
}

PathResultMessage is the message passed to the res channel in AddPath/RemovePath

type Repository

type Repository struct {
	Store fs.Fs
	Index *index.Index
}

Repository is the object that manages the repository

func (*Repository) AddFile

func (repo *Repository) AddFile(ctx context.Context, folder, target, destinationFolder string) (fileIdStr string, status int, err error)

AddFile adds a file to the repository This accepts any regular file, and it does not ignore any file

func (*Repository) AddPath

func (repo *Repository) AddPath(ctx context.Context, folder, target, destinationFolder string, res chan<- PathResultMessage)

AddPath adds a path (a file or a folder, recursively) and reports each element added in the res channel

func (*Repository) AddStream

func (repo *Repository) AddStream(ctx context.Context, in io.ReadCloser, filename, destinationFolder, mimeType string, size int64) (fileIdStr string, status int, err error)

AddStream adds a document to the repository by reading it from a stream

func (*Repository) RemovePath

func (repo *Repository) RemovePath(ctx context.Context, path string, res chan<- PathResultMessage)

RemovePath removes a path by its prefix, and reports each element removed in the res channel

Jump to

Keyboard shortcuts

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