sophia-ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.gitmodules +3 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +22 -0
- data/ext/extconf.rb +13 -0
- data/ext/sophia.c +220 -0
- data/lib/sophia-ruby.rb +1 -0
- data/lib/sophia/version.rb +3 -0
- data/sophia-ruby.gemspec +47 -0
- data/test/test_sophia.rb +33 -0
- data/vendor/sophia/.gitignore +18 -0
- data/vendor/sophia/COPYRIGHT +29 -0
- data/vendor/sophia/README +5 -0
- data/vendor/sophia/db/a.h +58 -0
- data/vendor/sophia/db/cat.c +195 -0
- data/vendor/sophia/db/cat.h +32 -0
- data/vendor/sophia/db/core.h +129 -0
- data/vendor/sophia/db/crc.c +343 -0
- data/vendor/sophia/db/crc.h +14 -0
- data/vendor/sophia/db/cursor.c +551 -0
- data/vendor/sophia/db/cursor.h +47 -0
- data/vendor/sophia/db/e.c +49 -0
- data/vendor/sophia/db/e.h +49 -0
- data/vendor/sophia/db/file.c +355 -0
- data/vendor/sophia/db/file.h +106 -0
- data/vendor/sophia/db/gc.c +71 -0
- data/vendor/sophia/db/gc.h +14 -0
- data/vendor/sophia/db/i.c +368 -0
- data/vendor/sophia/db/i.h +155 -0
- data/vendor/sophia/db/list.h +91 -0
- data/vendor/sophia/db/lock.h +77 -0
- data/vendor/sophia/db/macro.h +20 -0
- data/vendor/sophia/db/makefile +44 -0
- data/vendor/sophia/db/merge.c +662 -0
- data/vendor/sophia/db/merge.h +14 -0
- data/vendor/sophia/db/meta.h +87 -0
- data/vendor/sophia/db/recover.c +433 -0
- data/vendor/sophia/db/recover.h +14 -0
- data/vendor/sophia/db/ref.h +111 -0
- data/vendor/sophia/db/rep.c +128 -0
- data/vendor/sophia/db/rep.h +120 -0
- data/vendor/sophia/db/sophia.h +84 -0
- data/vendor/sophia/db/sp.c +626 -0
- data/vendor/sophia/db/sp.h +50 -0
- data/vendor/sophia/db/task.h +70 -0
- data/vendor/sophia/db/track.h +99 -0
- data/vendor/sophia/db/util.c +105 -0
- data/vendor/sophia/db/util.h +25 -0
- data/vendor/sophia/makefile +7 -0
- data/vendor/sophia/sophia.gyp +30 -0
- data/vendor/sophia/test/common.c +870 -0
- data/vendor/sophia/test/crash.c +492 -0
- data/vendor/sophia/test/i.c +403 -0
- data/vendor/sophia/test/limit.c +65 -0
- data/vendor/sophia/test/makefile +30 -0
- data/vendor/sophia/test/merge.c +890 -0
- data/vendor/sophia/test/recover.c +1550 -0
- data/vendor/sophia/test/test.h +66 -0
- metadata +134 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
#ifndef SP_TEST_H_
|
2
|
+
#define SP_TEST_H_
|
3
|
+
|
4
|
+
/*
|
5
|
+
* sophia database
|
6
|
+
* sphia.org
|
7
|
+
*
|
8
|
+
* Copyright (c) Dmitry Simonenko
|
9
|
+
* BSD License
|
10
|
+
*/
|
11
|
+
|
12
|
+
#include <stdlib.h>
|
13
|
+
#include <stdio.h>
|
14
|
+
#include <stdint.h>
|
15
|
+
#include <inttypes.h>
|
16
|
+
#include <unistd.h>
|
17
|
+
#include <sys/types.h>
|
18
|
+
#include <sys/stat.h>
|
19
|
+
#include <fcntl.h>
|
20
|
+
#include <dirent.h>
|
21
|
+
|
22
|
+
#define t(expr) ({ \
|
23
|
+
if (! (expr)) { \
|
24
|
+
printf("fail (%s:%d) %s\n", __FILE__, __LINE__, #expr); \
|
25
|
+
fflush(NULL); \
|
26
|
+
abort(); \
|
27
|
+
} \
|
28
|
+
})
|
29
|
+
|
30
|
+
#define test(f) ({ \
|
31
|
+
printf("%s: ", #f); \
|
32
|
+
fflush(NULL); \
|
33
|
+
f(); \
|
34
|
+
printf("ok\n"); \
|
35
|
+
fflush(NULL); \
|
36
|
+
})
|
37
|
+
|
38
|
+
static inline int
|
39
|
+
exists(char *path, uint32_t epoch, char *ext) {
|
40
|
+
char file[1024];
|
41
|
+
snprintf(file, sizeof(file), "%s/%"PRIu32".%s", path, epoch, ext);
|
42
|
+
struct stat st;
|
43
|
+
return lstat(file, &st) == 0;
|
44
|
+
}
|
45
|
+
|
46
|
+
static inline int rmrf(char *path) {
|
47
|
+
DIR *d = opendir(path);
|
48
|
+
if (d == NULL)
|
49
|
+
return -1;
|
50
|
+
char file[1024];
|
51
|
+
struct dirent *de;
|
52
|
+
while ((de = readdir(d))) {
|
53
|
+
if (de->d_name[0] == '.')
|
54
|
+
continue;
|
55
|
+
snprintf(file, sizeof(file), "%s/%s", path, de->d_name);
|
56
|
+
int rc = unlink(file);
|
57
|
+
if (rc == -1) {
|
58
|
+
closedir(d);
|
59
|
+
return -1;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
closedir(d);
|
63
|
+
return rmdir(path);
|
64
|
+
}
|
65
|
+
|
66
|
+
#endif
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sophia-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- miyucy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Ruby bindings for the Sophia key/value store
|
42
|
+
email:
|
43
|
+
- fistfvck@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions:
|
46
|
+
- ext/extconf.rb
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- .gitmodules
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- ext/extconf.rb
|
56
|
+
- ext/sophia.c
|
57
|
+
- lib/sophia-ruby.rb
|
58
|
+
- lib/sophia/version.rb
|
59
|
+
- sophia-ruby.gemspec
|
60
|
+
- test/test_sophia.rb
|
61
|
+
- vendor/sophia/.gitignore
|
62
|
+
- vendor/sophia/COPYRIGHT
|
63
|
+
- vendor/sophia/README
|
64
|
+
- vendor/sophia/db/a.h
|
65
|
+
- vendor/sophia/db/cat.c
|
66
|
+
- vendor/sophia/db/cat.h
|
67
|
+
- vendor/sophia/db/core.h
|
68
|
+
- vendor/sophia/db/crc.c
|
69
|
+
- vendor/sophia/db/crc.h
|
70
|
+
- vendor/sophia/db/cursor.c
|
71
|
+
- vendor/sophia/db/cursor.h
|
72
|
+
- vendor/sophia/db/e.c
|
73
|
+
- vendor/sophia/db/e.h
|
74
|
+
- vendor/sophia/db/file.c
|
75
|
+
- vendor/sophia/db/file.h
|
76
|
+
- vendor/sophia/db/gc.c
|
77
|
+
- vendor/sophia/db/gc.h
|
78
|
+
- vendor/sophia/db/i.c
|
79
|
+
- vendor/sophia/db/i.h
|
80
|
+
- vendor/sophia/db/list.h
|
81
|
+
- vendor/sophia/db/lock.h
|
82
|
+
- vendor/sophia/db/macro.h
|
83
|
+
- vendor/sophia/db/makefile
|
84
|
+
- vendor/sophia/db/merge.c
|
85
|
+
- vendor/sophia/db/merge.h
|
86
|
+
- vendor/sophia/db/meta.h
|
87
|
+
- vendor/sophia/db/recover.c
|
88
|
+
- vendor/sophia/db/recover.h
|
89
|
+
- vendor/sophia/db/ref.h
|
90
|
+
- vendor/sophia/db/rep.c
|
91
|
+
- vendor/sophia/db/rep.h
|
92
|
+
- vendor/sophia/db/sophia.h
|
93
|
+
- vendor/sophia/db/sp.c
|
94
|
+
- vendor/sophia/db/sp.h
|
95
|
+
- vendor/sophia/db/task.h
|
96
|
+
- vendor/sophia/db/track.h
|
97
|
+
- vendor/sophia/db/util.c
|
98
|
+
- vendor/sophia/db/util.h
|
99
|
+
- vendor/sophia/makefile
|
100
|
+
- vendor/sophia/sophia.gyp
|
101
|
+
- vendor/sophia/test/common.c
|
102
|
+
- vendor/sophia/test/crash.c
|
103
|
+
- vendor/sophia/test/i.c
|
104
|
+
- vendor/sophia/test/limit.c
|
105
|
+
- vendor/sophia/test/makefile
|
106
|
+
- vendor/sophia/test/merge.c
|
107
|
+
- vendor/sophia/test/recover.c
|
108
|
+
- vendor/sophia/test/test.h
|
109
|
+
homepage: http://github.com/miyucy/sophia-ruby
|
110
|
+
licenses:
|
111
|
+
- MIT
|
112
|
+
metadata: {}
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.1.4
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: Ruby bindings for the Sophia key/value store
|
133
|
+
test_files:
|
134
|
+
- test/test_sophia.rb
|