Skip to content

Commit

Permalink
🎨 Improve data sync siyuan-note/siyuan#13133
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 13, 2024
1 parent 31885fe commit 43798fe
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 217 deletions.
2 changes: 1 addition & 1 deletion backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (repo *Repo) uploadTagIndex(tag, id string, context map[string]interface{})
apiPut++

// 上传标签
_, length, err = repo.updateCloudRef("refs/tags/"+tag, context)
length, err = repo.updateCloudRef("refs/tags/"+tag, context)
uploadFileCount++
uploadBytes += length
apiPut++
Expand Down
1 change: 0 additions & 1 deletion cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ var (
ErrSystemTimeIncorrect = errors.New("system time incorrect") // ErrSystemTimeIncorrect 描述了系统时间不正确的错误
ErrDeprecatedVersion = errors.New("deprecated version") // ErrDeprecatedVersion 描述了版本过低的错误
ErrCloudCheckFailed = errors.New("cloud check failed") // ErrCloudCheckFailed 描述了云端存储服务检查失败的错误
ErrCloudIndexChanged = errors.New("cloud index changed") // ErrCloudIndexChanged 描述了云端快照已变更的错误
ErrCloudForbidden = errors.New("cloud forbidden") // ErrCloudForbidden 描述了云端存储服务禁止访问的错误
ErrCloudTooManyRequests = errors.New("cloud too many requests") // ErrCloudTooManyRequests 描述了云端存储服务请求过多的错误
)
Expand Down
21 changes: 21 additions & 0 deletions repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,28 @@ func (repo *Repo) openFile(file *entity.File) (ret []byte, err error) {
return
}

func (repo *Repo) removeFiles(files []*entity.File, context map[string]interface{}) (err error) {
total := len(files)
if 1 > total {
return
}

eventbus.Publish(eventbus.EvtCheckoutRemoveFiles, context, total)
for i, file := range files {
absPath := repo.absPath(file.Path)
if err = filelock.Remove(absPath); nil != err {
return
}
eventbus.Publish(eventbus.EvtCheckoutRemoveFile, context, i+1, total)
}
return
}

func (repo *Repo) checkoutFiles(files []*entity.File, context map[string]interface{}) (err error) {
if 1 > len(files) {
return
}

//now := time.Now()

var dotSiYuans, assets, emojis, storage, plugins, widgets, templates, public, others, all []*entity.File
Expand Down
Loading

0 comments on commit 43798fe

Please sign in to comment.