public abstract class BaseCollectionStatsStorage extends Object implements StatsStorage
StatsStorage
interface, backed by MapDBModifier and Type | Class and Description |
---|---|
static class |
BaseCollectionStatsStorage.SessionTypeId |
static class |
BaseCollectionStatsStorage.SessionTypeWorkerId |
Modifier and Type | Field and Description |
---|---|
protected List<StatsStorageListener> |
listeners |
protected Set<String> |
sessionIDs |
protected Map<BaseCollectionStatsStorage.SessionTypeWorkerId,Persistable> |
staticInfo |
protected Map<BaseCollectionStatsStorage.SessionTypeId,StorageMetaData> |
storageMetaData |
protected Map<BaseCollectionStatsStorage.SessionTypeWorkerId,Map<Long,Persistable>> |
updates |
Modifier | Constructor and Description |
---|---|
protected |
BaseCollectionStatsStorage() |
Modifier and Type | Method and Description |
---|---|
protected List<StatsStorageEvent> |
checkStorageEvents(Persistable p) |
void |
deregisterStatsStorageListener(StatsStorageListener listener)
Remove the specified listener, if it is present.
|
List<Persistable> |
getAllStaticInfos(String sessionID,
String typeID)
Get all static informations for the given session and type ID
|
List<Persistable> |
getAllUpdatesAfter(String sessionID,
String typeID,
long timestamp)
Get all updates for the given session ID (all worker IDs), that occur after (not including) the given timestamp.
|
List<Persistable> |
getAllUpdatesAfter(String sessionID,
String typeID,
String workerID,
long timestamp)
Get all updates for the given session and worker ID, that occur after (not including) the given timestamp.
|
long[] |
getAllUpdateTimes(String sessionID,
String typeID,
String workerID)
List the times of all updates for the specified sessionID, typeID and workerID
|
Persistable |
getLatestUpdate(String sessionID,
String typeID,
String workerID)
Get the latest update record (i.e., update record with the largest timestamp value) for the specified
session and worker IDs
|
List<Persistable> |
getLatestUpdateAllWorkers(String sessionID,
String typeID)
Get the latest update for all workers, for the given session ID
|
List<StatsStorageListener> |
getListeners()
Get a list (shallow copy) of all listeners currently present
|
int |
getNumUpdateRecordsFor(String sessionID)
Return the number of update records for the given session ID (all workers)
|
int |
getNumUpdateRecordsFor(String sessionID,
String typeID,
String workerID)
Return the number of update records for the given session ID and worker ID
|
Persistable |
getStaticInfo(String sessionID,
String typeID,
String workerID)
Get the static info for the given session and worker IDs, or null if no such static info has been reported
|
StorageMetaData |
getStorageMetaData(String sessionID,
String typeID)
Get the session metadata, if any has been registered via
StatsStorageRouter.putStorageMetaData(StorageMetaData) |
Persistable |
getUpdate(String sessionID,
String typeID,
String workerID,
long timestamp)
Get the specified update (or null, if none exists for the given session/worker ids and timestamp)
|
protected abstract Map<Long,Persistable> |
getUpdateMap(String sessionID,
String typeID,
String workerID,
boolean createIfRequired) |
List<Persistable> |
getUpdates(String sessionID,
String typeID,
String workerID,
long[] timestamps)
Get updates for the specified times only
|
List<String> |
listSessionIDs()
Get a list of all sessions stored by this storage backend
|
List<String> |
listTypeIDsForSession(String sessionID)
Get the list of type IDs for the given session ID
|
List<String> |
listWorkerIDsForSession(String sessionID)
For a given session ID, list all of the known worker IDs
|
List<String> |
listWorkerIDsForSessionAndType(String sessionID,
String typeID)
For a given session ID and type ID, list all of the known worker IDs
|
protected void |
notifyListeners(List<StatsStorageEvent> sses) |
void |
putStaticInfo(Collection<? extends Persistable> staticInfo)
Static info: reported once per session, upon initialization
|
abstract void |
putStaticInfo(Persistable staticInfo)
Static info: reported once per session, upon initialization
|
void |
putStorageMetaData(Collection<? extends StorageMetaData> storageMetaData) |
abstract void |
putStorageMetaData(StorageMetaData storageMetaData)
Method to store some additional metadata for each session.
|
void |
putUpdate(Collection<? extends Persistable> updates)
Updates: stored multiple times per session (periodically, for example)
|
abstract void |
putUpdate(Persistable update)
Updates: stored multiple times per session (periodically, for example)
|
void |
registerStatsStorageListener(StatsStorageListener listener)
Add a new StatsStorageListener.
|
void |
removeAllListeners()
Remove all listeners from the StatsStorage instance
|
boolean |
sessionExists(String sessionID)
Check if the specified session ID exists or not
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, isClosed
protected Map<BaseCollectionStatsStorage.SessionTypeId,StorageMetaData> storageMetaData
protected Map<BaseCollectionStatsStorage.SessionTypeWorkerId,Persistable> staticInfo
protected Map<BaseCollectionStatsStorage.SessionTypeWorkerId,Map<Long,Persistable>> updates
protected List<StatsStorageListener> listeners
protected abstract Map<Long,Persistable> getUpdateMap(String sessionID, String typeID, String workerID, boolean createIfRequired)
protected List<StatsStorageEvent> checkStorageEvents(Persistable p)
protected void notifyListeners(List<StatsStorageEvent> sses)
public List<String> listSessionIDs()
StatsStorage
listSessionIDs
in interface StatsStorage
public boolean sessionExists(String sessionID)
StatsStorage
sessionExists
in interface StatsStorage
sessionID
- Session ID to checkpublic Persistable getStaticInfo(String sessionID, String typeID, String workerID)
StatsStorage
getStaticInfo
in interface StatsStorage
sessionID
- Session IDworkerID
- worker IDpublic List<Persistable> getAllStaticInfos(String sessionID, String typeID)
StatsStorage
getAllStaticInfos
in interface StatsStorage
sessionID
- Session ID to get static info fortypeID
- Type ID to get static info forpublic List<String> listTypeIDsForSession(String sessionID)
StatsStorage
listTypeIDsForSession
in interface StatsStorage
sessionID
- Session ID to querypublic List<String> listWorkerIDsForSession(String sessionID)
StatsStorage
listWorkerIDsForSession
in interface StatsStorage
sessionID
- Session IDpublic List<String> listWorkerIDsForSessionAndType(String sessionID, String typeID)
StatsStorage
listWorkerIDsForSessionAndType
in interface StatsStorage
sessionID
- Session IDtypeID
- Type IDpublic int getNumUpdateRecordsFor(String sessionID)
StatsStorage
getNumUpdateRecordsFor
in interface StatsStorage
sessionID
- Session IDpublic int getNumUpdateRecordsFor(String sessionID, String typeID, String workerID)
StatsStorage
getNumUpdateRecordsFor
in interface StatsStorage
sessionID
- Session IDworkerID
- Worker IDpublic Persistable getLatestUpdate(String sessionID, String typeID, String workerID)
StatsStorage
getLatestUpdate
in interface StatsStorage
sessionID
- session IDworkerID
- worker IDpublic Persistable getUpdate(String sessionID, String typeID, String workerID, long timestamp)
StatsStorage
getUpdate
in interface StatsStorage
sessionID
- Session IDworkerID
- Worker IDtimestamp
- Timestamppublic List<Persistable> getLatestUpdateAllWorkers(String sessionID, String typeID)
StatsStorage
getLatestUpdateAllWorkers
in interface StatsStorage
sessionID
- Session IDpublic List<Persistable> getAllUpdatesAfter(String sessionID, String typeID, String workerID, long timestamp)
StatsStorage
getAllUpdatesAfter
in interface StatsStorage
sessionID
- Session IDworkerID
- Worker Idtimestamp
- Timestamppublic List<Persistable> getAllUpdatesAfter(String sessionID, String typeID, long timestamp)
StatsStorage
getAllUpdatesAfter
in interface StatsStorage
sessionID
- Session IDtimestamp
- Timestamppublic StorageMetaData getStorageMetaData(String sessionID, String typeID)
StatsStorage
StatsStorageRouter.putStorageMetaData(StorageMetaData)
getStorageMetaData
in interface StatsStorage
sessionID
- Session ID to get metadatpublic long[] getAllUpdateTimes(String sessionID, String typeID, String workerID)
StatsStorage
getAllUpdateTimes
in interface StatsStorage
sessionID
- Session ID to get update times fortypeID
- Type ID to get update times forworkerID
- Worker ID to get update times forpublic List<Persistable> getUpdates(String sessionID, String typeID, String workerID, long[] timestamps)
StatsStorage
getUpdates
in interface StatsStorage
sessionID
- Session ID to get update times fortypeID
- Type ID to get update times forworkerID
- Worker ID to get update times fortimestamps
- Timestamps to get the updates for. Note that if one of the specified times does not exist,
it will be ommitted from the returned results list.public abstract void putStaticInfo(Persistable staticInfo)
StatsStorageRouter
putStaticInfo
in interface StatsStorageRouter
staticInfo
- Static info to storepublic void putStaticInfo(Collection<? extends Persistable> staticInfo)
StatsStorageRouter
putStaticInfo
in interface StatsStorageRouter
staticInfo
- Static info to storepublic abstract void putUpdate(Persistable update)
StatsStorageRouter
putUpdate
in interface StatsStorageRouter
update
- Update info to storepublic void putUpdate(Collection<? extends Persistable> updates)
StatsStorageRouter
putUpdate
in interface StatsStorageRouter
updates
- Update info to storepublic abstract void putStorageMetaData(StorageMetaData storageMetaData)
StatsStorageRouter
putStorageMetaData
in interface StatsStorageRouter
storageMetaData
- Storage metadata to storepublic void putStorageMetaData(Collection<? extends StorageMetaData> storageMetaData)
putStorageMetaData
in interface StatsStorageRouter
public void registerStatsStorageListener(StatsStorageListener listener)
StatsStorage
registerStatsStorageListener
in interface StatsStorage
listener
- Listener to addpublic void deregisterStatsStorageListener(StatsStorageListener listener)
StatsStorage
deregisterStatsStorageListener
in interface StatsStorage
listener
- Listener to removepublic void removeAllListeners()
StatsStorage
removeAllListeners
in interface StatsStorage
public List<StatsStorageListener> getListeners()
StatsStorage
getListeners
in interface StatsStorage
Copyright © 2020. All rights reserved.