🎨 Support manual purge of unreferenced data snapshots in the S3/WebDAV cloud storage https://github.com/siyuan-note/siyuan/issues/10081
This commit is contained in:
parent
bb49855133
commit
ce2c774baf
10 changed files with 96 additions and 12 deletions
|
@ -1391,6 +1391,15 @@
|
|||
"220": "Due to a defect in the previous version, the cloud data is corrupted. Please refer to the User Guide-FAQ-Lost Key steps to reset the local data repo and cloud directory",
|
||||
"221": "The replacement operation is not supported after grouping by document. Please use ungrouping and then replace",
|
||||
"222": "Data sync is in progress, please wait until data sync is completed and try again",
|
||||
"223": "Cleaning cloud storage..."
|
||||
"223": "Purging cloud storage...",
|
||||
"224": "Listing cloud storage data objects...",
|
||||
"225": "Listing cloud storage snapshots...",
|
||||
"226": "Listing cloud storage snapshot references...",
|
||||
"227": "Downloading cloud storage snapshot [%s]...",
|
||||
"228": "Downloading cloud storage data files...",
|
||||
"229": "Deleting cloud storage unreferenced snapshots...",
|
||||
"230": "Deleting cloud storage unreferenced verification snapshots...",
|
||||
"231": "Deleting unreferenced data objects in cloud storage...",
|
||||
"232": "The cloud data storage has been purged. [%d] snapshots and [%d] data objects have been deleted, and a total of [%s] disk space has been released"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1391,6 +1391,15 @@
|
|||
"220": "Debido a un defecto en la versión anterior, los datos de la nube están dañados. Consulte los pasos de la User Guide-FAQ-Lost Key para restablecer el repositorio de datos local y el directorio de la nube",
|
||||
"221": "La operación de reemplazo no es compatible después de agrupar por documento. Utilice desagrupar y luego reemplazar",
|
||||
"222": "La sincronización de datos está en curso. Espere hasta que se complete la sincronización de datos e inténtelo de nuevo",
|
||||
"223": "Limpiando el almacenamiento en la nube..."
|
||||
"223": "Borrar almacenamiento en la nube...",
|
||||
"224": "Lista de objetos de datos de almacenamiento en la nube...",
|
||||
"225": "Listado de instantáneas de almacenamiento en la nube...",
|
||||
"226": "Listado de referencias de instantáneas de almacenamiento en la nube...",
|
||||
"227": "Descargando instantánea de almacenamiento en la nube [%s]...",
|
||||
"228": "Descargando archivos de datos de almacenamiento en la nube...",
|
||||
"229": "Eliminando instantáneas sin referencia del almacenamiento en la nube...",
|
||||
"230": "Eliminando instantáneas de verificación sin referencia del almacenamiento en la nube...",
|
||||
"231": "Eliminar objetos de datos no referenciados en el almacenamiento en la nube...",
|
||||
"232": "Se ha eliminado el almacenamiento de datos en la nube. Se han eliminado [%d] instantáneas y [%d] objetos de datos, y se ha liberado un total de [%s] espacio en disco"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1391,6 +1391,15 @@
|
|||
"220": "En raison d'un défaut dans la version précédente, les données cloud sont corrompues. Veuillez vous référer aux étapes User Guide-FAQ-Lost Key pour réinitialiser le référentiel de données local et le répertoire cloud",
|
||||
"221": "L'opération de remplacement n'est pas prise en charge après le regroupement par document. Veuillez utiliser le dissociation puis remplacer",
|
||||
"222": "La synchronisation des données est en cours, veuillez attendre que la synchronisation des données soit terminée et réessayer",
|
||||
"223": "Nettoyage du stockage cloud..."
|
||||
"223": "Purger le stockage cloud...",
|
||||
"224": "Liste des objets de données de stockage cloud...",
|
||||
"225": "Liste des instantanés de stockage cloud...",
|
||||
"226": "Liste des références d'instantanés de stockage cloud...",
|
||||
"227": "Téléchargement de l'instantané de stockage cloud [%s]...",
|
||||
"228": "Téléchargement des fichiers de données de stockage cloud...",
|
||||
"229": "Suppression des instantanés non référencés du stockage cloud...",
|
||||
"230": "Suppression des instantanés de vérification non référencés du stockage cloud...",
|
||||
"231": "Suppression des objets de données non référencés dans le stockage cloud...",
|
||||
"232": "Le stockage de données cloud a été purgé. [%d] instantanés et [%d] objets de données ont été supprimés, et un total de [%s] espace disque a été libéré"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1391,6 +1391,15 @@
|
|||
"220": "由於先前版本的缺陷導致了雲端資料損壞,請參考 用戶指南-常見問題-遺失密鑰 步驟來重置本地資料倉儲和雲端目錄",
|
||||
"221": "按文檔分組後不支援替換操作,請使用取消分組後再進行替換",
|
||||
"222": "資料同步中,請等待資料同步完成後再試",
|
||||
"223": "正在清理雲端儲存..."
|
||||
"223": "正在清理雲端儲存...",
|
||||
"224": "正在列出雲端儲存資料物件...",
|
||||
"225": "正在列出雲端儲存快照...",
|
||||
"226": "正在列出雲端儲存快照引用...",
|
||||
"227": "正在下載雲端儲存快照 [%s]...",
|
||||
"228": "正在下載雲端儲存資料檔...",
|
||||
"229": "正在刪除雲端儲存未引用快照...",
|
||||
"230": "正在刪除雲端儲存未引用校驗快照...",
|
||||
"231": "正在刪除雲端儲存未引用資料物件...",
|
||||
"232": "雲端資料儲存清理完畢,已刪除 [%d] 個快照和 [%d] 個資料對象,共釋放 [%s] 磁碟空間"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1391,6 +1391,15 @@
|
|||
"220": "由于之前版本的缺陷导致了云端数据损坏,请参考 用户指南-常见问题-遗失密钥 步骤来重置本地数据仓库和云端目录",
|
||||
"221": "按文档分组后不支持替换操作,请使用取消分组后再进行替换",
|
||||
"222": "数据同步中,请等待数据同步完成后再试",
|
||||
"223": "正在清理云端存储..."
|
||||
"223": "正在清理云端存储...",
|
||||
"224": "正在列出云端存储数据对象...",
|
||||
"225": "正在列出云端存储快照...",
|
||||
"226": "正在列出云端存储快照引用...",
|
||||
"227": "正在下载云端存储快照 [%s]...",
|
||||
"228": "正在下载云端存储数据文件...",
|
||||
"229": "正在删除云端存储未引用快照...",
|
||||
"230": "正在删除云端存储未引用校验快照...",
|
||||
"231": "正在删除云端存储未引用数据对象...",
|
||||
"232": "云端数据存储清理完毕,已删除 [%d] 个快照和 [%d] 个数据对象,共释放 [%s] 磁盘空间"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,3 +419,15 @@ func purgeRepo(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
func purgeCloudRepo(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
if err := model.PurgeCloud(); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = fmt.Sprintf(model.Conf.Language(201), err.Error())
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 5000}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,6 +349,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/repo/initRepoKeyFromPassphrase", model.CheckAuth, model.CheckReadonly, initRepoKeyFromPassphrase)
|
||||
ginServer.Handle("POST", "/api/repo/resetRepo", model.CheckAuth, model.CheckReadonly, resetRepo)
|
||||
ginServer.Handle("POST", "/api/repo/purgeRepo", model.CheckAuth, model.CheckReadonly, purgeRepo)
|
||||
ginServer.Handle("POST", "/api/repo/purgeCloudRepo", model.CheckAuth, model.CheckReadonly, purgeCloudRepo)
|
||||
ginServer.Handle("POST", "/api/repo/importRepoKey", model.CheckAuth, model.CheckReadonly, importRepoKey)
|
||||
ginServer.Handle("POST", "/api/repo/createSnapshot", model.CheckAuth, model.CheckReadonly, createSnapshot)
|
||||
ginServer.Handle("POST", "/api/repo/tagSnapshot", model.CheckAuth, model.CheckReadonly, tagSnapshot)
|
||||
|
|
|
@ -51,9 +51,9 @@ require (
|
|||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
||||
github.com/sashabaranov/go-openai v1.18.3
|
||||
github.com/shirou/gopsutil/v3 v3.23.12
|
||||
github.com/siyuan-note/dejavu v0.0.0-20240123025532-2ca98172b05f
|
||||
github.com/siyuan-note/dejavu v0.0.0-20240124050424-be48ff329ebf
|
||||
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240114153055-cf4c124ddf6d
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240124035703-9092bf8e8f48
|
||||
github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1
|
||||
github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690
|
||||
github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0
|
||||
|
|
|
@ -352,12 +352,12 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
|
|||
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
|
||||
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
|
||||
github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20240123025532-2ca98172b05f h1:BsUy5lKm17gbeeTupvSWQH6wlwrou7qiMDe6TZERkYA=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20240123025532-2ca98172b05f/go.mod h1:f5VvNOtytQblmaM4zYgm+VYcokqUR3z6IcrWMhalk6A=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20240124050424-be48ff329ebf h1:C8QfMrXu+/ETqVcgkSASkjXNwJDYeZQXd+pBymAQqYY=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20240124050424-be48ff329ebf/go.mod h1:yFeL7vYskRZBKwtaSRb4t6Ys3ir66P+X4fe55/Rdv7E=
|
||||
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/evyW6LcB9IQT8PR4ppx8JVqOFP9Ix3rfwSrc=
|
||||
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240114153055-cf4c124ddf6d h1:ZFhIq+gy5w+FJNX3D4yIp5Aj1H/dM0rrkEdRtk3Ia44=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240114153055-cf4c124ddf6d/go.mod h1:1/nGgthl89FPA7GzAcEWKl6zRRnfgyTjzLZj9bW7kuw=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240124035703-9092bf8e8f48 h1:qEeZUvXFIfONrl7Eaf8fSP/NswHkKM2XMbb9yrMNqbY=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20240124035703-9092bf8e8f48/go.mod h1:1/nGgthl89FPA7GzAcEWKl6zRRnfgyTjzLZj9bW7kuw=
|
||||
github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1 h1:eNHKiqE5yPnj1PYk0PJhxP+oqWdKi+0ZI28lBQmz5qg=
|
||||
github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1/go.mod h1:CYJQjSyKYLhEJJC+5I+R4uNcpyW0X2CaUYwMVbkelDk=
|
||||
github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690 h1:r7qWSaYQhomCAdQl/dZe4NdAn1zadytb4jcOeopdHw4=
|
||||
|
|
|
@ -502,7 +502,7 @@ func PurgeCloud() (err error) {
|
|||
deletedIndexes := stat.Indexes
|
||||
deletedObjects := stat.Objects
|
||||
deletedSize := humanize.Bytes(uint64(stat.Size))
|
||||
msg = fmt.Sprintf(Conf.Language(203), deletedIndexes, deletedObjects, deletedSize)
|
||||
msg = fmt.Sprintf(Conf.Language(232), deletedIndexes, deletedObjects, deletedSize)
|
||||
util.PushMsg(msg, 5000)
|
||||
return
|
||||
}
|
||||
|
@ -1833,6 +1833,32 @@ func subscribeRepoEvents() {
|
|||
eventbus.Subscribe(eventbus.EvtCloudCorrupted, func() {
|
||||
util.PushErrMsg(Conf.language(220), 30000)
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeListObjects, func(context map[string]interface{}) {
|
||||
util.ContextPushMsg(context, Conf.language(224))
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeListIndexes, func(context map[string]interface{}) {
|
||||
util.ContextPushMsg(context, Conf.language(225))
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeListRefs, func(context map[string]interface{}) {
|
||||
util.ContextPushMsg(context, Conf.language(226))
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeDownloadIndex, func(context map[string]interface{}, id string) {
|
||||
msg := fmt.Sprintf(Conf.language(227), id)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeDownloadFiles, func(context map[string]interface{}) {
|
||||
msg := Conf.language(228)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeRemoveIndexes, func(context map[string]interface{}) {
|
||||
util.ContextPushMsg(context, Conf.language(229))
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeRemoveIndexesV2, func(context map[string]interface{}) {
|
||||
util.ContextPushMsg(context, Conf.language(230))
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudPurgeRemoveObjects, func(context map[string]interface{}) {
|
||||
util.ContextPushMsg(context, Conf.language(231))
|
||||
})
|
||||
}
|
||||
|
||||
func buildCloudConf() (ret *cloud.Conf, err error) {
|
||||
|
|
Loading…
Add table
Reference in a new issue