0.1.5 • Published 11 years ago

callosum-client-tcp v0.1.5

Weekly downloads
4
License
-
Repository
github
Last release
11 years ago

callosum-client-tcp

Stability: 1 - Experimental

NPM version

TCP Client for Callosum: a self-balancing distributed services protocol.

Usage

var CallosumClient = require('callosum-client-tcp');
var callosumClient = new CallosumClient({MAX_SLOTS: 100});

callosumClient.on('error', function (error) {
    console.log(error);
});

// add a connection to the connection pool
// client will either hang on to the connection or close it if it is not needed
callosumClient.newConnection(slot, socket);

var socket = callosumClient.getConnection();
// socket is either a connection that is available or undefined

callosumClient.returnConnection(socket);
// return a previously leased connection to the client pool

Tests

npm test

Overview

TCP Client for Callosum: a self-balancing distributed services protocol. It servers as a connection pool.

Open available connections are maintained internally via two heap data structures. The min heap data structure is maintained in order to provide a connection from the pool with the lowest slot value. The max heap data structure is maintained in order to enable rapid checking and replacing of a connection with a high slot value if a new connection with a lower slot value becomes available.

Documentation

CallosumClient

Public API

new CallosumClient(options)

callosumClient.getConnection()

callosumClient.newConnection(slot, socket)

callosumClient.returnConnection(socket)

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago