Tsukilc commented on code in PR #622: URL: https://github.com/apache/skywalking-banyandb/pull/622#discussion_r2007010395
########## pkg/fs/remote/aws/aws.go: ########## @@ -0,0 +1,142 @@ +// Licensed to Apache Software Foundation (ASF) under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Apache Software Foundation (ASF) licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Package aws provides an AWS S3 file system implementation. +package aws + +import ( + "context" + "fmt" + "io" + "net/http" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/credentials" + "github.com/aws/aws-sdk-go-v2/service/s3" + + "github.com/apache/skywalking-banyandb/pkg/fs/remote" +) + +// todo: Maybe we can bring in minio, oss +type s3FS struct { + client *s3.Client +} + +// todo: variable to get the bucket name for measure,property,stream +var cfg *S3Config + +// NewFS creates a new instance of the file system for accessing S3 storage. +func NewFS() (remote.FS, error) { + cfg = GetS3Config() + if cfg == nil { + return nil, fmt.Errorf("s3 config is nil") + } + + httpClient := &http.Client{ + Timeout: cfg.Timeout, + } + + // todo: lots of configs to do + awsCfg, err := config.LoadDefaultConfig( + context.TODO(), + config.WithRegion(cfg.Region), + config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider( + cfg.KeyID, + cfg.SecretKey, + "", + )), + config.WithHTTPClient(httpClient), + config.WithClientLogMode(aws.LogRetries), Review Comment: I checked the official documentation and found that the AWS SDK for Go has a default exponential backoff strategy. Users can configure the maximum number of retries through the shared configuration file.   -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@skywalking.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org