def test_or(self):
     f1 = RiakKeyFilter("starts_with", "2005-")
     f2 = RiakKeyFilter("ends_with", "-01")
     f3 = f1 | f2
     self.assertEqual(
         list(f3),
         [["or", [["starts_with", "2005-"]], [["ends_with", "-01"]]]])
Example #2
0
 def test_multi_or(self):
     f1 = RiakKeyFilter("starts_with", "2005-")
     f2 = RiakKeyFilter("ends_with", "-01")
     f3 = RiakKeyFilter("matches", "-11-")
     f4 = f1 | f2 | f3
     self.assertEqual(list(f4), [["or",
                                  [["starts_with", "2005-"]],
                                  [["ends_with", "-01"]],
                                  [["matches", "-11-"]],
                                  ]])
 def test_simple(self):
     f1 = RiakKeyFilter("tokenize", "-", 1)
     self.assertEqual(f1._filters, [["tokenize", "-", 1]])
 def test_add(self):
     f1 = RiakKeyFilter("tokenize", "-", 1)
     f2 = RiakKeyFilter("eq", "2005")
     f3 = f1 + f2
     self.assertEqual(list(f3), [["tokenize", "-", 1], ["eq", "2005"]])
Example #5
0
    Base class for exceptions generated in the Riak API.
    """
    def __init__(self, value):
        self.value = value

    def __str__(self):
        return repr(self.value)


class ConflictError(RiakError):
    """
    Raised when an operation is attempted on a
    :class:`~riak.riak_object.RiakObject` that has more than one
    sibling.
    """
    def __init__(self, message="Object in conflict"):
        super(ConflictError, self).__init__(message)


from riak.client import RiakClient
from riak.bucket import RiakBucket, BucketType
from riak.node import RiakNode
from riak.riak_object import RiakObject
from riak.mapreduce import RiakKeyFilter, RiakMapReduce, RiakLink

ONE = "one"
ALL = "all"
QUORUM = "quorum"

key_filter = RiakKeyFilter()