40
42
period_start = start
41
43
increment = datetime.timedelta(seconds=period)
42
for i in xrange(int(math.ceil(
44
for i in moves.xrange(int(math.ceil(
43
45
timeutils.delta_seconds(start, end)
44
46
/ float(period)))):
45
47
next_start = period_start + increment
116
118
class Connection(object):
117
119
"""Base class for storage system connections."""
121
"""A dictionary representing the capabilities of this driver.
123
DEFAULT_CAPABILITIES = {
124
'meters': {'pagination': False,
125
'query': {'simple': False,
128
'resources': {'pagination': False,
129
'query': {'simple': False,
132
'samples': {'pagination': False,
134
'query': {'simple': False,
137
'statistics': {'pagination': False,
139
'query': {'simple': False,
142
'aggregation': {'standard': False,
150
'cardinality': False}}
152
'alarms': {'query': {'simple': False,
154
'history': {'query': {'simple': False,
156
'events': {'query': {'simple': False}},
120
160
def __init__(conf):
121
161
"""Constructor."""
207
247
raise NotImplementedError(_('Samples not implemented'))
210
def get_meter_statistics(sample_filter, period=None, groupby=None):
250
def get_meter_statistics(sample_filter, period=None, groupby=None,
211
252
"""Return an iterable of model.Statistics instances.
213
254
The filter must have a meter value set.
315
356
:param event_type: the type of the Event to filter by
316
357
:param trait_type: the name of the Trait to filter by
318
360
raise NotImplementedError(_('Events not implemented.'))
363
def query_samples(filter_expr=None, orderby=None, limit=None):
364
"""Return an iterable of model.Sample objects.
366
:param filter_expr: Filter expression for query.
367
:param orderby: List of field name and direction pairs for order by.
368
:param limit: Maximum number of results to return.
371
raise NotImplementedError(_('Complex query for samples \
372
is not implemented.'))
375
def query_alarms(filter_expr=None, orderby=None, limit=None):
376
"""Return an iterable of model.Alarm objects.
378
:param filter_expr: Filter expression for query.
379
:param orderby: List of field name and direction pairs for order by.
380
:param limit: Maximum number of results to return.
383
raise NotImplementedError(_('Complex query for alarms \
384
is not implemented.'))
387
def query_alarm_history(filter_expr=None, orderby=None, limit=None):
388
"""Return an iterable of model.AlarmChange objects.
390
:param filter_expr: Filter expression for query.
391
:param orderby: List of field name and direction pairs for order by.
392
:param limit: Maximum number of results to return.
395
raise NotImplementedError(_('Complex query for alarms \
396
history is not implemented.'))
399
def get_capabilities():
400
"""Return an dictionary representing the capabilities of this driver.
402
raise NotImplementedError(_('Capabilities not implemented.'))