From 6ffcd32f998e1a4a7e7a851729e9deb6187e7a43 Mon Sep 17 00:00:00 2001 From: James Maes Date: Tue, 13 Oct 2026 20:23:03 -0500 Subject: [PATCH] feat(api): StorageBucket.maxUploadBytes() Expose a bucket's upload limit in the api package (null means no limit), so consumers such as qbit-collaboration need not read the internal StorageBucketConfig through config(). Found by the qbit-guardrails G1-arch check (qbit-bom#10). Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + .../qbits/objectstorage/api/StorageBucket.java | 12 ++++++++++++ .../objectstorage/conformance/StandaloneTest.java | 1 + 3 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d695e1..2e26966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project are documented here. The format follows Keep ## [0.1.0] - Unreleased ### Added +- `StorageBucket.maxUploadBytes()` in the `api` package: the bucket's upload limit in bytes (null when none), so other qbits need not call `config()`, which returns an internal type. - **The service (P1).** `ObjectStorage.bucket(alias)` and `ObjectStorage.asSystem(caller, runId)`: put (multipart above the part size), get with ranges, head, copy (in parts for very large objects), header and metadata changes, delete (delete marker, private trash, or permanent), restore, list, presigned GET, PUT and POST, public URLs, tags. Key building and URL encoding, the header policy (`object_storage_header_rule`), `PublicUrlResolver`, `StorageChangeListener`, `StorageReferenceProvider`, `StorageAlertSink`. - Configuration in code, upserted into visible `object_storage_*` tables; secret references with an allow-list; per-connection rate limits; per-bucket and per-connection record security locks. - The capability model and the Test connection probe (read-only by default, write tests on request, clock skew, presign host), with seeded provider defaults. diff --git a/src/main/java/com/kingsrook/qbits/objectstorage/api/StorageBucket.java b/src/main/java/com/kingsrook/qbits/objectstorage/api/StorageBucket.java index 544f1e2..ea5d573 100644 --- a/src/main/java/com/kingsrook/qbits/objectstorage/api/StorageBucket.java +++ b/src/main/java/com/kingsrook/qbits/objectstorage/api/StorageBucket.java @@ -128,6 +128,18 @@ public final class StorageBucket + /******************************************************************************* + ** The largest object this bucket accepts on upload, in bytes, or null when + ** the bucket sets no limit. Callers outside this qbit use this instead of + ** config(), which returns an internal type. + *******************************************************************************/ + public Long maxUploadBytes() + { + return (bucket.getMaxUploadBytes()); + } + + + /******************************************************************************* ** The bucket configuration. *******************************************************************************/ diff --git a/src/test/java/com/kingsrook/qbits/objectstorage/conformance/StandaloneTest.java b/src/test/java/com/kingsrook/qbits/objectstorage/conformance/StandaloneTest.java index 6e997d7..4c1e192 100644 --- a/src/test/java/com/kingsrook/qbits/objectstorage/conformance/StandaloneTest.java +++ b/src/test/java/com/kingsrook/qbits/objectstorage/conformance/StandaloneTest.java @@ -51,6 +51,7 @@ class StandaloneTest } ObjectStorage.bucket("files").delete(DeleteRequest.of(key)); assertThat(ObjectStorage.bucket("files").head(key)).isEmpty(); + assertThat(ObjectStorage.bucket("files").maxUploadBytes()).isEqualTo(ObjectStorage.bucket("files").config().getMaxUploadBytes()); } -- 2.54.0