diff --git a/CHANGELOG.md b/CHANGELOG.md index 815b1066..9ead9000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,13 +13,13 @@ - Added `store.Store.SetFunc(key, func(old T) new T)` to set/update a store value with the return result of the callback in a concurrent safe manner. -- Added `subscription.Message.WriteSSE(w, id)` for writing an SSE formatted message into the provided writer interface (_usually used for unit testing_). - -- Updatated to `modernc.org/sqlite` 1.36.0 (SQLite 3.49.0). +- Added `subscription.Message.WriteSSE(w, id)` for writing an SSE formatted message into the provided writer interface (_used mostly to assist with the unit testing_). - Bumped the default request read and write timeouts to 5mins (_old 3mins_) to accommodate slower internet connections and larger file uploads/downloads. _If you want to change them you can modify the `OnServe` hook's `ServeEvent.ReadTimeout/WriteTimeout` fields as shown in [#6550](https://github.com/pocketbase/pocketbase/discussions/6550#discussioncomment-12364515)._ +- Updatated `modernc.org/sqlite` to 1.36.0 (SQLite 3.49.0). + ## v0.25.9 diff --git a/tools/filesystem/blob/hex.go b/tools/filesystem/blob/hex.go index e830324f..d41909ea 100644 --- a/tools/filesystem/blob/hex.go +++ b/tools/filesystem/blob/hex.go @@ -1,5 +1,10 @@ package blob +import ( + "fmt" + "strconv" +) + // Copied from gocloud.dev/blob to avoid nuances around the specific // HEX escaping/unescaping rules. // @@ -19,11 +24,6 @@ package blob // limitations under the License. // ------------------------------------------------------------------- -import ( - "fmt" - "strconv" -) - // HexEscape returns s, with all runes for which shouldEscape returns true // escaped to "__0xXXX__", where XXX is the hex representation of the rune // value. For example, " " would escape to "__0x20__". diff --git a/tools/filesystem/blob/reader.go b/tools/filesystem/blob/reader.go index 40d7b82d..9995c619 100644 --- a/tools/filesystem/blob/reader.go +++ b/tools/filesystem/blob/reader.go @@ -8,6 +8,24 @@ import ( "time" ) +// Largely copied from gocloud.dev/blob.Reader to minimize breaking changes. +// +// ------------------------------------------------------------------- +// Copyright 2019 The Go Cloud Development Kit Authors +// +// Licensed 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 +// +// https://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. +// ------------------------------------------------------------------- + var _ io.ReadSeekCloser = (*Reader)(nil) // Reader reads bytes from a blob. diff --git a/tools/filesystem/blob/writer.go b/tools/filesystem/blob/writer.go index ab0dd528..718a342f 100644 --- a/tools/filesystem/blob/writer.go +++ b/tools/filesystem/blob/writer.go @@ -9,6 +9,24 @@ import ( "net/http" ) +// Largely copied from gocloud.dev/blob.Writer to minimize breaking changes. +// +// ------------------------------------------------------------------- +// Copyright 2019 The Go Cloud Development Kit Authors +// +// Licensed 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 +// +// https://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. +// ------------------------------------------------------------------- + var _ io.WriteCloser = (*Writer)(nil) // Writer writes bytes to a blob. diff --git a/tools/filesystem/internal/fileblob/attrs.go b/tools/filesystem/internal/fileblob/attrs.go index bc51ae05..3f30ed3b 100644 --- a/tools/filesystem/internal/fileblob/attrs.go +++ b/tools/filesystem/internal/fileblob/attrs.go @@ -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" diff --git a/tools/filesystem/internal/s3blob/s3/s3.go b/tools/filesystem/internal/s3blob/s3/s3.go index 9d62a318..eca33285 100644 --- a/tools/filesystem/internal/s3blob/s3/s3.go +++ b/tools/filesystem/internal/s3blob/s3/s3.go @@ -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 diff --git a/tools/filesystem/internal/s3blob/s3/uploader.go b/tools/filesystem/internal/s3blob/s3/uploader.go index 2a9d20d8..5c999d38 100644 --- a/tools/filesystem/internal/s3blob/s3/uploader.go +++ b/tools/filesystem/internal/s3blob/s3/uploader.go @@ -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.