本文主要聊一下jesque的几个dao
jesque-2.1.0-sources.jar!/net/greghaines/jesque/meta/dao/FailureDAO.java
/**
* FailureDAO provides access to job failures.
*
* @author Greg Haines
*/
public interface FailureDAO {
/**
* @return total number of failures
*/
long getCount();
/**
* @param offset offset into the failures
* @param count number of failures to return
* @return a sub-list of the failures
*/
List<JobFailure> getFailures(long offset, long count);
/**
* Clear the list of failures.
*/
void clear();
/**
* Re-queue a job for execution.
* @param index the index into the failure list
* @return the date the job was re-queued
*/
Date requeue(long index);
/**
* Remove a failure from the list.
* @param index the index of the failure to remove
*/
void remove(long index);
}
主要操纵的是namespace:failed,是一个list类型
jesque-2.1.0-sources.jar!/net/greghaines/jesque/meta/dao/KeysDAO.java
/**
* KeysDAO provides access to available keys.
*
* @author Greg Haines
*/
public interface KeysDAO {
/**
* Get basic key info.
* @param key the key name
* @return the key information or null if the key did not exist
*/
KeyInfo getKeyInfo(String key);
/**
* Get basic key info plus a sub-list of the array value for the key, if applicable.
* @param key the key name
* @param offset the offset into the array
* @param count the number of values to return
* @return the key information or null if the key did not exist
*/
KeyInfo getKeyInfo(String key, int offset, int count);
/**
* Get basic info on all keys.
* @return a list of key informations
*/
List<KeyInfo> getKeyInfos();
/**
* @return information about the backing Redis database
*/
Map<String, String> getRedisInfo();
}
jesque-2.1.0-sources.jar!/net/greghaines/jesque/meta/dao/QueueInfoDAO.java
/**
* QueueInfoDAO provides access to the queues in use by Jesque.
*
* @author Greg Haines
*/
public interface QueueInfoDAO {
/**
* @return the list of queue names
*/
List<String> getQueueNames();
/**
* @return total number of jobs pending in all queues
*/
long getPendingCount();
/**
* @return total number of jobs processed
*/
long getProcessedCount();
/**
* @return the list of queue informations
*/
List<QueueInfo> getQueueInfos();
/**
* @param name the queue name
* @param jobOffset the offset into the queue
* @param jobCount the number of jobs to return
* @return the queue information or null if the queue does not exist
*/
QueueInfo getQueueInfo(String name, long jobOffset, long jobCount);
/**
* Delete the given queue.
* @param name the name of the queue
*/
void removeQueue(String name);
}
jesque-2.1.0-sources.jar!/net/greghaines/jesque/meta/dao/WorkerInfoDAO.java
/**
* WorkerInfoDAO provides access to information about workers.
*
* @author Greg Haines
*/
public interface WorkerInfoDAO {
/**
* @return total number of workers known
*/
long getWorkerCount();
/**
* @return number of active workers
*/
long getActiveWorkerCount();
/**
* @return number of paused workers
*/
long getPausedWorkerCount();
/**
* @return information about all active workers
*/
List<WorkerInfo> getActiveWorkers();
/**
* @return information about all paused workers
*/
List<WorkerInfo> getPausedWorkers();
/**
* @return information about all workers
*/
List<WorkerInfo> getAllWorkers();
/**
* @param workerName the name of the worker
* @return information about the given worker or null if that worker does not exist
*/
WorkerInfo getWorker(String workerName);
/**
* @return a map of worker informations by hostname
*/
Map<String, List<WorkerInfo>> getWorkerHostMap();
/**
* Removes the metadata about a worker.
*
* @param workerName
* The worker name to remove
*/
void removeWorker(String workerName);
}