nessdb 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ /ndbs/
6
+ *.so
7
+ *.dylib
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in nessdb.gemspec
4
+ gemspec
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,10 @@
1
+ require "nessdb/version"
2
+ require 'nessdb/lib'
3
+ require 'nessdb/connection'
4
+
5
+ module NessDB
6
+ def connect
7
+ NessDB::Connection.new
8
+ end
9
+ module_function :connect
10
+ end
@@ -0,0 +1,29 @@
1
+ module NessDB
2
+ class Connection
3
+ BUFFER_SIZE = 1024 * 1024 * 2
4
+ ASYNC = 0
5
+ def initialize(buffer_size = BUFFER_SIZE, async = ASYNC)
6
+ NessDB::Lib.db_init(buffer_size, async)
7
+ end
8
+
9
+ def [](key)
10
+ NessDB::Lib.db_get(key)
11
+ end
12
+
13
+ def []=(key, value)
14
+ NessDB::Lib.db_add(key.to_s, value.to_s)
15
+ end
16
+
17
+ def exists?(key)
18
+ NessDB::Lib.db_exists(key)
19
+ end
20
+
21
+ def remove(key)
22
+ NessDB::Lib.db_remove(key)
23
+ end
24
+
25
+ def close
26
+ NessDB::Lib.db_destroy
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ require 'ffi'
2
+ module NessDB
3
+ module Lib
4
+ extend FFI::Library
5
+ ffi_lib ['nessdb', 'libnessdb.so']
6
+ attach_function :db_init, [:int, :int], :void
7
+ attach_function :db_exists, [:string], :int
8
+ attach_function :db_add, [:string, :string], :int
9
+ attach_function :db_get, [:string], :string
10
+ attach_function :db_remove, [:string], :void
11
+ attach_function :db_destroy, [], :void
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Nessdb
2
+ VERSION = "0.0.1.pre"
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "nessdb/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "nessdb"
7
+ s.version = Nessdb::VERSION
8
+ s.authors = ["Douglas Campos"]
9
+ s.email = ["qmx@qmx.me"]
10
+ s.homepage = ""
11
+ s.summary = %q{NessDB Ruby wrapper}
12
+ s.description = %q{Embedded Key-Value Store}
13
+
14
+ s.rubyforge_project = "nessdb"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "ffi"
22
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nessdb
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ - pre
10
+ version: 0.0.1.pre
11
+ platform: ruby
12
+ authors:
13
+ - Douglas Campos
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-11-13 00:00:00 -02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: ffi
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ description: Embedded Key-Value Store
34
+ email:
35
+ - qmx@qmx.me
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - Rakefile
46
+ - lib/nessdb.rb
47
+ - lib/nessdb/connection.rb
48
+ - lib/nessdb/lib.rb
49
+ - lib/nessdb/version.rb
50
+ - nessdb.gemspec
51
+ has_rdoc: true
52
+ homepage: ""
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">"
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 1
73
+ - 3
74
+ - 1
75
+ version: 1.3.1
76
+ requirements: []
77
+
78
+ rubyforge_project: nessdb
79
+ rubygems_version: 1.3.6
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: NessDB Ruby wrapper
83
+ test_files: []
84
+