Browse Source

nodestore: Remove cassandra and multi backends

These are both entirely unused in production.
Matt Robenolt 5 years ago
parent
commit
bb181ec72b

+ 0 - 7
requirements-test.txt

@@ -1,10 +1,3 @@
-# cassandra
-blist
-# TODO(dcramer): figure out why Travis needs this
-cassandra-driver<=3.5.0
-casscache
-cqlsh
-# /cassandra
 datadog
 freezegun==0.3.11
 msgpack-python<0.5.0

+ 0 - 10
src/sentry/nodestore/cassandra/__init__.py

@@ -1,10 +0,0 @@
-"""
-sentry.nodestore.cassandra
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
-:license: BSD, see LICENSE for more details.
-"""
-from __future__ import absolute_import, print_function
-
-from .backend import *  # NOQA

+ 0 - 54
src/sentry/nodestore/cassandra/backend.py

@@ -1,54 +0,0 @@
-"""
-sentry.nodestore.cassandra.backend
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
-:license: BSD, see LICENSE for more details.
-"""
-
-from __future__ import absolute_import, print_function
-
-import casscache
-
-from sentry.nodestore.base import NodeStorage
-from sentry.utils.cache import memoize
-
-
-class CassandraNodeStorage(NodeStorage):
-    """
-    A Cassandra-based backend for storing node data.
-
-    >>> CassandraNodeStorage(
-    ...     servers=['127.0.0.1:9042'],
-    ...     keyspace='sentry',
-    ...     columnfamily='nodestore',
-    ... )
-    """
-
-    def __init__(self, servers, keyspace='sentry', columnfamily='nodestore', **kwargs):
-        self.servers = servers
-        self.keyspace = keyspace
-        self.columnfamily = columnfamily
-        self.options = kwargs
-        super(CassandraNodeStorage, self).__init__()
-
-    @memoize
-    def connection(self):
-        return casscache.Client(
-            servers=self.servers,
-            keyspace=self.keyspace,
-            columnfamily=self.columnfamily,
-            **self.options
-        )
-
-    def delete(self, id):
-        self.connection.delete(id)
-
-    def get(self, id):
-        return self.connection.get(id)
-
-    def get_multi(self, id_list):
-        return self.connection.get_multi(id_list)
-
-    def set(self, id, data, ttl=None):
-        self.connection.set(id, data)

+ 0 - 10
src/sentry/nodestore/multi/__init__.py

@@ -1,10 +0,0 @@
-"""
-sentry.nodestore.multi
-~~~~~~~~~~~~~~~~~~~~~~
-
-:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
-:license: BSD, see LICENSE for more details.
-"""
-from __future__ import absolute_import
-
-from .backend import *  # NOQA

+ 0 - 95
src/sentry/nodestore/multi/backend.py

@@ -1,95 +0,0 @@
-"""
-sentry.nodestore.multi.backend
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
-:license: BSD, see LICENSE for more details.
-"""
-
-from __future__ import absolute_import
-
-import random
-
-import six
-
-from sentry.nodestore.base import NodeStorage
-from sentry.utils.imports import import_string
-
-
-class MultiNodeStorage(NodeStorage):
-    """
-    A backend which will write to multiple backends, and read from a random
-    choice.
-
-    This is not intended for consistency, but is instead designed to allow you
-    to dual-write for purposes of migrations.
-
-    >>> MultiNodeStorage(backends=[
-    >>>     ('sentry.nodestore.django.backend.DjangoNodeStorage', {}),
-    >>>     ('sentry.nodestore.riak.backend.RiakNodeStorage', {}),
-    >>> ], read_selector=lambda backends: backends[0])
-    """
-
-    def __init__(self, backends, read_selector=random.choice, **kwargs):
-        assert backends, "you should provide at least one backend"
-
-        self.backends = []
-        for backend, backend_options in backends:
-            if isinstance(backend, six.string_types):
-                backend = import_string(backend)
-            self.backends.append(backend(**backend_options))
-        self.read_selector = read_selector
-        super(MultiNodeStorage, self).__init__(**kwargs)
-
-    def get(self, id):
-        # just fetch it from a random backend, we're not aiming for consistency
-        backend = self.read_selector(self.backends)
-        return backend.get(id)
-
-    def get_multi(self, id_list):
-        backend = self.read_selector(self.backends)
-        return backend.get_multi(id_list=id_list)
-
-    def set(self, id, data, ttl=None):
-        should_raise = False
-        for backend in self.backends:
-            try:
-                backend.set(id, data, ttl=ttl)
-            except Exception:
-                should_raise = True
-
-        if should_raise:
-            raise
-
-    def set_multi(self, values):
-        should_raise = False
-        for backend in self.backends:
-            try:
-                backend.set_multi(values)
-            except Exception:
-                should_raise = True
-
-        if should_raise:
-            raise
-
-    def delete(self, id):
-        should_raise = False
-        for backend in self.backends:
-            try:
-                backend.delete(id)
-            except Exception:
-                should_raise = True
-
-        if should_raise:
-            raise
-
-    def cleanup(self, cutoff_timestamp):
-        should_raise = False
-        for backend in self.backends:
-            try:
-                backend.cleanup(cutoff_timestamp)
-            except Exception:
-                should_raise = True
-
-        if should_raise:
-            raise

+ 0 - 1
tests/sentry/nodestore/cassandra/__init__.py

@@ -1 +0,0 @@
-from __future__ import absolute_import

+ 0 - 1
tests/sentry/nodestore/cassandra/backend/__init__.py

@@ -1 +0,0 @@
-from __future__ import absolute_import

+ 0 - 41
tests/sentry/nodestore/cassandra/backend/tests.py

@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from __future__ import absolute_import
-
-from sentry.nodestore.cassandra.backend import CassandraNodeStorage
-from sentry.testutils import TestCase, requires_cassandra
-
-
-@requires_cassandra
-class CassandraNodeStorageTest(TestCase):
-    def setUp(self):
-        self.ns = CassandraNodeStorage(servers=[
-            '127.0.0.1:9042',
-        ])
-
-    def test_integration(self):
-        node_id = self.ns.create({
-            'foo': 'bar',
-        })
-        assert node_id is not None
-
-        self.ns.set(node_id, {
-            'foo': 'baz',
-        })
-
-        result = self.ns.get(node_id)
-        assert result == {
-            'foo': 'baz',
-        }
-
-        node_id2 = self.ns.create({
-            'foo': 'bar',
-        })
-
-        result = self.ns.get_multi([node_id, node_id2])
-        assert result[node_id] == {
-            'foo': 'baz',
-        }
-        assert result[node_id2] == {
-            'foo': 'bar',
-        }

+ 0 - 1
tests/sentry/nodestore/multi/__init__.py

@@ -1 +0,0 @@
-from __future__ import absolute_import

+ 0 - 1
tests/sentry/nodestore/multi/backend/__init__.py

@@ -1 +0,0 @@
-from __future__ import absolute_import

Some files were not shown because too many files changed in this diff