public class BasicDatasourcePartitionManager extends java.lang.Object implements PartitionManager
Constructor and Description |
---|
BasicDatasourcePartitionManager(GatewayContext context,
java.lang.String dataSource,
int driverId) |
BasicDatasourcePartitionManager(GatewayContext context,
java.lang.String queryId,
java.lang.String dataSource,
int driverId) |
Modifier and Type | Method and Description |
---|---|
void |
deleteOldParitions(long ageMS)
Will delete all parititions older than the given age.
|
protected Datasource |
getDatasource() |
protected int |
getDriverId() |
LoggerEx |
getLogger() |
java.util.List<Partition> |
getMostRecentPartitions(int count,
long windowSize)
Retrieves partitions order by start time desc.
|
java.util.List<Partition> |
getOlderPartitions(long time,
long windowSize,
int limit)
Retrieves the partitions with data equal to or older than the specified time, sorted DESC (most recent first).
|
Partition |
getPartition(long time,
long windowSize)
Retrieves the partition that contains the given time, as close to the resolution as possible
|
java.util.List<Partition> |
getPartitions(long start,
long end,
long windowSize)
Returns the partitions for a span of time, choosing the coarsest partitions available for the window size.
|
QueryCache |
getQueryCache() |
void |
initialize() |
protected Partition |
loadPartitionFromDS(Dataset data)
Returns the first partition defined in the dataset, or null if there isn't one.
|
protected java.util.List<Partition> |
loadPartitionsFromDS(Dataset data)
Returns all of the partitions defined in a dataset.
|
protected boolean |
partitionExists(java.lang.String name) |
protected java.util.List<Partition> |
runParititionQuery(java.lang.String query,
java.lang.Object... params)
Runs the getOlderPartitions and getPartitions queries.
|
void |
shutdown() |
public BasicDatasourcePartitionManager(GatewayContext context, java.lang.String dataSource, int driverId)
public BasicDatasourcePartitionManager(GatewayContext context, java.lang.String queryId, java.lang.String dataSource, int driverId)
public LoggerEx getLogger()
public QueryCache getQueryCache()
protected int getDriverId()
protected Datasource getDatasource()
public void initialize() throws java.lang.Exception
initialize
in interface PartitionManager
java.lang.Exception
public void shutdown()
shutdown
in interface PartitionManager
public Partition getPartition(long time, long windowSize) throws java.lang.Exception
PartitionManager
getPartition
in interface PartitionManager
java.lang.Exception
public java.util.List<Partition> getOlderPartitions(long time, long windowSize, int limit) throws java.lang.Exception
PartitionManager
getOlderPartitions
in interface PartitionManager
limit
- if 0, no limit, otherwise only returns up to that many partitions.java.lang.Exception
public java.util.List<Partition> getPartitions(long start, long end, long windowSize) throws java.lang.Exception
getPartitions
in interface PartitionManager
java.lang.Exception
protected java.util.List<Partition> runParititionQuery(java.lang.String query, java.lang.Object... params) throws java.lang.Exception
query
- params
- java.lang.Exception
protected Partition loadPartitionFromDS(Dataset data)
data
- protected java.util.List<Partition> loadPartitionsFromDS(Dataset data)
data
- public java.util.List<Partition> getMostRecentPartitions(int count, long windowSize) throws java.lang.Exception
PartitionManager
getMostRecentPartitions
in interface PartitionManager
java.lang.Exception
public void deleteOldParitions(long ageMS) throws java.lang.Exception
deleteOldParitions
in interface PartitionManager
ageMS
- java.lang.Exception
protected boolean partitionExists(java.lang.String name) throws java.lang.Exception
java.lang.Exception