chore: replace all cn comments to en version by volc api (#313)

This commit is contained in:
tecvan
2025-07-31 15:18:11 +08:00
committed by GitHub
parent 91d6cdb430
commit 5abc63fba6
254 changed files with 5899 additions and 5844 deletions

View File

@@ -64,7 +64,7 @@ func getTosClient(ctx context.Context, ak, sk, bucketName, endpoint, region stri
bucketName: bucketName,
}
// 创建存储桶
// Create bucket
err = t.CheckAndCreateBucket(ctx)
if err != nil {
return nil, err
@@ -82,14 +82,14 @@ func New(ctx context.Context, ak, sk, bucketName, endpoint, region string) (stor
}
func (t *tosClient) test() {
// 测试上传
// test upload
objectKey := fmt.Sprintf("test-%s.txt", time.Now().Format("20060102150405"))
err := t.PutObject(context.Background(), objectKey, []byte("hello world"))
if err != nil {
logs.CtxErrorf(context.Background(), "PutObject failed, objectKey: %s, err: %v", objectKey, err)
}
// 测试下载
// test download
content, err := t.GetObject(context.Background(), objectKey)
if err != nil {
logs.CtxErrorf(context.Background(), "GetObject failed, objectKey: %s, err: %v", objectKey, err)
@@ -97,7 +97,7 @@ func (t *tosClient) test() {
logs.CtxInfof(context.Background(), "GetObject content: %s", string(content))
// 测试获取URL
// Test Get URL
url, err := t.GetObjectUrl(context.Background(), objectKey)
if err != nil {
logs.CtxErrorf(context.Background(), "GetObjectUrl failed, objectKey: %s, err: %v", objectKey, err)
@@ -105,7 +105,7 @@ func (t *tosClient) test() {
logs.CtxInfof(context.Background(), "GetObjectUrl url: %s", url)
// 测试删除
// test delete
err = t.DeleteObject(context.Background(), objectKey)
if err != nil {
logs.CtxErrorf(context.Background(), "DeleteObject failed, objectKey: %s, err: %v", objectKey, err)
@@ -127,7 +127,7 @@ func (t *tosClient) CheckAndCreateBucket(ctx context.Context) error {
}
if serverErr.StatusCode == http.StatusNotFound {
// 存储桶不存在
// Bucket does not exist
logs.CtxInfof(ctx, "Bucket not found.")
resp, err := client.CreateBucketV2(context.Background(), &tos.CreateBucketV2Input{
Bucket: bucketName,
@@ -163,7 +163,7 @@ func (t *tosClient) GetObject(ctx context.Context, objectKey string) ([]byte, er
client := t.client
bucketName := t.bucketName
// 下载数据到内存
// Download data to memory
getOutput, err := client.GetObjectV2(ctx, &tos.GetObjectV2Input{
Bucket: bucketName,
Key: objectKey,
@@ -188,7 +188,7 @@ func (t *tosClient) DeleteObject(ctx context.Context, objectKey string) error {
client := t.client
bucketName := t.bucketName
// 删除存储桶中指定对象
// Delete the specified object in the bucket
_, err := client.DeleteObjectV2(ctx, &tos.DeleteObjectV2Input{
Bucket: bucketName,
Key: objectKey,