fileinfostore

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitNs      = "Init"
	InfoNs      = "sharing"
	InitTimeKey = "initTime"
)

Variables

View Source
var (
	ErrNotFound = errors.New("file info not found")
)

Functions

func IsNotFound

func IsNotFound(err error) bool

Types

type FileInfo

type FileInfo struct {
	IsDir  bool   `json:"isDir"`
	Shared bool   `json:"shared"`
	Sha1   string `json:"sha1"`
}

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) DelInfo

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

func (*FileInfoStore) DelSharing

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

func (*FileInfoStore) GetInfo

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

func (*FileInfoStore) GetInfos

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

func (*FileInfoStore) GetSharing

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

func (*FileInfoStore) ListSharings

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

func (*FileInfoStore) SetInfo

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

func (*FileInfoStore) SetSha1

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

type IFileInfoStore

type IFileInfoStore interface {
	AddSharing(dirPath string) error
	DelSharing(dirPath string) error
	GetSharing(dirPath string) (bool, bool)
	ListSharings(prefix string) (map[string]bool, error)
	GetInfo(itemPath string) (*FileInfo, error)
	SetInfo(itemPath string, info *FileInfo) error
	DelInfo(itemPath string) error
	SetSha1(itemPath, sign string) error
	GetInfos(itemPaths []string) (map[string]*FileInfo, error)
}

Jump to

Keyboard shortcuts

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