Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Bucket keys to be compacted are placed on a sorted set.  The
compactor needs to atomically pop one bucket key off the set.
This can be done with a lock--entailing the use of a lock key and
various timeout mechanisms--or by evaluating a Lua script, which
is probably the best way.  Unfortunately, Lua scripts are not
supported prior to client version 2.7.0 or server version 2.6.0.
This class provides an abstraction around these two methods,
simplifying compactor().

src/t/u/turnstile-HEAD/tests/unit/test_compactor.py   turnstile(Download)
    def test_init(self):
        gbk = compactor.GetBucketKey({}, 'db')
 
        self.assertEqual(gbk.db, 'db')
        self.assertEqual(gbk.key, 'compactor')
    def test_init_altconf(self):
        gbk = compactor.GetBucketKey({
            'compactor_key': 'alt_compactor',
            'max_age': '60',
            'min_age': '5',
    def test_call(self, mock_get, mock_debug, mock_sleep, mock_time):
        db = mock.Mock()
        gbk = compactor.GetBucketKey({}, db)
 
        result = gbk()