public interface AccountingPersistenceBackendQuery
| Modifier and Type | Field and Description |
|---|---|
static int |
KEY_VALUES_LIMIT |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection to persistence
|
SortedMap<Filter,SortedMap<Calendar,Info>> |
getContextTimeSeries()
Return a SortedMap containing the TimeSeries for each context.
|
SortedSet<NumberedFilter> |
getFilterValues(String key) |
SortedSet<NumberedFilter> |
getFilterValues(String key,
Integer limit) |
org.gcube.documentstore.records.Record |
getRecord(String recordId,
String type) |
static String |
getScopeToQuery() |
SortedMap<Filter,SortedMap<Calendar,Info>> |
getSpaceTimeSeries(Set<String> dataTypes) |
SortedMap<Calendar,Info> |
getTimeSeries()
Query the persistence obtaining a Map where the date is the key and the
#Info is the value.
|
SortedMap<NumberedFilter,SortedMap<Calendar,Info>> |
getTopValues(String topKey,
String orderingProperty,
Integer limit)
Return a SortedMap containing the TimeSeries for top values for a certain
key taking in account all Filters.
|
List<UsageValue> |
getUsageValueQuotaTotal(List<UsageValue> listUsage)
getUsageValueQuotaTotal
Example to require 2 different quota (lucio.lelii for service and alessandro.pieve for storage)
Input:
[
TotalFilters [
clz=class org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord,
temporalConstraint=StartTime : 2015-05-01 11:42:34:515 UTC (1430480554515 millis), EndTime : 2016-11-09 11:42:34:515 UTC (1478691754515 millis),
Aggregated DAILY,
totalFilters=[
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "DataAccess" },
{ "serviceName" : "CkanConnector" }
], d=null, orderingProperty=null],
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "VREManagement" }
], d=null, orderingProperty=null]
], d=null, orderingProperty=null]
]
Output:
[
TotalFilters [
clz=class org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord,
temporalConstraint=StartTime : 2015-05-01 11:42:34:515 UTC (1430480554515 millis), EndTime : 2016-11-09 11:42:34:515 UTC (1478691754515 millis),
Aggregated DAILY,
totalFilters=[
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "DataAccess" },
{ "serviceName" : "CkanConnector" }
], d=1.0, orderingProperty=operationCount],
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "VREManagement" }
], d=1.0, orderingProperty=operationCount]
], d=2.0, orderingProperty=null]
]
|
boolean |
isConnectionActive() |
void |
prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) |
void |
setContexts(Set<String> contexts) |
void |
setFilters(Collection<? extends Filter> filters) |
void |
setRequestedRecords(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz) |
void |
setTemporalConstraint(TemporalConstraint temporalConstraint) |
static final int KEY_VALUES_LIMIT
static String getScopeToQuery()
void prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) throws Exception
Exceptionvoid setRequestedRecords(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz)
clz - the Usage Record Class of interest
Requiredvoid setTemporalConstraint(TemporalConstraint temporalConstraint)
temporalConstraint - the TemporalConstraint (interval and aggregation)
Requiredvoid setContexts(Set<String> contexts)
contexts - the list of context to use as filter
If null or empty list get all data for the interested Record Class
with the applying temporal constraint with no contexts constraint.
The contexts are evaluated in OR.void setFilters(Collection<? extends Filter> filters)
filters - list of filter to obtain the results.
If null or empty list get all data for the interested Record Class
with the applying temporal constraint.
All Filter must have not null and not empty key and value.
The filters must be related to different keys and are in AND.
If the list contains more than one filter with the same key an Exception is thrown
when trying to query.SortedMap<Calendar,Info> getTimeSeries() throws Exception
ExceptionSortedMap<Filter,SortedMap<Calendar,Info>> getContextTimeSeries() throws Exception
ExceptionSortedMap<NumberedFilter,SortedMap<Calendar,Info>> getTopValues(String topKey, String orderingProperty, Integer limit) throws Exception
topKey - the key to obtain top valuesorderingProperty - Exceptionvoid close()
throws Exception
Exception - if the close failsSortedSet<NumberedFilter> getFilterValues(String key) throws Exception
ExceptionSortedSet<NumberedFilter> getFilterValues(String key, Integer limit) throws Exception
Exceptionorg.gcube.documentstore.records.Record getRecord(String recordId, String type) throws Exception
ExceptionSortedMap<Filter,SortedMap<Calendar,Info>> getSpaceTimeSeries(Set<String> dataTypes) throws Exception
ExceptionList<UsageValue> getUsageValueQuotaTotal(List<UsageValue> listUsage) throws Exception
listUsage - ExceptionCopyright © 2021. All Rights Reserved.