~ubuntu-branches/ubuntu/vivid/ceilometer/vivid

« back to all changes in this revision

Viewing changes to ceilometer/storage/base.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-03-06 14:44:28 UTC
  • mto: (28.1.1 utopic-proposed) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20140306144428-rvphsh4igwyulzf0
Tags: upstream-2014.1~b3
ImportĀ upstreamĀ versionĀ 2014.1~b3

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import math
24
24
import six
25
25
 
 
26
from six import moves
 
27
 
26
28
from ceilometer.openstack.common.gettextutils import _  # noqa
27
29
from ceilometer.openstack.common import timeutils
28
30
 
39
41
    """
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."""
118
120
 
 
121
    """A dictionary representing the capabilities of this driver.
 
122
    """
 
123
    DEFAULT_CAPABILITIES = {
 
124
        'meters': {'pagination': False,
 
125
                   'query': {'simple': False,
 
126
                             'metadata': False,
 
127
                             'complex': False}},
 
128
        'resources': {'pagination': False,
 
129
                      'query': {'simple': False,
 
130
                                'metadata': False,
 
131
                                'complex': False}},
 
132
        'samples': {'pagination': False,
 
133
                    'groupby': False,
 
134
                    'query': {'simple': False,
 
135
                              'metadata': False,
 
136
                              'complex': False}},
 
137
        'statistics': {'pagination': False,
 
138
                       'groupby': False,
 
139
                       'query': {'simple': False,
 
140
                                 'metadata': False,
 
141
                                 'complex': False},
 
142
                       'aggregation': {'standard': False,
 
143
                                       'selectable': {
 
144
                                           'max': False,
 
145
                                           'min': False,
 
146
                                           'sum': False,
 
147
                                           'avg': False,
 
148
                                           'count': False,
 
149
                                           'stddev': False,
 
150
                                           'cardinality': False}}
 
151
                       },
 
152
        'alarms': {'query': {'simple': False,
 
153
                             'complex': False},
 
154
                   'history': {'query': {'simple': False,
 
155
                                         'complex': False}}},
 
156
        'events': {'query': {'simple': False}},
 
157
    }
 
158
 
119
159
    @staticmethod
120
160
    def __init__(conf):
121
161
        """Constructor."""
207
247
        raise NotImplementedError(_('Samples not implemented'))
208
248
 
209
249
    @staticmethod
210
 
    def get_meter_statistics(sample_filter, period=None, groupby=None):
 
250
    def get_meter_statistics(sample_filter, period=None, groupby=None,
 
251
                             aggregate=None):
211
252
        """Return an iterable of model.Statistics instances.
212
253
 
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
317
358
        """
 
359
 
318
360
        raise NotImplementedError(_('Events not implemented.'))
 
361
 
 
362
    @staticmethod
 
363
    def query_samples(filter_expr=None, orderby=None, limit=None):
 
364
        """Return an iterable of model.Sample objects.
 
365
 
 
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.
 
369
        """
 
370
 
 
371
        raise NotImplementedError(_('Complex query for samples \
 
372
            is not implemented.'))
 
373
 
 
374
    @staticmethod
 
375
    def query_alarms(filter_expr=None, orderby=None, limit=None):
 
376
        """Return an iterable of model.Alarm objects.
 
377
 
 
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.
 
381
        """
 
382
 
 
383
        raise NotImplementedError(_('Complex query for alarms \
 
384
            is not implemented.'))
 
385
 
 
386
    @staticmethod
 
387
    def query_alarm_history(filter_expr=None, orderby=None, limit=None):
 
388
        """Return an iterable of model.AlarmChange objects.
 
389
 
 
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.
 
393
        """
 
394
 
 
395
        raise NotImplementedError(_('Complex query for alarms \
 
396
            history is not implemented.'))
 
397
 
 
398
    @staticmethod
 
399
    def get_capabilities():
 
400
        """Return an dictionary representing the capabilities of this driver.
 
401
        """
 
402
        raise NotImplementedError(_('Capabilities not implemented.'))