def compactor(conf):
<EOL>db = conf.get_database('<STR_LIT>')<EOL>limit_map = LimitContainer(conf, db)<EOL>config = conf['<STR_LIT>']<EOL>if get_int(config, '<STR_LIT>', <NUM_LIT:0>) <= <NUM_LIT:0>:<EOL><INDENT>LOG.warning("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>key_getter = GetBucketKey.factory(config, db)<EOL>LOG.info("<STR_LIT>")<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>buck_key = limits.BucketKey.decode(key_getter())<EOL><DEDENT>except ValueError as exc:<EOL><INDENT>LOG.warning("<STR_LIT>" % exc)<EOL>continue<EOL><DEDENT>if buck_key.version < <NUM_LIT:2>:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>limit = limit_map[buck_key.uuid]<EOL><DEDENT>except KeyError:<EOL><INDENT>LOG.warning("<STR_LIT>" %<EOL>buck_key.uuid)<EOL>continue<EOL><DEDENT>LOG.debug("<STR_LIT>" % buck_key)<EOL>try:<EOL><INDENT>compact_bucket(db, buck_key, limit)<EOL><DEDENT>except Exception:<EOL><INDENT>LOG.exception("<STR_LIT>" % buck_key)<EOL><DEDENT>else:<EOL><INDENT>LOG.debug("<STR_LIT>" % buck_key)<EOL><DEDENT><DEDENT>
The compactor daemon.  This fuction watches the sorted set
containing bucket keys that need to be compacted, performing the
necessary compaction.

:param conf: A turnstile.config.Config instance containing the
             configuration for the compactor daemon.  Note that a
             ControlDaemon is also started, so appropriate
             configuration for that must also be present, as must
             appropriate Redis connection information.