Versions in this module Expand all Collapse all v0 v0.0.2 Mar 26, 2023 v0.0.1 Mar 26, 2023 Changes in this version + var ErrCloudBackupCountExceeded = errors.New("cloud backup count exceeded") + var ErrCloudGenerateConflictHistory = errors.New("generate conflict history failed") + var ErrCloudLocked = errors.New("cloud repo is locked") + var ErrCloudStorageSizeExceeded = errors.New("cloud storage limit size exceeded") + var ErrLockCloudFailed = errors.New("lock cloud repo failed") + var ErrNotFoundIndex = errors.New("not found index") + var ErrNotFoundObject = errors.New("not found object") + var ErrRepoFatalErr = errors.New("repo fatal error") + type DownloadTrafficStat struct + DownloadBytes int64 + DownloadChunkCount int + DownloadFileCount int + type LeftRightDiff struct + AddsLeft []*entity.File + LeftIndex *entity.Index + RemovesRight []*entity.File + RightIndex *entity.Index + UpdatesLeft []*entity.File + UpdatesRight []*entity.File + type Log struct + Count int + Created int64 + Files []*entity.File + HCreated string + HSize string + HTagUpdated string + ID string + Memo string + Parent string + Size int64 + Tag string + func (log *Log) String() string + type MergeResult struct + Conflicts []*entity.File + Removes []*entity.File + Time time.Time + Upserts []*entity.File + type Repo struct + DataPath string + DeviceID string + HistoryPath string + IgnoreLines []string + Path string + TempPath string + func NewRepo(dataPath, repoPath, historyPath, tempPath, deviceID string, aesKey []byte, ...) (ret *Repo, err error) + func (repo *Repo) AddTag(id, tag string) (err error) + func (repo *Repo) Checkout(id string, context map[string]interface{}) (upserts, removes []*entity.File, err error) + func (repo *Repo) CheckoutFilesFromCloud(files []*entity.File, context map[string]interface{}) (stat *DownloadTrafficStat, err error) + func (repo *Repo) CreateCloudRepo(name string) (err error) + func (repo *Repo) DiffIndex(leftIndexID, rightIndexID string) (ret *LeftRightDiff, err error) + func (repo *Repo) DiffUpsertRemove(left, right []*entity.File) (upserts, removes []*entity.File) + func (repo *Repo) DownloadTagIndex(tag, id string, context map[string]interface{}) (downloadFileCount, downloadChunkCount int, downloadBytes int64, err error) + func (repo *Repo) GetCloudAvailableSize() (ret int64) + func (repo *Repo) GetCloudRepoStat() (stat *cloud.Stat, err error) + func (repo *Repo) GetCloudRepoTagLogs(context map[string]interface{}) (ret []*Log, err error) + func (repo *Repo) GetCloudRepos() (repos []*cloud.Repo, size int64, err error) + func (repo *Repo) GetFile(fileID string) (ret *entity.File, err error) + func (repo *Repo) GetFiles(index *entity.Index) (ret []*entity.File, err error) + func (repo *Repo) GetIndex(id string) (index *entity.Index, err error) + func (repo *Repo) GetIndexLogs(page, pageSize int) (ret []*Log, pageCount, totalCount int, err error) + func (repo *Repo) GetSyncCloudFiles(context map[string]interface{}) (fetchedFiles []*entity.File, err error) + func (repo *Repo) GetTag(tag string) (id string, err error) + func (repo *Repo) GetTagLogs() (ret []*Log, err error) + func (repo *Repo) Index(memo string, context map[string]interface{}) (ret *entity.Index, err error) + func (repo *Repo) Latest() (ret *entity.Index, err error) + func (repo *Repo) OpenFile(file *entity.File) (ret []byte, err error) + func (repo *Repo) OpenFileByID(fileID string) (ret []byte, err error) + func (repo *Repo) PutIndex(index *entity.Index) (err error) + func (repo *Repo) RemoveCloudRepo(name string) (err error) + func (repo *Repo) RemoveCloudRepoTag(tag string) (err error) + func (repo *Repo) RemoveTag(tag string) (err error) + func (repo *Repo) Sync(context map[string]interface{}) (mergeResult *MergeResult, trafficStat *TrafficStat, err error) + func (repo *Repo) SyncDownload(context map[string]interface{}) (mergeResult *MergeResult, trafficStat *TrafficStat, err error) + func (repo *Repo) SyncUpload(context map[string]interface{}) (trafficStat *TrafficStat, err error) + func (repo *Repo) UpdateLatest(id string) (err error) + func (repo *Repo) UpdateLatestSync(id string) (err error) + func (repo *Repo) UploadTagIndex(tag, id string, context map[string]interface{}) (uploadFileCount, uploadChunkCount int, uploadBytes int64, err error) + type Store struct + AesKey []byte + Path string + func NewStore(path string, aesKey []byte) (ret *Store, err error) + func (store *Store) AbsPath(id string) (dir, file string) + func (store *Store) GetChunk(id string) (ret *entity.Chunk, err error) + func (store *Store) GetFile(id string) (ret *entity.File, err error) + func (store *Store) GetIndex(id string) (ret *entity.Index, err error) + func (store *Store) IndexAbsPath(id string) (dir, file string) + func (store *Store) PutChunk(chunk *entity.Chunk) (err error) + func (store *Store) PutFile(file *entity.File) (err error) + func (store *Store) PutIndex(index *entity.Index) (err error) + func (store *Store) Remove(id string) (err error) + func (store *Store) Stat(id string) (stat os.FileInfo, err error) + type TrafficStat struct + type UploadTrafficStat struct + UploadBytes int64 + UploadChunkCount int + UploadFileCount int