id()
id() : string
The plugin id this provider registers under.
Returns
string —A short lowercase token such as "s3", "r2", "sftp" or "local".
Where Strata puts its objects.
Implemented for S3 and every S3-compatible endpoint, for Cloudflare R2, for SFTP and FTP, and for the local filesystem. An add-on provider implements this and registers with StorageProviderManager; nothing in the engine branches on a provider class.
Every key is relative to the store root, which the provider prefixes with _strata/<site-id>/
so a bucket can hold other things. Keys never begin with a slash.
Two rules bind every implementation:
capabilities() : \Drupal\strata\Storage\Capabilities
What this endpoint can do.
Probed once per endpoint and cached; a probe that cannot run returns conservative defaults rather than optimistic ones, so an unknown endpoint degrades to more requests instead of to failed ones.
The capability set.
put(string $key, string|resource $body, array$options = []) : \Drupal\strata\Storage\PutResult
Writes an object.
Splits into parts automatically when the body exceeds what the endpoint takes in one request.
| string | $key | Object key relative to the store root. |
| string|resource | $body | The bytes, or an open readable stream. A stream is read once and not rewound, so a caller that needs it again must seek itself. |
| array |
$options | Provider options. |
When the write fails, the body is larger than the endpoint can store, or a conditional write was requested on an endpoint that does not honour one.
What was written.
get(string $key, \Drupal\strata\Storage\ByteRange|null $range = null) : string
Reads an object.
| string | $key | Object key relative to the store root. |
| \Drupal\strata\Storage\ByteRange|null | $range | A byte range, or NULL for the whole object. |
When the object is absent, the read fails, or fewer bytes arrive than were asked for.
The bytes.
stream(string $key) : resource
Opens an object as a stream.
For objects too large to hold in memory. A caller that wants bytes should use StorageProviderInterface::get() instead.
| string | $key | Object key relative to the store root. |
When the object is absent or cannot be opened.
An open readable stream the caller must close.
head(string $key) : \Drupal\strata\Storage\ObjectMeta|null
Metadata for one object without reading it.
| string | $key | Object key relative to the store root. |
The metadata, or NULL when the object is absent. Absence is not an error, because every caller of this method is asking precisely in order to find out.
delete(list$keys) : int
Deletes objects.
Batches when the endpoint supports it. Deleting an absent key is not an error, so a retried prune is idempotent.
| list |
$keys | Object keys relative to the store root. |
When the endpoint refuses the request.
How many keys the endpoint accepted. A store that can tell an absent key from a removed one counts only what it removed; S3 reports success for an absent key and cannot distinguish, so it counts everything it was given. Do not read this as "how many existed" - a prune receipt counts from the frame index, which knows.
list(string $prefix = '', string|null $cursor = null, int $limit = 1000, string|null $delimiter = null) : \Drupal\strata\Storage\ObjectPage
Lists one page of objects under a prefix.
| string | $prefix | Key prefix relative to the store root; an empty string lists everything. |
| string|null | $cursor | Continuation token from a previous page, or NULL to start. |
| int | $limit | Most objects to return in this page. |
| string|null | $delimiter | Grouping delimiter, or NULL for a flat listing. |
When the listing fails.
The page.