Class PqStorageKvBase
java.lang.Object
com.illumon.iris.controller.pqstorage.PqStorageKvBase
- All Implemented Interfaces:
PqStorage
- Direct Known Subclasses:
PqStorageEtcdImpl
Abstract base for
PqStorage which uses a kv-store for its underlying storage. It includes a local cache to speed
operations. This local cache is generally trusted when determining whether or not a query exists. However, if the revision
is wrong when attempting to update or delete a persistent query, instead of crashing the controller, we'll just update the
revision for that query, overwriting what was there.-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd the specified persistent query configuration.voidCommit a checkpoint.booleanDelete the specified persistent query configuration.voiddisconnect(boolean forceCheckpoint) Disconnect from the storage mechanism.getLatestPersistentQueryConfigurationFromKvClient(long serial) Get the latest revision version of aPersistentQueryConfigurationfrom the kv client (not from the local cache).getPersistentQueryConfiguration(long serial) Return thePersistentQueryConfigurationfor the specified serial.keySet()Return the Set of persisted serials.booleanUpdate the specified persistent query configuration.values()Return a Collection containing all the persistedPersistentQueryConfigurationinstances.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.controller.pqstorage.PqStorage
initialize
-
Method Details
-
getPersistentQueryConfiguration
Description copied from interface:PqStorageReturn thePersistentQueryConfigurationfor the specified serial.- Specified by:
getPersistentQueryConfigurationin interfacePqStorage- Parameters:
serial- the serial for the query- Returns:
- the query, or null if it does not exist
-
addPersistentQueryConfiguration
Description copied from interface:PqStorageAdd the specified persistent query configuration. If the configuration already exists, it will not be updated.- Specified by:
addPersistentQueryConfigurationin interfacePqStorage- Parameters:
config- the configuration to add- Returns:
- true if the configuration was added, false if it already existed
-
updatePersistentQueryConfiguration
Description copied from interface:PqStorageUpdate the specified persistent query configuration. If the configuration does not exist, it will not be created.- Specified by:
updatePersistentQueryConfigurationin interfacePqStorage- Parameters:
config- the configuration to update- Returns:
- true if the (existing) configuration was updated, false if it did not exist
-
deletePersistentQueryConfiguration
Description copied from interface:PqStorageDelete the specified persistent query configuration.- Specified by:
deletePersistentQueryConfigurationin interfacePqStorage- Parameters:
config- the configuration to update- Returns:
- true if the configuration was deleted, false if it did not exist
-
commitCheckPoint
public void commitCheckPoint()Description copied from interface:PqStorageCommit a checkpoint. This may be a no-op.- Specified by:
commitCheckPointin interfacePqStorage
-
disconnect
public void disconnect(boolean forceCheckpoint) Description copied from interface:PqStorageDisconnect from the storage mechanism.- Specified by:
disconnectin interfacePqStorage- Parameters:
forceCheckpoint- if true, perform a checkpoint
-
keySet
Description copied from interface:PqStorageReturn the Set of persisted serials. There are no guarantees on the type, mutability, serializability, or thread-safety of the Set returned. -
values
Description copied from interface:PqStorageReturn a Collection containing all the persistedPersistentQueryConfigurationinstances. Updates to these PersistentQueryConfiguration instances should be persisted viaPqStorage.updatePersistentQueryConfiguration(com.illumon.iris.controller.PersistentQueryConfiguration). There are no guarantees on the type, mutability, serializability, or thread-safety of the Collection returned, or of the objects contained within the Collection. -
getLatestPersistentQueryConfigurationFromKvClient
@Nullable public PersistentQueryConfiguration getLatestPersistentQueryConfigurationFromKvClient(long serial) throws IOException Get the latest revision version of aPersistentQueryConfigurationfrom the kv client (not from the local cache).- Parameters:
serial- the PQ's serial- Returns:
- the PQ, or null if it can't be found
- Throws:
IOException
-