Server slot management for Callosum: a self-balancing distributed services protocol
npm install callosum-server-slots_Stability: 1 - Experimental_

Server slot management for Callosum: a self-balancing distributed services protocol.
``javascript
var CallosumServerSlots = require('callosum-server-slots');
var callosumServerSlots = new CallosumServerSlots();
callosumServerSlots.on('error', function (error) {
console.log(error);
});
var slot = callosumServerSlots.get();
// after the slot is no longer used
callosumServerSlots.put(slot);
`
npm test
Server slot management for Callosum: a self-balancing distributed services protocol.
The slot manganger will always return the lowest available slot. For example, the following sequence of commands and their results is guaranteed:
`javascript
var assert = require('assert');
var CallosumServerSlots = require('callosum-server-slots');
var callosumServerSlots = new CallosumServerSlots();
callosumServerSlots.on('error', function (error) {
console.log(error);
});
var slotA = callosumServerSlots.get();
assert.ok(slotA == 0);
var slotB = callosumServerSlots.get();
assert.ok(slotB == 1);
var slotC = callosumServerSlots.get();
assert.ok(slotC == 2);
callosumServerSlots.put(slotA);
var slotD = callosumServerSlots.get();
assert.ok(slotD == 0);
var slotE = callosumServerSlots.get();
assert.ok(slotE == 3);
`Documentation
Public API
* new CallosumServerSlots()
* callosumServerSlots.get()
* callosumServerSlots.put(slot)
* Event 'error'
Creates a new CallosumServerSlots instance.
* Return: _Integer_ Next lowest available slot.
* slot: _Integer_ Slot number previously gotten from this instance.
Puts back the slot so that it is available for retrieval again.
* function (error) {}error`: _Object_ An error that occurred.
*
Emitted when CallosumServerSlots encounters an error. If no handler is registered, an exception will be thrown.