From b5684f2c1e5d131d9547a96b55d9721e18da711f Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 9 Nov 2022 14:37:03 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=B0=83=E6=95=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=8E=A5=E5=85=A5=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=AD=98=E5=82=A8=E7=B1=BB=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=20https://github.com/siyuan-note/siyuan/issues/6530?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloud/cloud.go | 16 +++++++++++++++- cloud/qiniu.go | 10 ---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cloud/cloud.go b/cloud/cloud.go index e79004e..9e4edda 100644 --- a/cloud/cloud.go +++ b/cloud/cloud.go @@ -32,7 +32,7 @@ type Conf struct { Endpoint string // 服务端点 Extras map[string]interface{} // 一些可能需要的附加信息 - // S3 协议所需配置 + // 对象存储协议所需配置 AccessKey string // Access Key SecretKey string // Secret Key Region string // 存储区域 @@ -245,3 +245,17 @@ func init() { panic(err) } } + +// Index 描述了索引信息,主要用于内部处理。 +type Index struct { + Hash string `json:"hash"` + Size int64 `json:"size"` + Updated int64 `json:"updated"` // Unix timestamp 秒 +} + +// ObjectInfo 描述了对象信息,主要用于内部处理。 +type ObjectInfo struct { + Key string `json:"key"` + Size int64 `json:"size"` + Updated string `json:"updated"` +} diff --git a/cloud/qiniu.go b/cloud/qiniu.go index ea0cd94..c45f0c6 100644 --- a/cloud/qiniu.go +++ b/cloud/qiniu.go @@ -119,10 +119,6 @@ func (qiniu *Qiniu) GetRepos() (repos []*Repo, size int64, err error) { return } -func (qiniu *Qiniu) GetAvailableSize() (size int64) { - return 1024 * 1024 * 1024 * 1024 * 2 // 2TB -} - func (qiniu *Qiniu) UploadObject(filePath string, overwrite bool) (err error) { absFilePath := filepath.Join(qiniu.Conf.RepoPath, filePath) @@ -712,12 +708,6 @@ func (qiniu *Qiniu) getNotFound(keys []string) (ret []string, err error) { return } -type Index struct { - Hash string `json:"hash"` - Size int64 `json:"size"` - Updated int64 `json:"updated"` // Unix timestamp 秒 -} - func (qiniu *Qiniu) getIndex(fullDirPath string) (ret map[string]Index, err error) { indexPath := path.Join(fullDirPath, "index.json") data, err := qiniu.getFile(indexPath)