Skip to content

Commit 86c13b1

Browse files
committed
🚧 新增 s3 store StatObject 接口
1 parent e372d0c commit 86c13b1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

s3/s3_client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ func (c *S3Client) Restore(dbPath string, remotePath string) error {
4545
log.Info(fmt.Sprintf("S3[minio] Restore:%s<-%s", dbPath, objectName))
4646
return c.client.FGetObject(c.config.Bucket, objectName, dbPath, minio.GetObjectOptions{})
4747
}
48+
49+
//StatObject 获取远端状态信息, remotePath 不包含 PrefixPath
50+
func (c *S3Client) StatObject(remotePath string) (minio.ObjectInfo, error) {
51+
objectName := path.Join(c.config.PrefixPath, remotePath)
52+
return c.client.StatObject(c.config.Bucket, objectName, minio.StatObjectOptions{})
53+
}

s3/s3_store.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package s3
22

3+
import "github.com/minio/minio-go/v6"
4+
35
type S3Store interface {
46
//Snapshot 快照操作, remotePath 不包含 PrefixPath
57
Snapshot(dbPath string, remotePath string) error
68
//Restore 恢复操作, remotePath 不包含 PrefixPath
79
Restore(dbPath string, remotePath string) error
10+
//StatObject 获取远端状态信息, remotePath 不包含 PrefixPath
11+
StatObject(remotePath string) (minio.ObjectInfo, error)
812
}

0 commit comments

Comments
 (0)