rocksdb-ruby 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/ext/rocksdb/rocksdb_db_rb.cc +5 -3
- data/lib/rocksdb/ruby/version.rb +1 -1
- data/spec/db_spec.rb +11 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 508079e41f7fdac06ebdb734ef57f74af0ea97cc
|
4
|
+
data.tar.gz: 0887f5b646875890f6fd08707c404e9ae9724ac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 019a972398e9c9a331eed14e1a24dc17521c66e036c4dbad999e4c6fe4500f0c36305164384140dbcc91455882352ff7106b5a274400d6780fc19d5789b7c54f
|
7
|
+
data.tar.gz: 9e6f2e227742dc9f7f205fbbc9cf353f17c444ead0e0d5a5756520dd64742dd0316c53dbb9f245c4d75c06708c60483a0069a8723e269c0a0c56226d68b36a10
|
@@ -64,9 +64,10 @@ extern "C" {
|
|
64
64
|
|
65
65
|
std::string key = std::string((char*)RSTRING_PTR(v_key));
|
66
66
|
std::string value;
|
67
|
-
db_pointer->db->Get(rocksdb::ReadOptions(), key, &value);
|
68
|
-
|
69
|
-
return rb_enc_str_new(value.data(), value.size(), rb_utf8_encoding());
|
67
|
+
rocksdb::Status status = db_pointer->db->Get(rocksdb::ReadOptions(), key, &value);
|
68
|
+
|
69
|
+
return (status.IsNotFound()) ? Qnil : rb_enc_str_new(value.data(), value.size(), rb_utf8_encoding());
|
70
|
+
|
70
71
|
}
|
71
72
|
|
72
73
|
|
@@ -186,5 +187,6 @@ extern "C" {
|
|
186
187
|
}
|
187
188
|
|
188
189
|
VALUE rocksdb_db_debug(VALUE self){
|
190
|
+
return Qnil;
|
189
191
|
}
|
190
192
|
}
|
data/lib/rocksdb/ruby/version.rb
CHANGED
data/spec/db_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe RocksDB do
|
|
22
22
|
expect(@rocksdb.get("test:delete")).to eq "3"
|
23
23
|
|
24
24
|
expect(@rocksdb.delete("test:delete")).to be_true
|
25
|
-
expect(@rocksdb.get("test:delete")).to
|
25
|
+
expect(@rocksdb.get("test:delete")).to be_nil
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should get multi data' do
|
@@ -38,14 +38,14 @@ describe RocksDB do
|
|
38
38
|
@rocksdb.delete("test:batch2")
|
39
39
|
|
40
40
|
expect(@rocksdb.get("test:batch1")).to eq "a"
|
41
|
-
expect(@rocksdb.get("test:batch")).to
|
41
|
+
expect(@rocksdb.get("test:batch")).to be_nil
|
42
42
|
|
43
43
|
batch = RocksDB::Batch.new
|
44
44
|
batch.delete("test:batch1")
|
45
45
|
batch.put("test:batch2", "b")
|
46
46
|
@rocksdb.write(batch)
|
47
47
|
|
48
|
-
expect(@rocksdb.get("test:batch1")).to
|
48
|
+
expect(@rocksdb.get("test:batch1")).to be_nil
|
49
49
|
expect(@rocksdb.get("test:batch2")).to eq "b"
|
50
50
|
end
|
51
51
|
|
@@ -92,6 +92,14 @@ describe RocksDB do
|
|
92
92
|
expect(@rocksdb.includes?("test:noexists?")).to be_false
|
93
93
|
|
94
94
|
end
|
95
|
+
|
96
|
+
it 'hash' do
|
97
|
+
@rocksdb.delete("test:hash")
|
98
|
+
expect(@rocksdb["test:hash"]).to be_nil
|
99
|
+
@rocksdb["test:hash"] = "a"
|
100
|
+
expect(@rocksdb["test:hash"]).to eq "a"
|
101
|
+
|
102
|
+
end
|
95
103
|
|
96
104
|
after do
|
97
105
|
@rocksdb.close
|