Interface PqStorage
- All Known Implementing Classes:
PqStorageEtcdImpl,PqStorageKvBase,PqStoragePhtImpl
public interface PqStorage
Interface for storage of persistent query configurations. Implementations must provide a no-arg constructor as they will
be created reflectively.
-
Method Summary
Modifier and Type Method Description booleanaddPersistentQueryConfiguration(PersistentQueryConfiguration config)Add the specified persistent query configuration.voidcommitCheckPoint()Commit a checkpoint.booleandeletePersistentQueryConfiguration(PersistentQueryConfiguration config)Delete the specified persistent query configuration.voiddisconnect(boolean forceCheckpoint)Disconnect from the storage mechanism.PersistentQueryConfigurationgetPersistentQueryConfiguration(long serial)Return thePersistentQueryConfigurationfor the specified serial.Set<Long>keySet()Return the Set of persisted serials.booleanupdatePersistentQueryConfiguration(PersistentQueryConfiguration config)Update the specified persistent query configuration.Collection<PersistentQueryConfiguration>values()Return a Collection containing all of the persistedPersistentQueryConfigurationinstances.
-
Method Details
-
getPersistentQueryConfiguration
Return thePersistentQueryConfigurationfor the specified serial.- Parameters:
serial- the serial for the query- Returns:
- the query, or null if it does not exist
-
addPersistentQueryConfiguration
boolean addPersistentQueryConfiguration(@NotNull PersistentQueryConfiguration config) throws IOExceptionAdd the specified persistent query configuration. If the configuration already exists, it will not be updated.- Parameters:
config- the configuration to add- Returns:
- true if the configuration was added, false if it already existed
- Throws:
IOException- if an error occurs during the persistence operation
-
updatePersistentQueryConfiguration
boolean updatePersistentQueryConfiguration(@NotNull PersistentQueryConfiguration config) throws IOExceptionUpdate the specified persistent query configuration. If the configuration does not exist, it will not be created.- Parameters:
config- the configuration to update- Returns:
- true if the (existing) configuration was updated, false if it did not exist
- Throws:
IOException- if an error occurs during the persistence operation
-
deletePersistentQueryConfiguration
boolean deletePersistentQueryConfiguration(@NotNull PersistentQueryConfiguration config) throws IOExceptionDelete the specified persistent query configuration.- Parameters:
config- the configuration to update- Returns:
- true if the configuration was deleted, false if it did not exist
- Throws:
IOException- if an error occurs during the persistence operation
-
commitCheckPoint
Commit a checkpoint. This may be a no-op.- Throws:
IOException- if an error occurs committing the checkpoint
-
disconnect
void disconnect(boolean forceCheckpoint)Disconnect from the storage mechanism.- Parameters:
forceCheckpoint- if true, perform a checkpoint
-
keySet
Return the Set of persisted serials. There are no guarantees on the type, mutability, serializability, or thread-safety of the Set returned.- Returns:
- a Set of the serials
-
values
Collection<PersistentQueryConfiguration> values()Return a Collection containing all of the persistedPersistentQueryConfigurationinstances. Updates to these PersistentQueryConfiguration instances should be persisted viaupdatePersistentQueryConfiguration(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.- Returns:
- a Collection of persistent query configurations
-