Package com.illumon.iris.db.v2.routing
Class DataRoutingServiceFactory
java.lang.Object
com.illumon.iris.db.v2.routing.DataRoutingServiceFactory
Entry point for DataRoutingService access and implementation.
This class encapsulates implementation details and provides system defaults.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DataRoutingService
createDefault
(com.fishlib.configuration.Configuration configuration) Create a new DataRoutingService of the type indicated by the given Configuration.static DataRoutingService
fromConfiguration
(com.fishlib.configuration.Configuration configuration) Create a YAML basedDataRoutingService
instance as dictated by the given configuration.static DataRoutingService
fromFilename
(String filename) Create a YAML basedDataRoutingService
instance from the named file or resource.static DataRoutingService
fromFilename
(String filename, Collection<DataImportServiceConfig> disConfigs) Create a YAML basedDataRoutingService
instance from the named file or resource and provided additional dises.static DataRoutingService
fromString
(String ymlString) Create YAML based aDataRoutingService
from an existing yml String.static DataRoutingService
fromString
(String ymlString, Collection<DataImportServiceConfig> disConfigs) Create YAML based aDataRoutingService
from an existing yml String and collection of DIS configs.static DataRoutingService
static DataRoutingService
static WritableDataRoutingService
getKvEtcdDataRoutingService
(com.fishlib.configuration.Configuration configuration) Create a DataRoutingService that connects directly to etcd, according to the given configuration.static WritableDataRoutingService
getKvEtcdDataRoutingService
(com.fishlib.configuration.Configuration configuration, boolean allowParseErrors) Create a DataRoutingService that connects directly to etcd, according to the given configuration.static WritableDataRoutingService
Get a remote data routing service implementation (this will be grpc).static void
reset()
For testing only.
-
Field Details
-
YAML_IMPLEMENTATION_NAME
- See Also:
-
KV_ETCD_IMPLEMENTATION_NAME
- See Also:
-
KV_INMEM_IMPLEMENTATION_NAME
- See Also:
-
K8S_IMPLEMENTATION_NAME
- See Also:
-
SERVICE_IMPLEMENTATION_NAME
- See Also:
-
YAML_CONFIG_FILENAME_PROP
- See Also:
-
-
Constructor Details
-
DataRoutingServiceFactory
public DataRoutingServiceFactory()
-
-
Method Details
-
getDefault
- Returns:
- the routing service instance defined by the Global configuration instance.
-
createDefault
@VisibleForTesting @NotNull public static DataRoutingService createDefault(@NotNull com.fishlib.configuration.Configuration configuration) Create a new DataRoutingService of the type indicated by the given Configuration.- Parameters:
configuration
- the Configuration governing defaults- Returns:
- a new instance of a DataRoutingService implementation
-
getK8sDataRoutingService
-
getRemoteDataRoutingService
Get a remote data routing service implementation (this will be grpc).- Returns:
- a remote implementation of WritableDataRoutingService
-
getKvEtcdDataRoutingService
public static WritableDataRoutingService getKvEtcdDataRoutingService(@NotNull com.fishlib.configuration.Configuration configuration) Create a DataRoutingService that connects directly to etcd, according to the given configuration.- Parameters:
configuration
- the configuration to use- Returns:
- a new WritableDataRoutingService instance
-
getKvEtcdDataRoutingService
public static WritableDataRoutingService getKvEtcdDataRoutingService(@NotNull com.fishlib.configuration.Configuration configuration, boolean allowParseErrors) Create a DataRoutingService that connects directly to etcd, according to the given configuration. If allowParseErrors is true, parse errors in the existing data will be ignored. This allows import and export when errors are somehow persisted.- Parameters:
configuration
- the configuration to useallowParseErrors
- if true, allow errors in the existing routing file- Returns:
- a new WritableDataRoutingService instance
-
reset
For testing only. -
fromConfiguration
public static DataRoutingService fromConfiguration(@NotNull com.fishlib.configuration.Configuration configuration) Create a YAML basedDataRoutingService
instance as dictated by the given configuration. The configuration will be used to determine a file to parse.- Parameters:
configuration
- the configuration to use- Returns:
- a new DataRoutingService
-
fromFilename
Create a YAML basedDataRoutingService
instance from the named file or resource. This disambiguates the constructors.- Parameters:
filename
- the name of the file to parse- Returns:
- a new DataRoutingService
- Throws:
IOException
- if the file cannot be readDataRoutingConfigurationException
- if the complete configuration can't be parsed with the new configuration included
-
fromFilename
public static DataRoutingService fromFilename(@NotNull String filename, @NotNull Collection<DataImportServiceConfig> disConfigs) throws IOException Create a YAML basedDataRoutingService
instance from the named file or resource and provided additional dises.- Parameters:
filename
- the name of the file to parsedisConfigs
- the DataImportServiceConfigs to add in- Returns:
- a new DataRoutingService
- Throws:
IOException
- if the file cannot be readDataRoutingConfigurationException
- if the complete configuration can't be parsed with the new configuration included
-
fromString
Create YAML based aDataRoutingService
from an existing yml String. This allows storage and parsing to be independent.- Parameters:
ymlString
- the string to parse- Returns:
- a new DataRoutingService
- Throws:
DataRoutingConfigurationException
- if the complete configuration can't be parsed with the new configuration included
-
fromString
public static DataRoutingService fromString(@NotNull String ymlString, @NotNull Collection<DataImportServiceConfig> disConfigs) Create YAML based aDataRoutingService
from an existing yml String and collection of DIS configs.- Parameters:
ymlString
- the string to parsedisConfigs
- the DataImportServiceConfigs to add in- Returns:
- a new DataRoutingService
- Throws:
DataRoutingConfigurationException
- if the complete configuration can't be parsed with the new configuration included
-