Skip to content

Commit

Permalink
🎨 调整数据同步接入第三方对象存储类服务 siyuan-note/siyuan#6530
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 9, 2022
1 parent 84ed823 commit b5684f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
16 changes: 15 additions & 1 deletion cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Conf struct {
Endpoint string // 服务端点
Extras map[string]interface{} // 一些可能需要的附加信息

// S3 协议所需配置
// 对象存储协议所需配置
AccessKey string // Access Key
SecretKey string // Secret Key
Region string // 存储区域
Expand Down Expand Up @@ -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"`
}
10 changes: 0 additions & 10 deletions cloud/qiniu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b5684f2

Please sign in to comment.