Package cn.boboweike.carrot.storage
Class InMemoryPartitionedStorageProvider
- java.lang.Object
-
- cn.boboweike.carrot.storage.AbstractPartitionedStorageProvider
-
- cn.boboweike.carrot.storage.InMemoryPartitionedStorageProvider
-
- All Implemented Interfaces:
PartitionedStorageProvider,AutoCloseable
public class InMemoryPartitionedStorageProvider extends AbstractPartitionedStorageProvider
-
-
Field Summary
-
Fields inherited from interface cn.boboweike.carrot.storage.PartitionedStorageProvider
BATCH_SIZE, DEFAULT_NUM_OF_PARTITIONS, PARTITION_HINT_KEY, PARTITION_PREFIX
-
-
Constructor Summary
Constructors Modifier Constructor Description InMemoryPartitionedStorageProvider()protectedInMemoryPartitionedStorageProvider(RateLimiter rateLimiter)
-
Method Summary
-
Methods inherited from class cn.boboweike.carrot.storage.AbstractPartitionedStorageProvider
addTaskStorageOnChangeListener, close, getName, notifyMetadataChangeListeners, notifyMetadataChangeListeners, notifyTaskStatsOnChangeListeners, notifyTaskStatsOnChangeListenersIf, removeTaskStorageOnChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cn.boboweike.carrot.storage.PartitionedStorageProvider
getTaskById
-
-
-
-
Constructor Detail
-
InMemoryPartitionedStorageProvider
public InMemoryPartitionedStorageProvider()
-
InMemoryPartitionedStorageProvider
protected InMemoryPartitionedStorageProvider(RateLimiter rateLimiter)
-
-
Method Detail
-
getTotalNumOfPartitions
public int getTotalNumOfPartitions()
-
lockByPartition
public boolean lockByPartition(Integer partition, int durationInSeconds, String lockedBy)
-
extendLockByPartition
public boolean extendLockByPartition(Integer partition, int durationInSeconds, String lockedBy)
-
unlockByPartition
public boolean unlockByPartition(Integer partition)
-
setTaskMapper
public void setTaskMapper(TaskMapper taskMapper)
-
setPartitioner
public void setPartitioner(Partitioner partitioner)
-
setUpStorageProvider
public void setUpStorageProvider(StorageProviderUtils.DatabaseOptions databaseOptions)
Description copied from interface:PartitionedStorageProviderThis method allows to reinitialize the StorageProvider. It can be used if you are using Flyway or Liquibase to setup your database manually. By default, this method is automatically called on construction of the StorageProvider- Parameters:
databaseOptions- defines whether to set up the StorageProvider or validate whether the StorageProvider is set up correctly.
-
announceBackgroundTaskServer
public void announceBackgroundTaskServer(BackgroundTaskServerStatus serverStatus)
-
signalBackgroundTaskServerAlive
public boolean signalBackgroundTaskServerAlive(BackgroundTaskServerStatus serverStatus)
-
signalBackgroundTaskServerStopped
public void signalBackgroundTaskServerStopped(BackgroundTaskServerStatus serverStatus)
-
getBackgroundTaskServers
public List<BackgroundTaskServerStatus> getBackgroundTaskServers()
-
getLongestRunningBackgroundTaskServerId
public UUID getLongestRunningBackgroundTaskServerId()
-
removeTimedOutBackgroundTaskServers
public int removeTimedOutBackgroundTaskServers(Instant heartbeatOlderThan)
-
saveMetadata
public void saveMetadata(CarrotMetadata metadata)
-
getMetadata
public List<CarrotMetadata> getMetadata(String name)
-
getMetadata
public CarrotMetadata getMetadata(String name, String owner)
-
deleteMetadata
public void deleteMetadata(String name)
-
getTasksByPartition
public List<Task> getTasksByPartition(StateName state, Instant updatedBefore, PageRequest pageRequest, Integer partition)
-
getScheduledTasksByPartition
public List<Task> getScheduledTasksByPartition(Instant scheduledBefore, PageRequest pageRequest, Integer partition)
-
getTasksByPartition
public List<Task> getTasksByPartition(StateName state, PageRequest pageRequest, Integer partition)
-
getTaskPageByPartition
public Page<Task> getTaskPageByPartition(StateName state, PageRequest pageRequest, Integer partition)
-
deleteTasksPermanentlyByPartition
public int deleteTasksPermanentlyByPartition(StateName state, Instant updatedBefore, Integer partition)
-
existsByPartition
public boolean existsByPartition(TaskDetails taskDetails, Integer partition, StateName... states)
-
recurringTaskExistsByPartition
public boolean recurringTaskExistsByPartition(String recurringTaskId, Integer partition, StateName... states)
-
saveRecurringTask
public RecurringTask saveRecurringTask(RecurringTask recurringTask)
-
getRecurringTasksByPartition
public List<RecurringTask> getRecurringTasksByPartition(Integer partition)
-
getRecurringTasks
public List<RecurringTask> getRecurringTasks()
-
countRecurringTasksByPartition
public long countRecurringTasksByPartition(Integer partition)
-
deleteRecurringTask
public int deleteRecurringTask(String id)
-
getTaskStatsData
public TaskStatsData getTaskStatsData()
-
publishTotalAmountOfSucceededTasks
public void publishTotalAmountOfSucceededTasks(int amount)
-
-