Documentation ¶
Index ¶
- Variables
- type APITrafficStat
- type DownloadTrafficStat
- type LeftRightDiff
- type Log
- type MergeResult
- type Repo
- 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) CountIndexes() (ret int, err error)
- func (repo *Repo) CreateCloudRepo(name string) (err error)
- func (repo *Repo) DiffIndex(leftIndexID, rightIndexID string) (ret *LeftRightDiff, err error)
- func (repo *Repo) DownloadIndex(id string, context map[string]interface{}) (downloadFileCount, downloadChunkCount int, downloadBytes int64, err error)
- 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) GetCloudLatest(context map[string]interface{}) (cloudLatest *entity.Index, err error)
- func (repo *Repo) GetCloudRepoLogs(page int) (ret []*Log, pageCount, totalCount int, err error)
- 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) GetIndexes(page, pageSize int) (ret []*entity.Index, totalCount, pageCount int, err error)
- func (repo *Repo) GetSyncCloudFiles(cloudLatest *entity.Index, 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) Purge(retentionIndexIDs ...string) (ret *entity.PurgeStat, err error)
- func (repo *Repo) PurgeCloud() (ret *entity.PurgeStat, 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) Reset() (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(index *entity.Index) (err error)
- func (repo *Repo) UpdateLatestSync(index *entity.Index) (err error)
- func (repo *Repo) UploadTagIndex(tag, id string, context map[string]interface{}) (uploadFileCount, uploadChunkCount int, uploadBytes int64, err error)
- type Store
- 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) Purge(retentionIndexIDs ...string) (ret *entity.PurgeStat, err error)
- 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
- type UploadTrafficStat
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRepoFatal = errors.New("repo fatal error") ErrEmptyIndex = errors.New("empty index") // ErrIndexFileChanged indicates that the file has changed during the index process. // Improve data snapshot and sync robustness https://github.com/siyuan-note/siyuan/issues/9941 ErrIndexFileChanged = errors.New("file changed") )
View Source
var ( ErrCloudStorageSizeExceeded = errors.New("cloud storage limit size exceeded") ErrCloudBackupCountExceeded = errors.New("cloud backup count exceeded") ErrCloudGenerateConflictHistory = errors.New("generate conflict history failed") )
View Source
var ( ErrLockCloudFailed = errors.New("lock cloud repo failed") ErrCloudLocked = errors.New("cloud repo is locked") )
View Source
var ErrNotFoundIndex = errors.New("not found index")
View Source
var ErrNotFoundObject = errors.New("not found object")
Functions ¶
This section is empty.
Types ¶
type APITrafficStat ¶
type DownloadTrafficStat ¶
type LeftRightDiff ¶
type Log ¶
type Log struct { ID string `json:"id"` // 索引 ID Memo string `json:"memo"` // 索引备注 Created int64 `json:"created"` // 索引时间 HCreated string `json:"hCreated"` // 索引时间 "2006-01-02 15:04:05" Files []*entity.File `json:"files"` // 文件列表 Count int `json:"count"` // 文件总数 Size int64 `json:"size"` // 文件总大小 HSize string `json:"hSize"` // 格式化好的文件总大小 "10.00 MB" SystemID string `json:"systemID"` // 设备 ID SystemName string `json:"systemName"` // 设备名称 SystemOS string `json:"systemOS"` // 设备操作系统 Tag string `json:"tag"` // 索引标记名称 HTagUpdated string `json:"hTagUpdated"` // 标记时间 "2006-01-02 15:04:05" }
type MergeResult ¶
func (*MergeResult) DataChanged ¶
func (mr *MergeResult) DataChanged() bool
type Repo ¶
type Repo struct { DataPath string // 数据文件夹的绝对路径,如:F:\\SiYuan\\data\\ Path string // 仓库的绝对路径,如:F:\\SiYuan\\repo\\ HistoryPath string // 数据历史文件夹的绝对路径,如:F:\\SiYuan\\history\\ TempPath string // 临时文件夹的绝对路径,如:F:\\SiYuan\\temp\\ DeviceID string // 设备 ID DeviceName string // 设备名称 DeviceOS string // 操作系统 IgnoreLines []string // 忽略配置文件内容行,是用 .gitignore 语法 // contains filtered or unexported fields }
Repo 描述了逮虾户数据仓库。
func NewRepo ¶
func NewRepo(dataPath, repoPath, historyPath, tempPath, deviceID, deviceName, deviceOS string, aesKey []byte, ignoreLines []string, cloud cloud.Cloud) (ret *Repo, err error)
NewRepo 创建一个新的仓库。
func (*Repo) Checkout ¶
func (repo *Repo) Checkout(id string, context map[string]interface{}) (upserts, removes []*entity.File, err error)
Checkout 将仓库中的数据迁出到 repo 数据文件夹下。context 参数用于发布事件时传递调用上下文。
func (*Repo) CheckoutFilesFromCloud ¶
func (*Repo) CountIndexes ¶
func (*Repo) CreateCloudRepo ¶
func (*Repo) DiffIndex ¶
func (repo *Repo) DiffIndex(leftIndexID, rightIndexID string) (ret *LeftRightDiff, err error)
DiffIndex 返回索引 left 比索引 right 新增、更新和删除的文件列表。
func (*Repo) DownloadIndex ¶
func (*Repo) DownloadTagIndex ¶
func (*Repo) GetCloudAvailableSize ¶
func (*Repo) GetCloudLatest ¶
func (*Repo) GetCloudRepoLogs ¶
func (*Repo) GetCloudRepoTagLogs ¶
func (*Repo) GetCloudRepos ¶
func (*Repo) GetIndexLogs ¶
func (*Repo) GetIndexes ¶
func (*Repo) GetSyncCloudFiles ¶
func (*Repo) GetTagLogs ¶
func (*Repo) PurgeCloud ¶
PurgeCloud 清理云端所有未引用数据。 Support manual purge of unreferenced data snapshots in the S3/WebDAV cloud storage https://github.com/siyuan-note/siyuan/issues/10081
func (*Repo) RemoveCloudRepo ¶
func (*Repo) RemoveCloudRepoTag ¶
func (*Repo) Sync ¶
func (repo *Repo) Sync(context map[string]interface{}) (mergeResult *MergeResult, trafficStat *TrafficStat, err error)
func (*Repo) SyncDownload ¶
func (repo *Repo) SyncDownload(context map[string]interface{}) (mergeResult *MergeResult, trafficStat *TrafficStat, err error)
func (*Repo) SyncUpload ¶
func (repo *Repo) SyncUpload(context map[string]interface{}) (trafficStat *TrafficStat, err error)
type Store ¶
type Store struct { Path string // 存储库文件夹的绝对路径,如:F:\\SiYuan\\repo\\ AesKey []byte // contains filtered or unexported fields }
Store 描述了存储库。
func (*Store) IndexAbsPath ¶
type TrafficStat ¶
type TrafficStat struct { DownloadTrafficStat UploadTrafficStat APITrafficStat // contains filtered or unexported fields }
type UploadTrafficStat ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.