Giter VIP home page Giter VIP logo

node-priam's People

Contributors

asilvas avatar dependabot[bot] avatar fritzmonkey avatar indexzero avatar jcrugzz avatar jeboothjr avatar josephjunker avatar jpage-godaddy avatar scommisso avatar trhinehart-godaddy avatar wenterline-godaddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-priam's Issues

Batch.Add accept array

Currently, if I wanted to add multiple queries to a batch I would have to call "add" multiple times. The request is for the add function to allow an array of query/batch objects to add.

Batches support

In node-cassandra-cql documentation, says:

"If you are using Cassandra 2.x and you want to enable all the latest features in the Cassandra binary protocol v2 (ie: batches), you should reference version 0.5.x:"

This driver uses batches, but using node-cassandra-cql 0.4.4. There's not something wrong?

connectionResolver overwrites keyspace from config

If your connectionResolver returns a property, it will overwrite the config property that was given when instantiating the driver. This may be intended, but it's preventing us from sharing a specific connectionResolver, because we can't override one of the properties (specifically keyspace). People may be relying on this behavior, so I'm not sure we can just switch it outright, but maybe we can add a feature to specify which direction the override occurs? I'd be happy to create a pull request, but I wanted to get some opinions before I started coding.

Emit events from priam instances

I'm encountering some timeouts while querying against a C* database. In order to diagnose what's going on, I'd like to do some additional logging and timing measurements. I think this would be much easier to do if a priam instance is an EventEmitter. In fact, I started a branch to do just that, but I wanted to run this by you in case you have any better ideas.

In looking through the code for basedriver and the node-cassandra-cql driver, here are the events I determined that we could emit:

EventDescription
connectionRequested A pooled connection has been requested. Expect a `connectionAvailable` event when this request has been fulfilled.
connectionOptionsFetched Basically mirrors the `fetch` and `lazyfetch` events from the connection resolver when they succeed.
connectionOptionsError Basically mirrors the `fetch` and `lazyfetch` events from the connection resolver when they fail. Will also emit an `error` event.
connectionResolved Emitted when the connection resolver succeeds
connectionResolvedError Emitted when the connection resolver fails. Also emits an `error` event.
connectionOpening Emitted when we start opening a connection.
connectionOpened Emitted when we finish opening a connection.
connectionAvailable Emitted when a request for a connection succeeds, whether it's after a new connection is opened or an available pooled connection is found.
connectionInfoLogged Emitted when we receive a `log` event from `node-cassandra-cql` that's at the `info` level.
connectionDebugLogged Emitted when we receive a `log` event from `node-cassandra-cql` that's at the `debug` level.
connectionWarningLogged Emitted when we receive a `log` event from `node-cassandra-cql` that's at the `warning` level.
connectionErrorLogged Emitted when we receive a `log` event from `node-cassandra-cql` that's at the `error` level.
connectionClosed Emitted when we close a connection.
queryStarted Emitted when we begin executing a query.
queryRetried Emitted when we retry a failed query.
queryCompleted Emitted when we complete a query.
queryFailed Emitted when we fail a query after all retries.

What are your thoughts about this approach? This should give consumers a lot of flexibility in how they do debugging and logging for their application.

closeConnection() method

This might be a very specific use case, but for testing small scripts (not using an express server), it might be nice to offer a closeConnection() method on the Driver so that scripts can be completed without having to ^C kill them. I was able to do this by manually calling the closePool() method, but currently the closePool method requires a "pool" argument which seems to be more for internal use (see code snippet below).

var db = require('priam')(options);

db.cql("SELECT * FROM users", [], {consistency: db.consistencyLevel.QUORUM}, function(err, users) {
    if(err) {console.log("ERROR: " + err);}
    console.log(users);
    db.closePool(db.pools.default, function() {
        console.log("Pool closed");
    });
});

Don't use `instanceof` on internal `Batch` prototype

From the discussion #45 (comment)

indexzero: Using instanceof on custom prototypes makes working with that prototype more difficult. For example I cannot write a Facade which wraps Batch because it isn't the exact same prototype. I wouldn't go as far as to say "instanceof considered harmful" (although other folks have), but I generally only use it with prototypes native to the language.

scommisso: I can sniff whether or not it is a batch a different way. I'll address this.

Feature detection instead of instanceof seems like the best way to go.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.