$providers
$providers : array
Registered providers, keyed by id.
Holds the storage providers a site has available.
A registry, not a policy. Which provider a flush is written to is strata.settings's provider
key, resolved by Engine; this class only knows what has been contributed and how to build it. An
add-on registers here and needs no change anywhere else in the engine.
Every enabled submodule registers whether or not the site has configured it, so the ids held here are what is available rather than what is in use. A caller wanting to report on the store the site actually writes to has to name that provider itself.
$providers : array
Registered providers, keyed by id.
$deferred : array
Providers not built yet, keyed by id.
Building a provider can fail - a missing bucket, an unreachable endpoint, credentials that do not resolve - so a provider the site is not using is never constructed. Registering an eager instance would make a misconfigured optional provider take the whole container down.
$factories : array
Factories a submodule contributed, keyed by id.
Held alongside the deferred closure rather than swallowed by it, because a tiered store has to ask a factory for a second provider at a different location. A closure can only be called; a factory can be asked what it is capable of.
register(\Drupal\strata\Storage\StorageProviderInterface $provider) : $this
Adds a provider.
| \Drupal\strata\Storage\StorageProviderInterface | $provider | The provider. |
When another provider is already registered under that id. Silently replacing it would redirect every subsequent write with no signal.
The manager, for chaining.
registerFactory(string $id, callable $factory) : $this
Adds a provider that is built the first time it is asked for.
| string | $id | The provider id, as it appears in configuration. |
| callable | $factory | Builds the provider. |
When another provider is already registered under that id.
The manager, for chaining.
registerProviderFactory(\Drupal\strata\Storage\StorageProviderFactoryInterface $factory) : $this
Adds a provider contributed by a submodule, built on first use.
The shape a Drupal service collector calls: a submodule tags an object exposing id() and
create(), and the manager holds it until something asks for that provider. A submodule whose
endpoint is misconfigured therefore reports itself unreachable rather than taking the
container down at compile time.
| \Drupal\strata\Storage\StorageProviderFactoryInterface | $factory | The contributed factory. |
When another provider is already registered under that id.
The manager, for chaining.
factory(string $id) : \Drupal\strata\Storage\StorageProviderFactoryInterface|null
The factory a provider id was contributed by.
What a tiered store needs: the same endpoint pointed at a second bucket can only be built by the thing that knows how to build the first one.
| string | $id | A provider id. |
The factory, or NULL when the provider was registered as an instance or a bare closure rather than through a factory.
reachability(string $id) : string|null
Whether one provider can be reached right now.
Used by strata_requirements() to report the store the site writes to. It names a single
provider rather than sweeping every registered one because registration follows the enabled
submodules and not the configuration: a site running strata_s3 and strata_b2 but configured
for S3 alone would otherwise report B2 as broken on the status page every time it loaded.
Three failure modes collapse into one reason string, and none of them raise. A provider id nothing registered, a factory that throws while building, and a provider that builds but cannot answer are all just "unreachable, and here is why" to a caller that must not take the status report down with it.
| string | $id | The provider id to probe, as it appears in |
Why the provider cannot be reached, or NULL when it can be.