How to use the cryptostore.engines.StorageEngines function in cryptostore

To help you get started, we’ve selected a few cryptostore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bmoscon / cryptostore / cryptostore / aggregator / kafka.py View on Github external
def __init__(self, ip, port, flush=False):
        self.conn = {}
        self.ip = ip
        self.port = port
        self.ids = {}

        if flush:
            kafka = StorageEngines['confluent_kafka.admin']
            ac = kafka.admin.AdminClient({'bootstrap.servers': f"{ip}:{port}"})
            topics = list(ac.list_topics().topics.keys())
            for topic, status in ac.delete_topics(topics).items():
                try:
                    status.result()
                    LOG.info("Topic %s deleted", topic)
                except Exception as e:
                    LOG.warning("Failed to delete topic %s: %s", topic, e)
github bmoscon / cryptostore / cryptostore / aggregator / kafka.py View on Github external
def _conn(self, key):
        if key not in self.conn:
            self.ids[key] = None
            kafka = StorageEngines.confluent_kafka
            self.conn[key] = kafka.Consumer({'bootstrap.servers': f"{self.ip}:{self.port}",
                                             'client.id': f'cryptostore-{key}',
                                             'enable.auto.commit': False,
                                             'group.id': f'cryptofeed-{key}',
                                             'max.poll.interval.ms': 3000000})
            self.conn[key].subscribe([key])
        return self.conn[key]
github bmoscon / cryptostore / cryptostore / data / gc.py View on Github external
def _get_bucket(bucket, creds):
    google = StorageEngines['google.cloud.storage']

    if creds:
        client = google.cloud.storage.Client.from_service_account_json(creds)
    else:
        # defaults env var GOOGLE_APPLICATION_CREDENTIALS, or on box creds if on GCE
        client = google.cloud.storage.Client()
    return client.get_bucket(bucket)