Browse Source

cleaned up directory, added kafka and zookeeper module dependencies. starting fresh

master
Brett Langdon 14 years ago
parent
commit
396f2e0b9a
9 changed files with 3 additions and 166 deletions
  1. +0
    -3
      README.md
  2. +1
    -1
      lib/index.js
  3. +2
    -0
      package.json
  4. +0
    -39
      src/consumer.cc
  5. +0
    -20
      src/consumer.h
  6. +0
    -29
      src/franz.cc
  7. +0
    -39
      src/producer.cc
  8. +0
    -20
      src/producer.h
  9. +0
    -15
      wscript

+ 0
- 3
README.md View File

@ -3,6 +3,3 @@ franz
Franz is a Kafka Client for Node.JS that includes support for Zookeeper
## TODO ##
I intend to write this module in C++ so I can incorporate the already available Kafka and Zookeeper libraries available.

+ 1
- 1
lib/index.js View File

@ -1 +1 @@
module.exports = require('../build/Release/franz');
module.exports = {}

+ 2
- 0
package.json View File

@ -13,6 +13,8 @@
, "url": "github.com/brettlangdon/franz.git"
}
, "dependencies": {
"kafka": ">=0.2.1"
, "zookeeper":">=3.4.1-3"
}
, "main": "./lib/index.js"
, "engines": { "node": ">= 0.6.0" }


+ 0
- 39
src/consumer.cc View File

@ -1,39 +0,0 @@
#define BUILDING_NODE_EXTENSION
#include <node.h>
#include "consumer.h"
using namespace v8;
Consumer::Consumer() {};
Consumer::~Consumer() {};
Persistent<Function> Consumer::constructor;
void Consumer::Init() {
// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("Consumer"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
constructor = Persistent<Function>::New(tpl->GetFunction());
}
Handle<Value> Consumer::New(const Arguments& args) {
HandleScope scope;
Consumer* obj = new Consumer();
obj->Wrap(args.This());
return args.This();
}
Handle<Value> Consumer::NewInstance(const Arguments& args) {
HandleScope scope;
const unsigned argc = 0;
Handle<Value> argv[argc] = {};
Local<Object> instance = constructor->NewInstance(argc, argv);
return scope.Close(instance);
}

+ 0
- 20
src/consumer.h View File

@ -1,20 +0,0 @@
#define BUILDING_NODE_EXTENSION
#ifndef CONSUMER_H
#define CONSUMER_H
#include <node.h>
class Consumer : public node::ObjectWrap {
public:
static void Init();
static v8::Handle<v8::Value> NewInstance(const v8::Arguments& args);
private:
Consumer();
~Consumer();
static v8::Persistent<v8::Function> constructor;
static v8::Handle<v8::Value> New(const v8::Arguments& args);
};
#endif

+ 0
- 29
src/franz.cc View File

@ -1,29 +0,0 @@
#define BUILDING_NODE_EXTENSION
#include <node.h>
#include "producer.h"
#include "consumer.h"
using namespace v8;
Handle<Value> CreateProducer(const Arguments& args) {
HandleScope scope;
return scope.Close(Producer::NewInstance(args));
}
Handle<Value> CreateConsumer(const Arguments& args) {
HandleScope scope;
return scope.Close(Consumer::NewInstance(args));
}
void InitAll(Handle<Object> target) {
Producer::Init();
Consumer::Init();
target->Set(String::NewSymbol("createProducer"),
FunctionTemplate::New(CreateProducer)->GetFunction());
target->Set(String::NewSymbol("createConsumer"),
FunctionTemplate::New(CreateConsumer)->GetFunction());
}
NODE_MODULE(franz, InitAll)

+ 0
- 39
src/producer.cc View File

@ -1,39 +0,0 @@
#define BUILDING_NODE_EXTENSION
#include <node.h>
#include "producer.h"
using namespace v8;
Producer::Producer() {};
Producer::~Producer() {};
Persistent<Function> Producer::constructor;
void Producer::Init() {
// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("Producer"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
constructor = Persistent<Function>::New(tpl->GetFunction());
}
Handle<Value> Producer::New(const Arguments& args) {
HandleScope scope;
Producer* obj = new Producer();
obj->Wrap(args.This());
return args.This();
}
Handle<Value> Producer::NewInstance(const Arguments& args) {
HandleScope scope;
const unsigned argc = 0;
Handle<Value> argv[argc] = {};
Local<Object> instance = constructor->NewInstance(argc, argv);
return scope.Close(instance);
}

+ 0
- 20
src/producer.h View File

@ -1,20 +0,0 @@
#define BUILDING_NODE_EXTENSION
#ifndef PRODUCER_H
#define PRODUCER_H
#include <node.h>
class Producer : public node::ObjectWrap {
public:
static void Init();
static v8::Handle<v8::Value> NewInstance(const v8::Arguments& args);
private:
Producer();
~Producer();
static v8::Persistent<v8::Function> constructor;
static v8::Handle<v8::Value> New(const v8::Arguments& args);
};
#endif

+ 0
- 15
wscript View File

@ -1,15 +0,0 @@
srcdir = '.'
blddir = 'build'
VERSION = '0.0.1'
def set_options(opt):
opt.tool_options('compiler_cxx')
def configure(conf):
conf.check_tool('compiler_cxx')
conf.check_tool('node_addon')
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
obj.target = 'franz'
obj.source = ['src/consumer.cc','src/producer.cc','src/franz.cc']

Loading…
Cancel
Save