added godoc comments and license notes for the gocloud.dev vendored code

This commit is contained in:
Gani Georgiev
2025-03-07 23:12:47 +02:00
parent 087eaa7ea4
commit f799083c4f
7 changed files with 79 additions and 18 deletions
+13 -8
View File
@@ -1,3 +1,15 @@
package fileblob
import (
"encoding/json"
"fmt"
"os"
)
// Largely copied from gocloud.dev/blob/fileblob to apply the same
// retrieve and write side-car .attrs rules.
//
// -------------------------------------------------------------------
// Copyright 2018 The Go Cloud Development Kit Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,14 +23,7 @@
// 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 fileblob
import (
"encoding/json"
"fmt"
"os"
)
// -------------------------------------------------------------------
const attrsExt = ".attrs"
+21 -1
View File
@@ -1,3 +1,23 @@
// Package s3 implements a lightweight client for interacting with the
// REST APIs of any S3 compatible service.
//
// It implements only the minimal functionality required by PocketBase
// such as objects list, get, copy, delete and upload.
//
// For more details why we don't use the official aws-sdk-go-v2, you could check
// https://github.com/pocketbase/pocketbase/discussions/6562.
//
// Example:
//
// client := &s3.S3{
// Endpoint: "example.com",
// Region: "us-east-1",
// Bucket: "test",
// AccessKey: "...",
// SecretKey: "...",
// UsePathStyle: true,
// }
// resp, err := client.GetObject(context.Background(), "abc.txt")
package s3
import (
@@ -27,7 +47,7 @@ type HTTPClient interface {
}
type S3 struct {
// Client specifies the HTTP client to send the request with.
// Client specifies a custom HTTP client to send the request with.
//
// If not explicitly set, fallbacks to http.DefaultClient.
Client HTTPClient
@@ -24,7 +24,7 @@ const (
defaultMinPartSize int = 6 << 20
)
// Uploader handles S3 object upload.
// Uploader handles the upload of a single S3 object.
//
// If the Payload size is less than the configured MinPartSize it sends
// a single (PutObject) request, otherwise performs chunked/multipart upload.