strokedb 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CONTRIBUTORS +7 -0
- data/CREDITS +13 -0
- data/README +44 -0
- data/bin/sdbc +2 -0
- data/lib/config/config.rb +161 -0
- data/lib/data_structures/inverted_list.rb +297 -0
- data/lib/data_structures/point_query.rb +24 -0
- data/lib/data_structures/skiplist.rb +302 -0
- data/lib/document/associations.rb +107 -0
- data/lib/document/callback.rb +11 -0
- data/lib/document/coercions.rb +57 -0
- data/lib/document/delete.rb +28 -0
- data/lib/document/document.rb +684 -0
- data/lib/document/meta.rb +261 -0
- data/lib/document/slot.rb +199 -0
- data/lib/document/util.rb +27 -0
- data/lib/document/validations.rb +704 -0
- data/lib/document/versions.rb +106 -0
- data/lib/document/virtualize.rb +82 -0
- data/lib/init.rb +57 -0
- data/lib/stores/chainable_storage.rb +57 -0
- data/lib/stores/inverted_list_index/inverted_list_file_storage.rb +56 -0
- data/lib/stores/inverted_list_index/inverted_list_index.rb +49 -0
- data/lib/stores/remote_store.rb +172 -0
- data/lib/stores/skiplist_store/chunk.rb +119 -0
- data/lib/stores/skiplist_store/chunk_storage.rb +21 -0
- data/lib/stores/skiplist_store/file_chunk_storage.rb +44 -0
- data/lib/stores/skiplist_store/memory_chunk_storage.rb +37 -0
- data/lib/stores/skiplist_store/skiplist_store.rb +217 -0
- data/lib/stores/store.rb +5 -0
- data/lib/sync/chain_sync.rb +38 -0
- data/lib/sync/diff.rb +126 -0
- data/lib/sync/lamport_timestamp.rb +81 -0
- data/lib/sync/store_sync.rb +79 -0
- data/lib/sync/stroke_diff/array.rb +102 -0
- data/lib/sync/stroke_diff/default.rb +21 -0
- data/lib/sync/stroke_diff/hash.rb +186 -0
- data/lib/sync/stroke_diff/string.rb +116 -0
- data/lib/sync/stroke_diff/stroke_diff.rb +9 -0
- data/lib/util/blankslate.rb +42 -0
- data/lib/util/ext/blank.rb +50 -0
- data/lib/util/ext/enumerable.rb +36 -0
- data/lib/util/ext/fixnum.rb +16 -0
- data/lib/util/ext/hash.rb +22 -0
- data/lib/util/ext/object.rb +8 -0
- data/lib/util/ext/string.rb +35 -0
- data/lib/util/inflect.rb +217 -0
- data/lib/util/java_util.rb +9 -0
- data/lib/util/lazy_array.rb +54 -0
- data/lib/util/lazy_mapping_array.rb +64 -0
- data/lib/util/lazy_mapping_hash.rb +46 -0
- data/lib/util/serialization.rb +29 -0
- data/lib/util/trigger_partition.rb +136 -0
- data/lib/util/util.rb +38 -0
- data/lib/util/xml.rb +6 -0
- data/lib/view/view.rb +55 -0
- data/script/console +70 -0
- data/strokedb.rb +75 -0
- metadata +148 -0
data/script/console
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
|
+
|
5
|
+
require 'irb'
|
6
|
+
require 'pp'
|
7
|
+
require "strokedb"
|
8
|
+
include StrokeDB
|
9
|
+
|
10
|
+
Doc = Document
|
11
|
+
|
12
|
+
def save!
|
13
|
+
StrokeDB.default_store.chunk_storage.sync_chained_storages!
|
14
|
+
true
|
15
|
+
"Database has been saved."
|
16
|
+
end
|
17
|
+
|
18
|
+
def build_config
|
19
|
+
StrokeDB::Config.build :default => true, :base_path => '.console.strokedb'
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def clear!
|
24
|
+
FileUtils.rm_rf '.console.strokedb'
|
25
|
+
build_config
|
26
|
+
"Database has been wiped out."
|
27
|
+
end
|
28
|
+
|
29
|
+
def find(*args)
|
30
|
+
StrokeDB.default_store.find(*args)
|
31
|
+
end
|
32
|
+
|
33
|
+
def store
|
34
|
+
StrokeDB.default_store
|
35
|
+
end
|
36
|
+
|
37
|
+
def h(*args)
|
38
|
+
puts %{
|
39
|
+
Commands:
|
40
|
+
|
41
|
+
clear! -- Clear the database (will erase all data in console's store)
|
42
|
+
save! -- Save database (if you will quit without it, your changes will not be recorded)
|
43
|
+
find <uuid> -- Find document by UUID (example: find "a4430ff1-6cb4-4428-a292-7ab8b77de467")
|
44
|
+
|
45
|
+
Aliases:
|
46
|
+
|
47
|
+
Doc -- StrokeDB::Document
|
48
|
+
store -- current store
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def reload!
|
53
|
+
silence_warnings do
|
54
|
+
load "strokedb.rb"
|
55
|
+
end
|
56
|
+
"Classes reloaded."
|
57
|
+
end
|
58
|
+
|
59
|
+
if ARGV.last.is_a?(String) && File.exists?(ARGV.last+'/config')
|
60
|
+
StrokeDB::Config.load(ARGV.last+'/config',true)
|
61
|
+
puts "# loading #{ARGV.last}"
|
62
|
+
ARGV.pop
|
63
|
+
else
|
64
|
+
build_config
|
65
|
+
end
|
66
|
+
|
67
|
+
puts "StrokeDB #{StrokeDB::VERSION} Console"
|
68
|
+
puts "Type 'h' for help"
|
69
|
+
|
70
|
+
IRB.start
|
data/strokedb.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
ruby_debug_path = File.dirname(__FILE__) + '/../dependencies/ruby-debug-0.10.0/cli/'
|
2
|
+
|
3
|
+
if ENV["DEBUGGER"]
|
4
|
+
if File.exist?(ruby_debug_path)
|
5
|
+
$:.unshift( ruby_debug_path )
|
6
|
+
else
|
7
|
+
puts "Using ruby-debug gem"
|
8
|
+
require 'rubygems'
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'ruby-debug'
|
12
|
+
ENV["DEBUG"] = 1
|
13
|
+
else
|
14
|
+
module Kernel
|
15
|
+
def debugger; end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rubygems'
|
20
|
+
begin
|
21
|
+
require 'json'
|
22
|
+
rescue LoadError
|
23
|
+
begin
|
24
|
+
require 'json_pure'
|
25
|
+
rescue LoadError
|
26
|
+
raise LoadError, 'Could not find json or json_pure'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'set'
|
31
|
+
require 'fileutils'
|
32
|
+
require 'drb'
|
33
|
+
require 'drb/acl'
|
34
|
+
require 'drb/unix'
|
35
|
+
|
36
|
+
class SmartassLoader
|
37
|
+
def initialize(pattern)
|
38
|
+
@pattern = pattern
|
39
|
+
@req_paths = {}
|
40
|
+
end
|
41
|
+
|
42
|
+
def require!
|
43
|
+
paths = Dir[File.dirname(__FILE__) + "/" + @pattern].select do |p|
|
44
|
+
(p !~ /\/java_/ || RUBY_PLATFORM =~ /java/) && p =~ /\.rb$/
|
45
|
+
end.sort.map do |p|
|
46
|
+
File.expand_path(p)
|
47
|
+
end
|
48
|
+
require_rest_paths(paths)
|
49
|
+
end
|
50
|
+
|
51
|
+
def require_rest_paths(paths, i = 0)
|
52
|
+
ENV['DEBUG'] = "1" if i == 10
|
53
|
+
ENV.delete('DEBUG') if i == 20
|
54
|
+
broken_paths = []
|
55
|
+
paths.each do |p|
|
56
|
+
begin
|
57
|
+
if @req_paths[p]
|
58
|
+
load p
|
59
|
+
puts "Resolved: #{p}" if ENV["DEBUG"]
|
60
|
+
else
|
61
|
+
@req_paths[p] = 1
|
62
|
+
require p
|
63
|
+
end
|
64
|
+
rescue NameError => e
|
65
|
+
puts "Not resolved: #{p}" if ENV["DEBUG"]
|
66
|
+
puts e if ENV["DEBUG"]
|
67
|
+
broken_paths.push p
|
68
|
+
end
|
69
|
+
end
|
70
|
+
# Stack grows...
|
71
|
+
require_rest_paths(broken_paths, i + 1) unless broken_paths.empty?
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
SmartassLoader.new("lib/**/*").require!
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: strokedb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yurii Rashkovskii, Oleg Andreev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-04-13 00:00:00 +03:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: diff-lcs
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.1.2
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: uuidtools
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.0.3
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: json
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.2
|
41
|
+
version:
|
42
|
+
description: StrokeDB is an embeddable distributed document database written in Ruby. It is schema-free, it scales infinitely, it even tracks revisions and perfectly integrates with Ruby applications.
|
43
|
+
email: strokedb@googlegroups.com
|
44
|
+
executables:
|
45
|
+
- sdbc
|
46
|
+
extensions: []
|
47
|
+
|
48
|
+
extra_rdoc_files: []
|
49
|
+
|
50
|
+
files:
|
51
|
+
- bin/sdbc
|
52
|
+
- README
|
53
|
+
- CONTRIBUTORS
|
54
|
+
- CREDITS
|
55
|
+
- script/console
|
56
|
+
- lib/config
|
57
|
+
- lib/config/config.rb
|
58
|
+
- lib/data_structures
|
59
|
+
- lib/data_structures/inverted_list.rb
|
60
|
+
- lib/data_structures/point_query.rb
|
61
|
+
- lib/data_structures/skiplist.rb
|
62
|
+
- lib/document
|
63
|
+
- lib/document/associations.rb
|
64
|
+
- lib/document/callback.rb
|
65
|
+
- lib/document/coercions.rb
|
66
|
+
- lib/document/delete.rb
|
67
|
+
- lib/document/document.rb
|
68
|
+
- lib/document/meta.rb
|
69
|
+
- lib/document/slot.rb
|
70
|
+
- lib/document/util.rb
|
71
|
+
- lib/document/validations.rb
|
72
|
+
- lib/document/versions.rb
|
73
|
+
- lib/document/virtualize.rb
|
74
|
+
- lib/init.rb
|
75
|
+
- lib/stores
|
76
|
+
- lib/stores/chainable_storage.rb
|
77
|
+
- lib/stores/inverted_list_index
|
78
|
+
- lib/stores/inverted_list_index/inverted_list_file_storage.rb
|
79
|
+
- lib/stores/inverted_list_index/inverted_list_index.rb
|
80
|
+
- lib/stores/remote_store.rb
|
81
|
+
- lib/stores/skiplist_store
|
82
|
+
- lib/stores/skiplist_store/chunk.rb
|
83
|
+
- lib/stores/skiplist_store/chunk_storage.rb
|
84
|
+
- lib/stores/skiplist_store/file_chunk_storage.rb
|
85
|
+
- lib/stores/skiplist_store/memory_chunk_storage.rb
|
86
|
+
- lib/stores/skiplist_store/skiplist_store.rb
|
87
|
+
- lib/stores/store.rb
|
88
|
+
- lib/sync
|
89
|
+
- lib/sync/chain_sync.rb
|
90
|
+
- lib/sync/diff.rb
|
91
|
+
- lib/sync/lamport_timestamp.rb
|
92
|
+
- lib/sync/store_sync.rb
|
93
|
+
- lib/sync/stroke_diff
|
94
|
+
- lib/sync/stroke_diff/array.rb
|
95
|
+
- lib/sync/stroke_diff/default.rb
|
96
|
+
- lib/sync/stroke_diff/hash.rb
|
97
|
+
- lib/sync/stroke_diff/string.rb
|
98
|
+
- lib/sync/stroke_diff/stroke_diff.rb
|
99
|
+
- lib/util
|
100
|
+
- lib/util/blankslate.rb
|
101
|
+
- lib/util/ext
|
102
|
+
- lib/util/ext/blank.rb
|
103
|
+
- lib/util/ext/enumerable.rb
|
104
|
+
- lib/util/ext/fixnum.rb
|
105
|
+
- lib/util/ext/hash.rb
|
106
|
+
- lib/util/ext/object.rb
|
107
|
+
- lib/util/ext/string.rb
|
108
|
+
- lib/util/inflect.rb
|
109
|
+
- lib/util/java_util.rb
|
110
|
+
- lib/util/lazy_array.rb
|
111
|
+
- lib/util/lazy_mapping_array.rb
|
112
|
+
- lib/util/lazy_mapping_hash.rb
|
113
|
+
- lib/util/serialization.rb
|
114
|
+
- lib/util/trigger_partition.rb
|
115
|
+
- lib/util/util.rb
|
116
|
+
- lib/util/xml.rb
|
117
|
+
- lib/view
|
118
|
+
- lib/view/view.rb
|
119
|
+
- strokedb.rb
|
120
|
+
has_rdoc: true
|
121
|
+
homepage: http://strokedb.com
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
|
125
|
+
require_paths:
|
126
|
+
- .
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: "0"
|
133
|
+
version:
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: "0"
|
139
|
+
version:
|
140
|
+
requirements: []
|
141
|
+
|
142
|
+
rubyforge_project: strokedb
|
143
|
+
rubygems_version: 1.0.1
|
144
|
+
signing_key:
|
145
|
+
specification_version: 2
|
146
|
+
summary: an embeddable distributed document database written in Ruby
|
147
|
+
test_files: []
|
148
|
+
|