fileshdr

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MsgTypeSha1 = "sha1"

Variables

View Source
var (
	// queries
	FilePathQuery = "fp"
	ListDirQuery  = "dp"
)
View Source
var (
	ErrCreateExisting  = errors.New("create upload info which already exists")
	ErrGreaterThanSize = errors.New("uploaded is greater than file size")
	ErrNotFound        = errors.New("upload info not found")
)

Functions

func UploadNS

func UploadNS(user string) string

Types

type AutoLocker

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

func (*AutoLocker) Exec

func (lk *AutoLocker) Exec(handler func())

type CreateReq

type CreateReq struct {
	Path     string `json:"path"`
	FileSize int64  `json:"fileSize"`
}

type FileHandlers

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

func NewFileHandlers

func NewFileHandlers(cfg gocfg.ICfg, deps *depidx.Deps) (*FileHandlers, error)

func (*FileHandlers) AddSharing

func (h *FileHandlers) AddSharing(c *gin.Context)

func (*FileHandlers) Copy

func (h *FileHandlers) Copy(c *gin.Context)

func (*FileHandlers) CopyDir

func (h *FileHandlers) CopyDir(c *gin.Context)

func (*FileHandlers) Create

func (h *FileHandlers) Create(c *gin.Context)

func (*FileHandlers) DelSharing

func (h *FileHandlers) DelSharing(c *gin.Context)

func (*FileHandlers) DelUploading

func (h *FileHandlers) DelUploading(c *gin.Context)

func (*FileHandlers) Delete

func (h *FileHandlers) Delete(c *gin.Context)

func (*FileHandlers) Download

func (h *FileHandlers) Download(c *gin.Context)

TODO: support ETag

func (*FileHandlers) GenerateHash

func (h *FileHandlers) GenerateHash(c *gin.Context)

func (*FileHandlers) GetStreamReader

func (h *FileHandlers) GetStreamReader(userID uint64, fd io.Reader) (io.ReadCloser, error)

func (*FileHandlers) IsSharing

func (h *FileHandlers) IsSharing(c *gin.Context)

func (*FileHandlers) List

func (h *FileHandlers) List(c *gin.Context)

func (*FileHandlers) ListHome

func (h *FileHandlers) ListHome(c *gin.Context)

func (*FileHandlers) ListSharings

func (h *FileHandlers) ListSharings(c *gin.Context)

func (*FileHandlers) ListUploadings

func (h *FileHandlers) ListUploadings(c *gin.Context)

func (*FileHandlers) MergeFileInfos

func (h *FileHandlers) MergeFileInfos(dirPath string, infos []os.FileInfo) ([]*MetadataResp, error)

func (*FileHandlers) Metadata

func (h *FileHandlers) Metadata(c *gin.Context)

func (*FileHandlers) Mkdir

func (h *FileHandlers) Mkdir(c *gin.Context)

func (*FileHandlers) Move

func (h *FileHandlers) Move(c *gin.Context)

func (*FileHandlers) NewAutoLocker

func (h *FileHandlers) NewAutoLocker(c *gin.Context, key string) *AutoLocker

func (*FileHandlers) UploadChunk

func (h *FileHandlers) UploadChunk(c *gin.Context)

func (*FileHandlers) UploadStatus

func (h *FileHandlers) UploadStatus(c *gin.Context)

type GenerateHashReq

type GenerateHashReq struct {
	FilePath string `json:"filePath"`
}

type ListResp

type ListResp struct {
	Cwd       string          `json:"cwd"`
	Metadatas []*MetadataResp `json:"metadatas"`
}

type ListUploadingsResp

type ListUploadingsResp struct {
	UploadInfos []*UploadInfo `json:"uploadInfos"`
}

type MetadataResp

type MetadataResp struct {
	Name    string    `json:"name"`
	Size    int64     `json:"size"`
	ModTime time.Time `json:"modTime"`
	IsDir   bool      `json:"isDir"`
	Sha1    string    `json:"sha1"`
}

type MkdirReq

type MkdirReq struct {
	Path string `json:"path"`
}

type MoveReq

type MoveReq struct {
	OldPath string `json:"oldPath"`
	NewPath string `json:"newPath"`
}

type Sha1Params

type Sha1Params struct {
	FilePath string
}

type SharingReq

type SharingReq struct {
	SharingPath string `json:"sharingPath"`
}

type SharingResp

type SharingResp struct {
	SharingDirs []string `json:"sharingDirs"`
}

type UploadChunkReq

type UploadChunkReq struct {
	Path    string `json:"path"`
	Content string `json:"content"`
	Offset  int64  `json:"offset"`
}

type UploadInfo

type UploadInfo struct {
	RealFilePath string `json:"realFilePath"`
	Size         int64  `json:"size"`
	Uploaded     int64  `json:"uploaded"`
}

type UploadMgr

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

func NewUploadMgr

func NewUploadMgr(kv kvstore.IKVStore) *UploadMgr

func (*UploadMgr) AddInfo

func (um *UploadMgr) AddInfo(user, filePath, tmpPath string, fileSize int64) error

func (*UploadMgr) DelInfo

func (um *UploadMgr) DelInfo(user, filePath string) error

func (*UploadMgr) GetInfo

func (um *UploadMgr) GetInfo(user, filePath string) (string, int64, int64, error)

func (*UploadMgr) ListInfo

func (um *UploadMgr) ListInfo(user string) ([]*UploadInfo, error)

func (*UploadMgr) SetInfo

func (um *UploadMgr) SetInfo(user, filePath string, newUploaded int64) error

type UploadStatusResp

type UploadStatusResp struct {
	Path     string `json:"path"`
	IsDir    bool   `json:"isDir"`
	FileSize int64  `json:"fileSize"`
	Uploaded int64  `json:"uploaded"`
}

Jump to

Keyboard shortcuts

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