Interface CosIdStoreProvider

All Known Implementing Classes:
BuiltInStoreProvider

public interface CosIdStoreProvider
A backend for the starter: creates the machine id distributor and/or the id segment distributor factory of one store type.

The starter picks the provider whose type is the configured store type, cosid.machine.distributor.type (or cosid.segment.distributor.type), compared as StoreTypes do: for example jdbc, stateful_set or etcd. Every built-in backend registers its own provider. A provider bean of the application with the same type as a built-in one takes precedence over it; one with a new type is selected by setting the type to it.

A provider supports either side by returning a value from its method, and null for the side it does not support.

The built-in backends check for application providers when they register their beans, by bean type. Define the provider as a bean of its concrete type, in the application's configuration or in an auto-configuration ordered before CosId's backend auto-configurations (@AutoConfiguration(before = ...)); a provider registered later, or through a raw-typed FactoryBean, is ignored and a warning is logged at startup.

Since:
3.4.0
  • Method Details

    • getType

      String getType()
      The store type this provider serves, compared ignoring case.
    • createMachineIdDistributor

      default @Nullable MachineIdDistributor createMachineIdDistributor(MachineStoreContext context)
      Create the machine id distributor.
      Returns:
      the distributor, or null if this provider has none
    • createIdSegmentDistributorFactory

      default @Nullable IdSegmentDistributorFactory createIdSegmentDistributorFactory(SegmentStoreContext context)
      Create the id segment distributor factory.
      Returns:
      the factory, or null if this provider has none