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.PropertyProviderNested 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.voidaddDises(Collection<DataImportServiceConfig> disConfigs, String code, String comment) Add one or more DataImportServiceConfigs to the data routing configuration.voidaddDises(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.voidclose()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 DataRoutingServiceabstract StringGet a name for the implementing class.longlisten(DataRoutingConfigListener listener) Add a listener for changes to the DataRoutingService configuration.voidremoveDises(Collection<String> disNames, String code, String comment, WritableDataRoutingService.Options... options) Remove one or more DataImportServiceConfigs from the data routing configuration.voidremoveDises(Collection<String> disNames, String user, String code, String comment, WritableDataRoutingService.Options... options) Remove one or more DataImportServiceConfigs from the data routing configuration.booleanremoveListener(DataRoutingConfigListener listener) Remove the given listener from the list of listeners.voidreplaceConfiguration(String routingYmlString, Collection<DataImportServiceConfig> disConfigs, String code, String comment, WritableDataRoutingService.Options... options) Replace the existing base and set of configurations with the given configurations.voidreplaceConfiguration(String routingYmlString, Collection<DataImportServiceConfig> disConfigs, String user, String code, String comment, WritableDataRoutingService.Options... options) Replace the existing set of configurations with the given collection.booleanProbe the implementation to find out if change notification is supported.toString()voidReplace the existing data routing configuration.voidReplace the existing data routing configuration.voidupdateDises(Collection<DataImportServiceConfig> disConfigs, String code, String comment) Update one or more DataImportServiceConfigs in the data routing configuration.voidupdateDises(Collection<DataImportServiceConfig> disConfigs, String user, String code, String comment) Update one or more DataImportServiceConfigs in the data routing configuration.static voidvalidateDisNames(Collection<String> disNames) Validate that the collection of names can be stored as key parts in etcd.Methods inherited from class com.illumon.iris.db.v2.routing.DataRoutingService.Delegating
getAllDataImportServiceDestinationConfigs, getAllLogAggregatorServiceConfigs, getCollectedClaims, getDataImportServiceConfig, getDataImportServiceDestinationConfigs, getLogAggregatorConfig, getLogAggregatorDestinationConfig, getStorage, getTableDataServiceConfig, getTableDataServiceConfigs, registerClaimsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.routing.filter.claims.ClaimsProvider
getCollectedClaims, registerClaimsMethods 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, getTableDataServiceConfigsMethods inherited from interface com.illumon.iris.db.v2.routing.endpoint.EndpointResolver
resolveLogAggregatorEndpoint, resolveTableDataEndpoint, resolveTailerEndpointMethods inherited from interface com.illumon.iris.db.v2.routing.dynamicdis.StorageLookup
getStorageMethods 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:DataRoutingServiceGet all DIS configs, optionally excluding core configs (those defined in the main routing yml file) For consumption by administrative tools.- Specified by:
getAllDataImportServiceConfigsin interfaceDataRoutingService- Overrides:
getAllDataImportServiceConfigsin 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:WritableDataRoutingServiceReplace the existing data routing configuration.- Specified by:
updatein 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:WritableDataRoutingServiceInternalReplace the existing data routing configuration.- Specified by:
updatein 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:WritableDataRoutingServiceAdd 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:
addDisesin 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:WritableDataRoutingServiceInternalAdd 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:
addDisesin 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:WritableDataRoutingServiceUpdate 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:
updateDisesin 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:WritableDataRoutingServiceInternalUpdate 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:
updateDisesin 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:WritableDataRoutingServiceRemove 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:
removeDisesin 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.LENIENTis given, it is not considered an error if any of the named dises do not exist. ifWritableDataRoutingService.Options.IGNORE_ERRORSis 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:WritableDataRoutingServiceInternalRemove 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:
removeDisesin 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.LENIENTis given, it is not considered an error if any of the named dises do not exist. ifWritableDataRoutingService.Options.IGNORE_ERRORSis 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:WritableDataRoutingServiceReplace the existing base and set of configurations with the given configurations. Any existing DIS configurations not in disConfigs will be removed.- Specified by:
replaceConfigurationin 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:WritableDataRoutingServiceInternalReplace the existing set of configurations with the given collection. Any existing configurations not in disConfigs will be removed.- Specified by:
replaceConfigurationin 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:NamedImplementationGet a name for the implementing class. Useful for abstract classes that implement
LogOutputAppendableor overridetoString.The default implementation is correct, but not suitable for high-frequency usage.
- Specified by:
getImplementationNamein interfaceNamedImplementation- Returns:
- A name for the implementing class
-
about
Description copied from interface:DataRoutingServiceInformation about a DataRoutingService instance. Useful for debugging.- Specified by:
aboutin interfaceDataRoutingService- Specified by:
aboutin classDataRoutingService.Delegating- Returns:
- a string containing information about the instance
-
toString
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSafeCloseable- Overrides:
closein classDataRoutingService.Delegating
-
asYamlString
Description copied from interface:DataRoutingServiceSerialize the data routing as a YAML string. Internal use only.- Specified by:
asYamlStringin interfaceDataRoutingService- Overrides:
asYamlStringin classDataRoutingService.Delegating- Returns:
- YAML representation of the configuration
-
getDelegate
- Specified by:
getDelegatein classDataRoutingService.Delegating
-
supportsChangeNotification
public boolean supportsChangeNotification()Description copied from interface:DataRoutingServiceProbe the implementation to find out if change notification is supported.- Specified by:
supportsChangeNotificationin interfaceDataRoutingService- Overrides:
supportsChangeNotificationin classDataRoutingService.Delegating- Returns:
- true if change notifications are supported.
-
listen
Description copied from interface:DataRoutingServiceAdd a listener for changes to the DataRoutingService configuration.- Specified by:
listenin interfaceDataRoutingService- Overrides:
listenin classDataRoutingService.Delegating- Parameters:
listener- configuration change notices will be published to this listener- Returns:
- the current configuration version
-
removeListener
Description copied from interface:DataRoutingServiceRemove the given listener from the list of listeners.- Specified by:
removeListenerin interfaceDataRoutingService- Overrides:
removeListenerin 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
-
validateDisNames
Validate that the collection of names can be stored as key parts in etcd. Throws a DataRoutingConfigurationException if any are invalid.- Parameters:
disNames- the collection of names to check.- Throws:
DataRoutingConfigurationException- if any names are invalid.
-