Class DataRoutingServiceKvImpl
java.lang.Object
com.illumon.iris.db.v2.routing.DataRoutingService.Delegating
com.illumon.iris.db.v2.routing.impl.kv.DataRoutingServiceKvImpl
- All Implemented Interfaces:
DataRoutingService
,StorageLookup
,EndpointResolver
,ClaimsProvider
,WritableDataRoutingService
,WritableDataRoutingServiceInternal
,SafeCloseable
,NamedImplementation
,AutoCloseable
- Direct Known Subclasses:
DataRoutingServiceKvEtcdImpl
,DataRoutingServiceKvInMemImpl
public abstract class DataRoutingServiceKvImpl
extends DataRoutingService.Delegating
implements WritableDataRoutingServiceInternal
Initializes the DataRoutingService from a kv store. Delegates all operations to a "file based" DataRoutingService
constructed from etcd data. Implements the WritableDataRoutingService interface, storing changes to etcd.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.routing.DataRoutingService
DataRoutingService.DeferredEndpoint, DataRoutingService.Delegating, DataRoutingService.Endpoint, DataRoutingService.EndpointConfig, DataRoutingService.NonListening, DataRoutingService.NotReadyException, DataRoutingService.NullPropertyProvider, DataRoutingService.PropertyProvider
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.routing.WritableDataRoutingService
WritableDataRoutingService.Options
-
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.routing.DataRoutingService
DEFAULT_LOCAL_TABLE_DATA_SERVICE, DEFAULT_QUERY_SERVER_TABLE_DATA_SERVICE, DEFAULT_SELECTION_TAG, HOST_TAG, MERGE_QUERY_TDS_TAG, NULL_PROPERTY_PROVIDER, PORT_TAG, QUERY_QUERY_TDS_TAG, SERVICE_REGISTRY_NONE, SERVICE_REGISTRY_SERVICE, TABLE_DATA_PORT_TAG, TABLE_DATA_SERVICE_CONFIG_PROP, TABLE_DATA_SERVICE_CONFIG_PROPS_WITH_LEGACY, TAILER_PORT_TAG, VALIDATE_QUERY_TDS_TAG
-
Method Summary
Modifier and TypeMethodDescriptionabout()
Information about a DataRoutingService instance.void
addDises
(Collection<DataImportServiceConfig> disConfigs, String code, String comment) Add one or more DataImportServiceConfigs to the data routing configuration.void
addDises
(Collection<DataImportServiceConfig> disConfigs, String user, String code, String comment) Add one or more DataImportServiceConfigs to the data routing configuration.Serialize the data routing as a YAML string.Return the raw routing file data as a string.void
close()
getAllDataImportServiceConfigs
(boolean excludeCoreConfigs) Get all DIS configs, optionally excluding core configs (those defined in the main routing yml file) For consumption by administrative tools.protected DataRoutingService
abstract String
Get a name for the implementing class.long
listen
(DataRoutingConfigListener listener) Add a listener for changes to the DataRoutingService configuration.void
removeDises
(Collection<String> disNames, String code, String comment, WritableDataRoutingService.Options... options) Remove one or more DataImportServiceConfigs from the data routing configuration.void
removeDises
(Collection<String> disNames, String user, String code, String comment, WritableDataRoutingService.Options... options) Remove one or more DataImportServiceConfigs from the data routing configuration.boolean
removeListener
(DataRoutingConfigListener listener) Remove the given listener from the list of listeners.void
replaceConfiguration
(String routingYmlString, Collection<DataImportServiceConfig> disConfigs, String code, String comment, WritableDataRoutingService.Options... options) Replace the existing base and set of configurations with the given configurations.void
replaceConfiguration
(String routingYmlString, Collection<DataImportServiceConfig> disConfigs, String user, String code, String comment, WritableDataRoutingService.Options... options) Replace the existing set of configurations with the given collection.boolean
Probe the implementation to find out if change notification is supported.toString()
void
Replace the existing data routing configuration.void
Replace the existing data routing configuration.void
updateDises
(Collection<DataImportServiceConfig> disConfigs, String code, String comment) Update one or more DataImportServiceConfigs in the data routing configuration.void
updateDises
(Collection<DataImportServiceConfig> disConfigs, String user, String code, String comment) Update one or more DataImportServiceConfigs in the data routing configuration.Methods inherited from class com.illumon.iris.db.v2.routing.DataRoutingService.Delegating
getAllDataImportServiceDestinationConfigs, getAllLogAggregatorServiceConfigs, getCollectedClaims, getDataImportServiceConfig, getDataImportServiceDestinationConfigs, getLogAggregatorConfig, getLogAggregatorDestinationConfig, getStorage, getTableDataServiceConfig, getTableDataServiceConfigs, registerClaims
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.v2.routing.filter.claims.ClaimsProvider
getCollectedClaims, registerClaims
Methods inherited from interface com.illumon.iris.db.v2.routing.DataRoutingService
authenticate, authenticate, authenticate, getAllDataImportServiceConfigs, getAllDataImportServiceDeferredDestinations, getAllDataImportServiceDestinationConfigs, getAllDataImportServiceDestinations, getAllLogAggregatorServiceConfigs, getDataImportServiceConfig, getDataImportServiceConfigWithStorage, getDataImportServiceDeferredDestinations, getDataImportServiceDestinationConfigs, getDataImportServiceDestinations, getLocalInstance, getLogAggregatorConfig, getLogAggregatorDeferredDestination, getLogAggregatorDestination, getLogAggregatorDestinationConfig, getTableDataServiceConfig, getTableDataServiceConfigs
Methods inherited from interface com.illumon.iris.db.v2.routing.endpoint.EndpointResolver
resolveLogAggregatorEndpoint, resolveTableDataEndpoint, resolveTailerEndpoint
Methods inherited from interface com.illumon.iris.db.v2.routing.dynamicdis.StorageLookup
getStorage
Methods inherited from interface com.illumon.iris.db.v2.routing.WritableDataRoutingService
addDis, removeDis, updateDis
-
Method Details
-
getAllDataImportServiceConfigs
@NotNull public Map<String,DataImportServiceConfig> getAllDataImportServiceConfigs(boolean excludeCoreConfigs) Description copied from interface:DataRoutingService
Get all DIS configs, optionally excluding core configs (those defined in the main routing yml file) For consumption by administrative tools.- Specified by:
getAllDataImportServiceConfigs
in interfaceDataRoutingService
- Overrides:
getAllDataImportServiceConfigs
in classDataRoutingService.Delegating
- Parameters:
excludeCoreConfigs
- if true, exclude core configs- Returns:
- a possibly empty collection of all/non-core DIS configs
-
getAllDataImportServiceConfigsRaw
-
asYamlStringRaw
Return the raw routing file data as a string. May contain errors, and may be null if etcd is empty.- Returns:
- the raw routing file data as a string, or null.
-
update
Description copied from interface:WritableDataRoutingService
Replace the existing data routing configuration.- Specified by:
update
in interfaceWritableDataRoutingService
- Parameters:
ymlString
- YAML representation of the new data routing configurationcode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this update
-
update
public void update(@NotNull byte[] yamldata, @NotNull String user, @NotNull String code, @NotNull String comment) Description copied from interface:WritableDataRoutingServiceInternal
Replace the existing data routing configuration.- Specified by:
update
in interfaceWritableDataRoutingServiceInternal
- Parameters:
yamldata
- YAML representation of the new data routing configurationuser
- pass-thru to kv persistence, indicates the user making this changecode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this update
-
addDises
public void addDises(@NotNull Collection<DataImportServiceConfig> disConfigs, @NotNull String code, @NotNull String comment) Description copied from interface:WritableDataRoutingService
Add one or more DataImportServiceConfigs to the data routing configuration. The disConfigs will be checked as they are added, ensuring that the configuration as a whole is valid.- Specified by:
addDises
in interfaceWritableDataRoutingService
- Parameters:
disConfigs
- the DataImportServiceConfigs to addcode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this update
-
addDises
public void addDises(@NotNull Collection<DataImportServiceConfig> disConfigs, @NotNull String user, @NotNull String code, @NotNull String comment) Description copied from interface:WritableDataRoutingServiceInternal
Add one or more DataImportServiceConfigs to the data routing configuration. The disConfigs will be checked as they are added, ensuring that the configuration as a whole is valid.- Specified by:
addDises
in interfaceWritableDataRoutingServiceInternal
- Parameters:
disConfigs
- the DataImportServiceConfigs to adduser
- pass-thru to kv persistence, indicates the user making this changecode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this update
-
updateDises
public void updateDises(@NotNull Collection<DataImportServiceConfig> disConfigs, @NotNull String code, @NotNull String comment) Description copied from interface:WritableDataRoutingService
Update one or more DataImportServiceConfigs in the data routing configuration. Configurations that do not exist will be added. The disConfigs will be checked as they are updated, ensuring that the configuration as a whole is valid.- Specified by:
updateDises
in interfaceWritableDataRoutingService
- Parameters:
disConfigs
- the DataImportServiceConfigs to updatecode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this update
-
updateDises
public void updateDises(@NotNull Collection<DataImportServiceConfig> disConfigs, @NotNull String user, @NotNull String code, @NotNull String comment) Description copied from interface:WritableDataRoutingServiceInternal
Update one or more DataImportServiceConfigs in the data routing configuration. The disConfigs will be checked as they are updated, ensuring that the configuration as a whole is valid.- Specified by:
updateDises
in interfaceWritableDataRoutingServiceInternal
- Parameters:
disConfigs
- the DataImportServiceConfigs to updateuser
- pass-thru to kv persistence, indicates the user making this changecode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this update
-
removeDises
public void removeDises(@NotNull Collection<String> disNames, @NotNull String code, @NotNull String comment, WritableDataRoutingService.Options... options) Description copied from interface:WritableDataRoutingService
Remove one or more DataImportServiceConfigs from the data routing configuration. The named dises must exist, as separately added configurations (not inline in the main file). The routing configuration will be checked as they are removed, ensuring that the configuration as a whole is valid.- Specified by:
removeDises
in interfaceWritableDataRoutingService
- Parameters:
disNames
- the names of the DataImportServiceConfigs to removecode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this updateoptions
- ifWritableDataRoutingService.Options.LENIENT
is given, it is not considered an error if any of the named dises do not exist. ifWritableDataRoutingService.Options.IGNORE_ERRORS
is given, any parsing errors encountered while removing the dises will be ignored.
-
removeDises
public void removeDises(@NotNull Collection<String> disNames, @NotNull String user, @NotNull String code, @NotNull String comment, WritableDataRoutingService.Options... options) Description copied from interface:WritableDataRoutingServiceInternal
Remove one or more DataImportServiceConfigs from the data routing configuration. The named dises must exist as a separately added configuration (not inline in the main file). The routing configuration will be checked as they are removed, ensuring that the configuration as a whole is valid.- Specified by:
removeDises
in interfaceWritableDataRoutingServiceInternal
- Parameters:
disNames
- the names of the DataImportServiceConfigs to removeuser
- pass-thru to kv persistence, indicates the user making this changecode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this updateoptions
- ifWritableDataRoutingService.Options.LENIENT
is given, it is not considered an error if any of the named dises do not exist. ifWritableDataRoutingService.Options.IGNORE_ERRORS
is given, any parsing errors encountered while removing the dises will be ignored. * @throws DataRoutingConfigurationException if the updated routing configuration is invalid in any way
-
replaceConfiguration
public void replaceConfiguration(@Nullable String routingYmlString, @NotNull Collection<DataImportServiceConfig> disConfigs, @NotNull String code, @NotNull String comment, WritableDataRoutingService.Options... options) Description copied from interface:WritableDataRoutingService
Replace the existing base and set of configurations with the given configurations. Any existing DIS configurations not in disConfigs will be removed.- Specified by:
replaceConfiguration
in interfaceWritableDataRoutingService
- Parameters:
routingYmlString
- (optional) YAML representation of the new data routing configuration. If not specified, the existing base configuration will be used.disConfigs
- the DataImportServiceConfigs to addcode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this updateoptions
- use IGNORE_ERRORS with extreme caution. If set, any errors encountered while adding the dises will be ignored, and it is therefore possible to persist an invalid configuration.
-
replaceConfiguration
public void replaceConfiguration(@Nullable String routingYmlString, @NotNull Collection<DataImportServiceConfig> disConfigs, @NotNull String user, @NotNull String code, @NotNull String comment, WritableDataRoutingService.Options... options) Description copied from interface:WritableDataRoutingServiceInternal
Replace the existing set of configurations with the given collection. Any existing configurations not in disConfigs will be removed.- Specified by:
replaceConfiguration
in interfaceWritableDataRoutingServiceInternal
- Parameters:
routingYmlString
- (optional) YAML representation of the new data routing configuration. If not specified, the existing base configuration will be used.disConfigs
- the DataImportServiceConfigs to adduser
- pass-thru to kv persistence, indicates the user making this changecode
- pass-thru to kv persistence, indicates the code source of this updatecomment
- pass-thru to kv persistence - a comment for this updateoptions
- use IGNORE_ERRORS with extreme caution. If set, any errors encountered while adding the dises will be ignored, and it is therefore possible to persist an invalid configuration.
-
getImplementationName
Description copied from interface:NamedImplementation
Get a name for the implementing class. Useful for abstract classes that implement
LogOutputAppendable
or overridetoString
.The default implementation is correct, but not suitable for high-frequency usage.
- Specified by:
getImplementationName
in interfaceNamedImplementation
- Returns:
- A name for the implementing class
-
about
Description copied from interface:DataRoutingService
Information about a DataRoutingService instance. Useful for debugging.- Specified by:
about
in interfaceDataRoutingService
- Specified by:
about
in classDataRoutingService.Delegating
- Returns:
- a string containing information about the instance
-
toString
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSafeCloseable
- Overrides:
close
in classDataRoutingService.Delegating
-
asYamlString
Description copied from interface:DataRoutingService
Serialize the data routing as a YAML string. Internal use only.- Specified by:
asYamlString
in interfaceDataRoutingService
- Overrides:
asYamlString
in classDataRoutingService.Delegating
- Returns:
- YAML representation of the configuration
-
getDelegate
- Specified by:
getDelegate
in classDataRoutingService.Delegating
-
supportsChangeNotification
public boolean supportsChangeNotification()Description copied from interface:DataRoutingService
Probe the implementation to find out if change notification is supported.- Specified by:
supportsChangeNotification
in interfaceDataRoutingService
- Overrides:
supportsChangeNotification
in classDataRoutingService.Delegating
- Returns:
- true if change notifications are supported.
-
listen
Description copied from interface:DataRoutingService
Add a listener for changes to the DataRoutingService configuration.- Specified by:
listen
in interfaceDataRoutingService
- Overrides:
listen
in classDataRoutingService.Delegating
- Parameters:
listener
- configuration change notices will be published to this listener- Returns:
- the current configuration version
-
removeListener
Description copied from interface:DataRoutingService
Remove the given listener from the list of listeners.- Specified by:
removeListener
in interfaceDataRoutingService
- Overrides:
removeListener
in classDataRoutingService.Delegating
- Parameters:
listener
- the listener to remove- Returns:
- true if a listener was removed, false if it could not be found or could not be removed
-