filer

package
v0.0.0-...-9931aa1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("filer: no entry is found in filer store")

Functions

func DeleteDirectoryOrFile

func DeleteDirectoryOrFile(server string, path string, isDir bool) error

Types

type ApiRequest

type ApiRequest struct {
	Command   string //"listFiles", "listDirectories", "getFileSize"
	Directory string
	FileName  string
	FileId    string
}

type DirectoryEntry

type DirectoryEntry struct {
	Name string //dir name without path
	Id   DirectoryId
}

type DirectoryId

type DirectoryId int32

type FileEntry

type FileEntry struct {
	Name string `json:"name,omitempty"` //file name without path
	Id   FileId `json:"fid,omitempty"`
}

type FileId

type FileId string //file id in SeaweedFS

type Filer

type Filer interface {
	CreateFile(fullFileName string, fid string) (err error)
	FindFile(fullFileName string) (fid string, err error)
	DeleteFile(fullFileName string) (fid string, err error)

	//Optional functions. embedded filer support these
	FindDirectory(dirPath string) (dirId DirectoryId, err error)
	ListDirectories(dirPath string) (dirs []DirectoryEntry, err error)
	ListFiles(dirPath string, lastFileName string, limit int) (files []FileEntry, err error)
	DeleteDirectory(dirPath string, recursive bool) (err error)
	Move(fromPath string, toPath string) (err error)
}

type GetFileContentResult

type GetFileContentResult struct {
	Content []byte
	Error   string `json:"error,omitempty"`
}

func GetFileContent

func GetFileContent(server string, fileId string) (ret *GetFileContentResult, err error)

type GetFileSizeResult

type GetFileSizeResult struct {
	Size  uint64
	Error string `json:"error,omitempty"`
}

func GetFileSize

func GetFileSize(server string, fileId string) (ret *GetFileSizeResult, err error)

type ListDirectoriesResult

type ListDirectoriesResult struct {
	Directories []DirectoryEntry
	Error       string `json:"error,omitempty"`
}

func ListDirectories

func ListDirectories(server string, directory string) (ret *ListDirectoriesResult, err error)

type ListFilesResult

type ListFilesResult struct {
	Files []FileEntry
	Error string `json:"error,omitempty"`
}

func ListFiles

func ListFiles(server string, directory string, fileName string) (ret *ListFilesResult, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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