--[[
Copyright (C) 2008 optivo GmbH
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--]]
--- A partition lookup service based on modulus.
--
-- This implementation just does a modulo on the partition value. If the value is anything but
-- a number then it will be converted to a string and a checksum will be calculated.
-- For each value between 0 and the modulus value a table with the suffix _[value] will be created.
-- All tables are spread across all backends. This makes it impossible to add new backend servers
-- since then the indexes start to shift.
--
-- Important note: This is just a simple demo partition lookup. You should never use it in production.
--
-- @author $Author$
-- @release $Date$ $Rev$
module("optivo.hscale.modulusPartitionLookup", package.seeall)
local _module = {}
local utils = require("optivo.common.utils")
local _tableKeyColumns
local _partitionsPerTable
--- Initialize the module using the current configuration.
-- The following configuration parameters are required:
--
tableKeyColumns a map with table => columnpartitionsPerTable the maximum number of partitions per table
--