fileinfostore

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitNs       = "Init"
	InitTimeKey  = "initTime"
	SchemaVerKey = "SchemaVersion"
	SchemaV1     = "v1"
)

Variables

View Source
var (
	ErrEmpty           = errors.New("can not hash empty string")
	ErrNotFound        = errors.New("file info not found")
	ErrSharingNotFound = errors.New("sharing id not found")
	ErrConflicted      = errors.New("conflict found in hashing")
	ErrVerNotFound     = errors.New("file info schema version not found")
)
View Source
var (
	ErrGreaterThanSize = errors.New("uploaded is greater than file size")
	ErrUploadNotFound  = errors.New("upload info not found")
)

Functions

func IsNotFound

func IsNotFound(err error) bool

Types

type FileInfoStore

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

func NewFileInfoStore

func NewFileInfoStore(store kvstore.IKVStore) (*FileInfoStore, error)

func (*FileInfoStore) AddSharing

func (fi *FileInfoStore) AddSharing(dirPath string) error

func (*FileInfoStore) AddUploadInfo added in v0.6.0

func (fi *FileInfoStore) AddUploadInfo(user, filePath, tmpPath string, fileSize int64) error

func (*FileInfoStore) DelInfo

func (fi *FileInfoStore) DelInfo(itemPath string) error

func (*FileInfoStore) DelSharing

func (fi *FileInfoStore) DelSharing(dirPath string) error

func (*FileInfoStore) DelUploadInfo added in v0.6.0

func (fi *FileInfoStore) DelUploadInfo(user, filePath string) error

func (*FileInfoStore) GetInfo

func (fi *FileInfoStore) GetInfo(itemPath string) (*db.FileInfo, error)

func (*FileInfoStore) GetInfos

func (fi *FileInfoStore) GetInfos(itemPaths []string) (map[string]*db.FileInfo, error)

func (*FileInfoStore) GetSharing

func (fi *FileInfoStore) GetSharing(dirPath string) (bool, bool)

func (*FileInfoStore) GetSharingDir added in v0.5.0

func (fi *FileInfoStore) GetSharingDir(hashID string) (string, error)

func (*FileInfoStore) GetUploadInfo added in v0.6.0

func (fi *FileInfoStore) GetUploadInfo(user, filePath string) (string, int64, int64, error)

func (*FileInfoStore) ListSharings

func (fi *FileInfoStore) ListSharings(prefix string) (map[string]string, error)

func (*FileInfoStore) ListUploadInfo added in v0.6.0

func (fi *FileInfoStore) ListUploadInfo(user string) ([]*db.UploadInfo, error)

func (*FileInfoStore) SetInfo

func (fi *FileInfoStore) SetInfo(itemPath string, info *db.FileInfo) error

func (*FileInfoStore) SetSha1

func (fi *FileInfoStore) SetSha1(itemPath, sign string) error

func (*FileInfoStore) SetUploadInfo added in v0.6.0

func (fi *FileInfoStore) SetUploadInfo(user, filePath string, newUploaded int64) error

type IFileInfoStore

type IFileInfoStore interface {
	AddSharing(dirPath string) error
	DelSharing(dirPath string) error
	GetSharing(dirPath string) (bool, bool)
	ListSharings(prefix string) (map[string]string, error)
	GetInfo(itemPath string) (*db.FileInfo, error)
	SetInfo(itemPath string, info *db.FileInfo) error
	DelInfo(itemPath string) error
	SetSha1(itemPath, sign string) error
	GetInfos(itemPaths []string) (map[string]*db.FileInfo, error)
	GetSharingDir(hashID string) (string, error)
	// upload info
	AddUploadInfo(user, filePath, tmpPath string, fileSize int64) error
	SetUploadInfo(user, filePath string, newUploaded int64) error
	GetUploadInfo(user, filePath string) (string, int64, int64, error)
	DelUploadInfo(user, filePath string) error
	ListUploadInfo(user string) ([]*db.UploadInfo, error)
}

Jump to

Keyboard shortcuts

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