# Path: hystrix/rolling_number.py
# class BucketCircular(deque):
#     ''' This is a circular array acting as a FIFO queue. '''
# 
#     def __init__(self, size):
#         super(BucketCircular, self).__init__(maxlen=size)
# 
#     @property
#     def size(self):
#         return len(self)
# 
#     def last(self):
#         return self.peek_last()
# 
#     def peek_last(self):
#         try:
#             return self[0]
#         except IndexError:
#             return None
# 
#     def add_last(self, bucket):
#         self.appendleft(bucket)


from multiprocessing import RLock, Array
from hystrix.rolling_number import BucketCircular
import itertools
import logging
import time
import math
from __future__ import absolute_import



log = logging.getLogger(__name__)


class RollingPercentile(object):

    def __init__(self, _time, milliseconds, bucket_numbers,
                 bucket_data_length, enabled):
        self.time = _time
        self.milliseconds = milliseconds

# Path: hystrix/rolling_number.py
# class BucketCircular(deque):
#     ''' This is a circular array acting as a FIFO queue. '''
# 
#     def __init__(self, size):
#         super(BucketCircular, self).__init__(maxlen=size)
# 
#     @property
#     def size(self):
#         return len(self)
# 
#     def last(self):
#         return self.peek_last()
# 
#     def peek_last(self):
#         try:
#             return self[0]
#         except IndexError:
#             return None
# 
#     def add_last(self, bucket):
#         self.appendleft(bucket)


# Path: hystrix/rolling_percentile.py
from multiprocessing import RLock, Array
from hystrix.rolling_number import BucketCircular
import itertools
import logging
import time
import math

from __future__ import absolute_import



log = logging.getLogger(__name__)


class RollingPercentile(object):

    def __init__(self, _time, milliseconds, bucket_numbers,
                 bucket_data_length, enabled):
        self.time = _time
        self.milliseconds = milliseconds

        self.buckets = BucketCircular(bucket_numbers)