Example #1
0
  def __init__(self, cluster, name, replication_factor, read_size):
    self.cluster = cluster
    self.name = name
    self.replication_factor = replication_factor
    self.read_size = read_size
    self.session = None

    # Create session.
    self.create_session()

    # Cache for Stream instances.
    self.stream_cache = InMemoryLRUCache(max_items=1000)
Example #2
0
  def __init__(self, namespace, stream, width, shards, read_size):
    self.session = namespace.session
    self.read_size = read_size
    self.stream = stream
    self.shards = shards
    self.width = width
    self.namespace = namespace

    # Index cache is a write cache: it prevents us from writing to the
    # bucket index if we've already updated it in a previous
    # operation.
    self.index_cache = InMemoryLRUCache(max_items=1000)
Example #3
0
    def __init__(self, storage):
        self.es = storage.es
        self.index_prefix = storage.index_prefix
        self.rollover_size = storage.rollover_size
        self.rollover_check_period_seconds = storage.rollover_check_period_seconds
        self.namespaces = storage.namespaces
        self.namespace_to_metadata = {}

        # Alias cache is a write cache. It prevents us creating an alias for an
        # index if we've already created it in a previous operation.
        self.alias_cache = defaultdict(
            lambda: InMemoryLRUCache(max_items=1000))

        self.update()

        self.rollover_worker = gevent.spawn(self.update_periodic)
        atexit.register(self.kill_rollover_worker)