Sha256: 66f235abd9acf965a78f27963baea8f23e2ea36ebcf8a2652b50de4ba2c57d79
Contents?: true
Size: 312 Bytes
Versions: 6
Compression:
Stored size: 312 Bytes
Contents
# -*- coding: utf-8 -*- module ActiveRecord::Turntable::Algorithm class ModuloAlgorithm < Base def choose(shard_maps, key) shard_maps[key % shard_maps.size].shard rescue raise ActiveRecord::Turntable::CannotSpecifyShardError, "cannot specify shard for key:#{key.inspect}" end end end
Version data entries
6 entries across 6 versions & 1 rubygems