mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
This commit is contained in:
parent
5c1cbef025
commit
c70f7ee28c
5 changed files with 18 additions and 6 deletions
|
|
@ -883,6 +883,7 @@
|
||||||
"138": "Data repository key is set",
|
"138": "Data repository key is set",
|
||||||
"139": "Data snapshot is being generated, [%s] data files have been processed, [%s] remaining...",
|
"139": "Data snapshot is being generated, [%s] data files have been processed, [%s] remaining...",
|
||||||
"140": "Failed to create data snapshot",
|
"140": "Failed to create data snapshot",
|
||||||
"141": "Failed to rollback data snapshot"
|
"141": "Failed to rollback data snapshot",
|
||||||
|
"142": "Snapshot memo cannot be empty"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -883,6 +883,7 @@
|
||||||
"138": "La clé du référentiel de données est définie",
|
"138": "La clé du référentiel de données est définie",
|
||||||
"139": "L'instantané des données est en cours de génération, [%s] fichiers de données ont été traités, [%s] restants...",
|
"139": "L'instantané des données est en cours de génération, [%s] fichiers de données ont été traités, [%s] restants...",
|
||||||
"140": "Échec de la création de l'instantané des données",
|
"140": "Échec de la création de l'instantané des données",
|
||||||
"141": "Échec de la restauration de l'instantané des données"
|
"141": "Échec de la restauration de l'instantané des données",
|
||||||
|
"142": "Le mémo d'instantané ne peut pas être vide"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -882,6 +882,7 @@
|
||||||
"138": "數據倉庫密鑰設置完畢",
|
"138": "數據倉庫密鑰設置完畢",
|
||||||
"139": "正在生成數據快照,已處理 [%s] 個數據文件,剩餘待處理 [%s]...",
|
"139": "正在生成數據快照,已處理 [%s] 個數據文件,剩餘待處理 [%s]...",
|
||||||
"140": "創建數據快照失敗",
|
"140": "創建數據快照失敗",
|
||||||
"141": "回滾數據快照失敗"
|
"141": "回滾數據快照失敗",
|
||||||
|
"142": "快照備註不能為空"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"memo"
|
||||||
"createSnapshot": "创建快照",
|
"createSnapshot": "创建快照",
|
||||||
"dataSnapshot": "数据快照",
|
"dataSnapshot": "数据快照",
|
||||||
"copyKey": "复制密钥字符串",
|
"copyKey": "复制密钥字符串",
|
||||||
|
|
@ -884,6 +885,7 @@
|
||||||
"138": "数据仓库密钥设置完毕",
|
"138": "数据仓库密钥设置完毕",
|
||||||
"139": "正在生成数据快照,已处理 [%s] 个数据文件,剩余待处理 [%s]...",
|
"139": "正在生成数据快照,已处理 [%s] 个数据文件,剩余待处理 [%s]...",
|
||||||
"140": "创建数据快照失败",
|
"140": "创建数据快照失败",
|
||||||
"141": "回滚数据快照失败"
|
"141": "回滚数据快照失败",
|
||||||
|
"142": "快照备注不能为空"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/88250/gulu"
|
||||||
"github.com/siyuan-note/dejavu"
|
"github.com/siyuan-note/dejavu"
|
||||||
"github.com/siyuan-note/dejavu/entity"
|
"github.com/siyuan-note/dejavu/entity"
|
||||||
"github.com/siyuan-note/encryption"
|
"github.com/siyuan-note/encryption"
|
||||||
|
|
@ -148,12 +149,18 @@ var indexCallbacks = map[string]dejavu.Callback{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func IndexRepo(message string) (err error) {
|
func IndexRepo(memo string) (err error) {
|
||||||
if 1 > len(Conf.Repo.Key) {
|
if 1 > len(Conf.Repo.Key) {
|
||||||
err = errors.New("repo key is nil")
|
err = errors.New("repo key is nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memo = gulu.Str.RemoveInvisible(memo)
|
||||||
|
if "" == memo {
|
||||||
|
err = errors.New(Conf.Language(142))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
repo, err := dejavu.NewRepo(util.DataDir, util.RepoDir, Conf.Repo.Key)
|
repo, err := dejavu.NewRepo(util.DataDir, util.RepoDir, Conf.Repo.Key)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
util.LogErrorf("init repo failed: %s", err)
|
util.LogErrorf("init repo failed: %s", err)
|
||||||
|
|
@ -164,7 +171,7 @@ func IndexRepo(message string) (err error) {
|
||||||
syncLock.Lock()
|
syncLock.Lock()
|
||||||
defer syncLock.Unlock()
|
defer syncLock.Unlock()
|
||||||
filesys.ReleaseAllFileLocks()
|
filesys.ReleaseAllFileLocks()
|
||||||
_, err = repo.Index(message, util.PushEndlessProgress, indexCallbacks)
|
_, err = repo.Index(memo, util.PushEndlessProgress, indexCallbacks)
|
||||||
util.PushClearProgress()
|
util.PushClearProgress()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue