1.0.4 • Published 7 years ago

composeaddresstranslator v1.0.4

Weekly downloads
24
License
MIT
Repository
github
Last release
7 years ago

ComposeAddressTranslator

This is a simple address translator that takes the mapping information obtained from the Compose UI or API for Scylla databases and converts it into a usable address translator.

Example Code

var cassandra = require('cassandra-driver');
var compose = require('composeaddresstranslator');
var authProvider = new cassandra.auth.PlainTextAuthProvider('scylla', 'password');

addresses= {
    "SOURCE_IP_1:SOURCE_PORT_1": "EXTERNAL_NAME_1:EXTERNAL_PORT_1",
    "SOURCE_IP_2:SOURCE_PORT_2": "EXTERNAL_NAME_2:EXTERNAL_PORT_2",
    "SOURCE_IP_2:SOURCE_PORT_2": "EXTERNAL_NAME_3:EXTERNAL_PORT_3"
}

translator=new compose.ComposeAddressTranslator();

translator.setMap(addresses);

client = new cassandra.Client({
    contactPoints: translator.getContactPoints(),
    policies: {
        addressResolution: translator
    },
    authProvider: authProvider
});

Methods

setMap(): Takes a JavaScript object and converts it to an address map for the translation process. (v1.0.4 - setMap will also accept an array of objects with a key and value)

getMapContactPoints(): Returns the external names and ports as an array for initial connection to the database.

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago