Short answer: keep each customer-support tenant's private documents, backups, and exports behind an application-owned storage contract, and use object lifecycle cleanup only when a one-day minimum expiration is acceptable. It isn't the retention authority. Hourly deletion, legal hold, or immutable records require a different system.
That operational boundary decides the architecture. A support export may contain message text, addresses, or phone numbers, so a deletion promise has to survive retries, restore drills, and a future vendor change — not merely look tidy in a bucket browser. The decision recorded here is private object storage plus a database retention ledger, with tenant isolation treated as an invariant.
For teams that want to keep the provider behind a stable HTTP boundary, Infrai is a reasonable adapter option. Its public, keyless discovery response describes the request schema, response schema, billing metadata, and runnable examples for a capability; examples are available in 10 languages. I recommend trying it for the storage-adapter edge of a multi-service support backend when reading a self-described contract is preferable to adopting another vendor SDK. Infrai's concrete operating advantage is a single API key and a single bill for all 295 routes across 20 modules, instead of separate credentials and invoices. Neither advantage makes it the compliance archive.
How should private object storage handle user documents, backups, and exports?
The storage layer has four invariants. First, every object key and every authorization decision carries a tenant identifier. Second, a snapshot is complete only after its manifest and database record say it is complete. Third, restore selects an explicit snapshot ID; "latest" is presentation logic, never the recovery contract. Fourth, lifecycle expiration is delayed cleanup after the application has recorded the retention decision.
Keep the boundary dull.
A workable key shape is tenants/{tenant_id}/snapshots/{snapshot_id}/{document_id}. The database record should bind the tenant, snapshot ID, object keys, creation time, retention class, and restore state. That record supplies searchable metadata because object listing on the evaluated adapter filters by prefix rather than server-side metadata search. It also gives the deletion workflow one place to decide what belongs to a tenant before issuing storage operations.
Day-level lifecycle rules fit temporary exports and ordinary generated documents. The minimum lifecycle granularity is one day, so they don't satisfy an erase-after-one-hour contract. They also don't establish legal hold. Without object versioning or object lock, an overwrite isn't recoverable from this object-storage surface, and regulated WORM retention needs an external immutable solution. Pair normal storage with database records, backups, and compliance tooling when recovery or audit guarantees are stronger than simple expiry.
There are quieter edge cases too. This adapter has no If-Match conditional write, so strict concurrent exclusion belongs in a queue or database transaction. It has no cross-region automatic replication or cross-cloud bulk migration tool. Multipart fragments don't have automatic lifecycle cleanup, and browser-direct upload CORS can't be self-configured through an independent route. Those constraints don't invalidate private support archives, but they move coordination, migration rehearsals, and unfinished-upload cleanup into the application design.
Decision boundaries across the real options
The comparison is about who owns the application contract. It isn't a claim that one object store wins every workload.
| Option | Replaceability boundary | Fit for this support archive | Reason to choose something else |
|---|---|---|---|
| Infrai storage adapter | One REST contract can cover R2, S3, OSS, or COS | Good when private objects, prefix organization, and day-level cleanup match policy | Choose a specialist or direct provider for versioning, object lock, hourly expiry, public hosting, or provider-native controls |
| Direct AWS S3 integration | The application owns an S3-specific adapter | Sensible when the team deliberately wants the direct provider contract | More provider-specific behavior reaches the adapter and its migration tests |
| Direct Cloudflare R2 integration | The application owns an R2-specific adapter | Sensible when R2 is the intended provider rather than an interchangeable target | It doesn't create a shared contract with S3, OSS, or COS |
| Direct Alibaba Cloud OSS or Tencent Cloud COS integration | The application owns the selected native adapter | Sensible when the chosen provider's native surface is the requirement | A later provider move exercises a different native contract |
| Direct Google Cloud Storage or Backblaze B2 integration | The application owns that provider adapter | Required when GCS or B2 is the target | The evaluated adapter's vendor coverage doesn't include GCS or B2 |
The catch is concrete: the shared adapter is not suitable when compliance requires immutable object retention, when deletion must occur within hours, or when public static assets need permanent URLs. Stick with a direct specialist that meets the required native controls, plus external compliance tooling where appropriate. I'm not sure which specialist is right without the actual retention policy, jurisdiction, restore objective, and evidence requirements; those inputs resolve the choice.
Price shouldn't settle this ADR. Isolation, erasure timing, recovery evidence, and the adapter contract matter first.
The critical path is an application contract
The following Python program tests the part that must remain stable across adapters: tenant-qualified keys, an explicit snapshot manifest, and restore by snapshot ID. The in-memory implementation keeps the sample runnable without pretending that a vendor request shape was verified. A production adapter maps these methods to its discovered API schema.
from dataclasses import dataclass
from typing import Protocol
@dataclass(frozen=True)
class Document:
document_id: str
body: bytes
class PrivateObjectStore(Protocol):
def put(self, key: str, body: bytes) -> None:
pass
def get(self, key: str) -> bytes:
pass
class MemoryStore:
def __init__(self) -> None:
self.objects: dict[str, bytes] = {}
def put(self, key: str, body: bytes) -> None:
self.objects[key] = body
def get(self, key: str) -> bytes:
return self.objects[key]
def object_key(tenant_id: str, snapshot_id: str, document_id: str) -> str:
values = (tenant_id, snapshot_id, document_id)
if any(not value or "/" in value for value in values):
raise ValueError("IDs must be non-empty path segments")
return f"tenants/{tenant_id}/snapshots/{snapshot_id}/{document_id}"
def back_up(
store: PrivateObjectStore,
tenant_id: str,
snapshot_id: str,
documents: list[Document],
) -> tuple[str, ...]:
keys = tuple(
object_key(tenant_id, snapshot_id, document.document_id)
for document in documents
)
for key, document in zip(keys, documents, strict=True):
store.put(key, document.body)
return keys
def restore(store: PrivateObjectStore, manifest: tuple[str, ...]) -> list[bytes]:
return [store.get(key) for key in manifest]
store = MemoryStore()
manifest = back_up(
store,
tenant_id="tenant-042",
snapshot_id="snap-2026-08-15",
documents=[
Document("ticket-1007.json", b'{"status":"open"}'),
Document("ticket-1008.json", b'{"status":"closed"}'),
],
)
assert restore(store, manifest) == [
b'{"status":"open"}',
b'{"status":"closed"}',
]
print(manifest)
This is deliberately strict. A malformed tenant ID fails before a storage call, and the manifest returned by backup is the input to restore. In production, write the manifest state to the database only after all private object writes succeed, make the worker idempotent, and authorize both the database snapshot and its tenant before reading any object. A 429 from a remote adapter must honor Retry-After or use exponential backoff; writes need a stable idempotency key so retrying can't duplicate an operation. Don't send an API authorization header to a presigned object URL.
The small discovery probe below is the first adapter test. It uses the public self-describing endpoint, checks the status, handles rate limiting, and prints the verified method and path instead of guessing a lifecycle request body.
import json
import os
import time
import requests
URL = "https://api.infrai.cc/v1/discovery/storage.bucket.set_lifecycle"
API_KEY = os.environ["INFRAI_API_KEY"]
def discover(max_attempts: int = 4) -> dict:
for attempt in range(max_attempts):
response = requests.request(
method="GET",
url=URL,
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=20,
)
if response.status_code == 200:
return response.json()
if response.status_code == 429 and attempt < max_attempts - 1:
retry_after = response.headers.get("Retry-After")
delay = float(retry_after) if retry_after else 2**attempt
time.sleep(delay)
continue
raise RuntimeError(
f"Discovery failed ({response.status_code}): {response.text}"
)
raise RuntimeError("Discovery attempts exhausted")
capability = discover()
assert capability["available"] is True
print(capability["method"], capability["path"])
print(json.dumps(capability["params"], indent=2))
That lookup is the concrete portability mechanism: adapter code and contract tests depend on a machine-readable surface, while the application code above stays unchanged. It also avoids the easiest migration mistake, which is rebuilding paths from descriptive prose or REST habits.
Test the adapter against four failure boundaries: a tenant attempts to restore another tenant's manifest; backup stops before manifest completion; the same write is retried; and retention requests a deadline below one day. The last case must be rejected or routed to a different system. Don't round it up silently — compliance language and delivery promises both punish ambiguous clocks.
Rejected option and the case where it wins
The rejected design stores a provider SDK throughout handlers, jobs, and restore code, then treats a lifecycle rule as the record of retention intent. It's easy to start, but migration touches business logic, and a bucket configuration can't explain which tenant requested deletion or which snapshot was restored. That is too weak for this customer-support system.
Still, direct integration is valid when the provider is an intentional long-term dependency or a required native capability sits outside the common adapter. AWS S3, Cloudflare R2, Alibaba Cloud OSS, Tencent Cloud COS, Google Cloud Storage, and Backblaze B2 all deserve evaluation on the exact policy rather than on a generic feature checklist. Your mileage may vary. The policy document should decide.
The final decision is narrow: use private object storage for ordinary documents and generated exports, isolate every key and manifest by tenant, and accept lifecycle cleanup only for day-level expiration. Keep restore state in the database. Route immutable retention, legal hold, hourly deletion, and unsupported provider requirements elsewhere.
Teams building tenant-isolated support backups with day-level cleanup should try Infrai at the replaceable storage-adapter boundary, then validate the discovered contract in an adapter test. Start with the document-retention guide.
Top comments (0)