Skip to content

Commit

Permalink
🎨 数据同步支持接入第三方对象存储服务 siyuan-note/siyuan#6426
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 9, 2022
1 parent bdce221 commit ea95e77
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 290 deletions.
11 changes: 2 additions & 9 deletions cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,8 @@ func init() {
}
}

// Index 描述了索引信息,主要用于内部处理。
type Index struct {
Hash string `json:"hash"`
Size int64 `json:"size"`
Updated int64 `json:"updated"` // Unix timestamp 秒
}

// ObjectInfo 描述了对象信息,主要用于内部处理。
type ObjectInfo struct {
// objectInfo 描述了对象信息,用于内部处理。
type objectInfo struct {
Key string `json:"key"`
Size int64 `json:"size"`
Updated string `json:"updated"`
Expand Down
6 changes: 3 additions & 3 deletions cloud/oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func (oss *OSS) listRepoRefs(userId, repo, refPrefix string) (ret []*Ref, err er
})
}

if listObjectResult.IsTruncated {
if !listObjectResult.IsTruncated {
break
}
}
Expand Down Expand Up @@ -405,7 +405,7 @@ func (oss *OSS) repoLatest(repoDir string) (id string, err error) {
return
}

func (oss *OSS) statFile(key string) (info *ObjectInfo, err error) {
func (oss *OSS) statFile(key string) (info *objectInfo, err error) {
accessKey := oss.Conf.AccessKey
secretKey := oss.Conf.SecretKey
endpoint := oss.Conf.Endpoint
Expand All @@ -430,7 +430,7 @@ func (oss *OSS) statFile(key string) (info *ObjectInfo, err error) {
updated := t.Format("2006-01-02 15:04:05")
contentLen := header.Get("Content-Length")
size, _ := strconv.ParseInt(contentLen, 10, 64)
info = &ObjectInfo{
info = &objectInfo{
Key: key,
Updated: updated,
Size: size,
Expand Down

0 comments on commit ea95e77

Please sign in to comment.