arangorb 1.4.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ArangoRB.gemspec +20 -18
- data/Gemfile +3 -0
- data/README.md +1079 -908
- data/lib/AQL.rb +155 -0
- data/lib/Batch.rb +97 -0
- data/lib/Cache.rb +71 -0
- data/lib/Collection.rb +852 -0
- data/lib/Database.rb +417 -0
- data/lib/Document.rb +346 -0
- data/lib/Edge.rb +104 -0
- data/lib/Error.rb +125 -0
- data/lib/Foxx.rb +277 -0
- data/lib/Graph.rb +325 -0
- data/lib/Index.rb +126 -0
- data/lib/Replication.rb +235 -0
- data/lib/Request.rb +143 -0
- data/lib/Server.rb +466 -0
- data/lib/Task.rb +120 -0
- data/lib/Transaction.rb +115 -0
- data/lib/Traversal.rb +224 -0
- data/lib/User.rb +197 -0
- data/lib/Vertex.rb +127 -0
- data/lib/View.rb +151 -0
- data/lib/arangorb.rb +23 -15
- data/lib/helpers/Error.rb +28 -0
- data/lib/helpers/Return.rb +53 -0
- metadata +64 -45
- data/lib/ArangoRB_AQL.rb +0 -181
- data/lib/ArangoRB_Cache.rb +0 -174
- data/lib/ArangoRB_Col.rb +0 -526
- data/lib/ArangoRB_DB.rb +0 -363
- data/lib/ArangoRB_Doc.rb +0 -319
- data/lib/ArangoRB_Edg.rb +0 -184
- data/lib/ArangoRB_Gra.rb +0 -201
- data/lib/ArangoRB_Index.rb +0 -135
- data/lib/ArangoRB_Replication.rb +0 -261
- data/lib/ArangoRB_Ser.rb +0 -446
- data/lib/ArangoRB_Task.rb +0 -129
- data/lib/ArangoRB_Tra.rb +0 -169
- data/lib/ArangoRB_Tran.rb +0 -68
- data/lib/ArangoRB_User.rb +0 -157
- data/lib/ArangoRB_Ver.rb +0 -162
- data/spec/arangoRB_helper.rb +0 -4
- data/spec/arangoRestart_helper.rb +0 -14
- data/spec/arangorb-1.3.0.gem +0 -0
- data/spec/lib/0.1.0/arangoAQL_helper.rb +0 -64
- data/spec/lib/0.1.0/arangoC_helper.rb +0 -170
- data/spec/lib/0.1.0/arangoDB_helper.rb +0 -119
- data/spec/lib/0.1.0/arangoDoc_helper.rb +0 -79
- data/spec/lib/0.1.0/arangoE_helper.rb +0 -50
- data/spec/lib/0.1.0/arangoG_helper.rb +0 -78
- data/spec/lib/0.1.0/arangoS_helper.rb +0 -37
- data/spec/lib/0.1.0/arangoT_helper.rb +0 -48
- data/spec/lib/0.1.0/arangoV_helper.rb +0 -65
- data/spec/lib/1.0.0/arangoC_helper.rb +0 -73
- data/spec/lib/1.0.0/arangoDB_helper.rb +0 -48
- data/spec/lib/1.0.0/arangoI_helper.rb +0 -43
- data/spec/lib/1.0.0/arangoS_helper.rb +0 -192
- data/spec/lib/1.0.0/arangoTa_helper.rb +0 -49
- data/spec/lib/1.0.0/arangoTr_helper.rb +0 -15
- data/spec/lib/1.0.0/arangoU_helper.rb +0 -72
- data/spec/lib/1.1.0/arangoRB_helper.rb +0 -144
- data/spec/lib/1.1.0/arangoRB_walks_helper.rb +0 -19
- data/spec/lib/1.2.0/arangoCache_helper.rb +0 -66
- data/spec/lib/1.3.0/arangoHash_helper.rb +0 -30
- data/spec/lib/arangoRB_0.1.0_helper.rb +0 -9
- data/spec/lib/arangoRB_1.0.0_helper.rb +0 -6
- data/spec/lib/arangoRB_1.1.0_helper.rb +0 -2
- data/spec/lib/arangoRB_1.2.0_helper.rb +0 -2
- data/spec/spec_helper.rb +0 -42
@@ -1,19 +0,0 @@
|
|
1
|
-
require_relative './../../spec_helper'
|
2
|
-
|
3
|
-
describe ArangoDatabase do
|
4
|
-
context "#retrieve" do
|
5
|
-
it "walk" do
|
6
|
-
print "\n"
|
7
|
-
print "#{@myDatabase.name}\n"
|
8
|
-
print "#{@myDatabase['MyCollection'].name}\n"
|
9
|
-
print "#{@myDatabase['MyCollection'].documents.map{|x| x.name}}\n"
|
10
|
-
print "#{@myDatabase['MyCollection']["FirstKey"].name}\n"
|
11
|
-
print "#{@myDatabase['MyCollection'][@myDatabase['MyCollection']["FirstKey"]].name}\n"
|
12
|
-
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection").map{|x| x.name}}\n"
|
13
|
-
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]}\n"
|
14
|
-
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database.name}\n"
|
15
|
-
print "#{@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]}\n"
|
16
|
-
expect(@myDatabase['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.database['MyCollection']["FirstKey"].out("MyEdgeCollection")[0].to.body["num"]).to eq 1
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require_relative './../../spec_helper'
|
2
|
-
|
3
|
-
describe ArangoCache do
|
4
|
-
context "#cache" do
|
5
|
-
it "cache" do
|
6
|
-
@myDatabase.retrieve
|
7
|
-
@myCollection.retrieve
|
8
|
-
@myEdgeCollection.retrieve
|
9
|
-
@myGraph.retrieve
|
10
|
-
@myAQL.execute
|
11
|
-
@myVertex.retrieve
|
12
|
-
@myEdge.retrieve
|
13
|
-
@myIndex.retrieve
|
14
|
-
@myUser.retrieve
|
15
|
-
@myTask.retrieve
|
16
|
-
val = ArangoCache.cache data: [@myDatabase, @myCollection, @myEdgeCollection, @myGraph, @myAQL, @myVertex, @myEdge, @myIndex, @myUser, @myTask, [1,2,3]]
|
17
|
-
expect(val.length).to eq 11
|
18
|
-
end
|
19
|
-
|
20
|
-
it "cache with ID" do
|
21
|
-
myAQL2 = ArangoAQL.new query: "FOR u IN MyCollection RETURN u"
|
22
|
-
myAQL2.execute
|
23
|
-
ArangoCache.cache id: "myAQL", data: myAQL2
|
24
|
-
val = ArangoCache.uncache type: "AQL", id: "myAQL"
|
25
|
-
expect(val.result.length).to be > 0
|
26
|
-
end
|
27
|
-
|
28
|
-
it "uncache" do
|
29
|
-
val = ArangoCache.uncache data: [@myCollection, @myVertex]
|
30
|
-
val = val.map{|v| v.class.to_s}
|
31
|
-
expect(val).to eq ["ArangoCollection", "ArangoVertex"]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "#limits" do
|
36
|
-
it "max" do
|
37
|
-
ArangoCache.cache data: @myDoc
|
38
|
-
val = ArangoCache.retrieve["Document"]
|
39
|
-
ArangoCache.max type: "Document", val: 5
|
40
|
-
ArangoCache.retrieve["Document"]
|
41
|
-
ArangoCache.cache data: @myDoc[0]
|
42
|
-
val = ArangoCache.uncache type: "Document"
|
43
|
-
expect(val.length).to eq 5
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "#clear" do
|
48
|
-
it "clear object" do
|
49
|
-
ArangoCache.clear data: @myCollection
|
50
|
-
val = ArangoCache.uncache data: @myCollection
|
51
|
-
expect(val.nil?).to be true
|
52
|
-
end
|
53
|
-
|
54
|
-
it "clear type" do
|
55
|
-
ArangoCache.clear type: "Vertex"
|
56
|
-
val = ArangoCache.retrieve
|
57
|
-
expect(val["Vertex"].empty?).to be true
|
58
|
-
end
|
59
|
-
|
60
|
-
it "clear type" do
|
61
|
-
ArangoCache.clear
|
62
|
-
val = ArangoCache.retrieve
|
63
|
-
expect(val["Database"].empty?).to be true
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require_relative './../../spec_helper'
|
2
|
-
|
3
|
-
describe "ArangoHash" do
|
4
|
-
context "#hash" do
|
5
|
-
it "hash" do
|
6
|
-
@myDatabase.retrieve
|
7
|
-
@myCollection.retrieve
|
8
|
-
@myEdgeCollection.retrieve
|
9
|
-
@myGraph.retrieve
|
10
|
-
@myAQL.execute
|
11
|
-
@myVertex.retrieve
|
12
|
-
@myEdge.retrieve
|
13
|
-
@myIndex.retrieve
|
14
|
-
@myUser.retrieve
|
15
|
-
@myTask.retrieve
|
16
|
-
|
17
|
-
print "#{@myDatabase.to_h}\n"
|
18
|
-
print "#{@myCollection.to_h}\n"
|
19
|
-
print "#{@myEdgeCollection.to_h}\n"
|
20
|
-
print "#{@myGraph.to_h}\n"
|
21
|
-
print "#{@myAQL.to_h}\n"
|
22
|
-
print "#{@myVertex.to_h}\n"
|
23
|
-
print "#{@myEdge.to_h}\n"
|
24
|
-
print "#{@myIndex.to_h}\n"
|
25
|
-
print "#{@myUser.to_h}\n"
|
26
|
-
print "#{@myTask.to_h}\n"
|
27
|
-
expect(@myTask.to_hash.class).to be Hash
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require "lib/0.1.0/arangoS_helper"
|
2
|
-
require "lib/0.1.0/arangoDB_helper"
|
3
|
-
require "lib/0.1.0/arangoC_helper"
|
4
|
-
require "lib/0.1.0/arangoDoc_helper"
|
5
|
-
require "lib/0.1.0/arangoG_helper"
|
6
|
-
require "lib/0.1.0/arangoV_helper"
|
7
|
-
require "lib/0.1.0/arangoE_helper"
|
8
|
-
require "lib/0.1.0/arangoT_helper"
|
9
|
-
require "lib/0.1.0/arangoAQL_helper"
|
data/spec/spec_helper.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require "rspec"
|
2
|
-
require "arangorb"
|
3
|
-
# require_relative File.expand_path('../../lib/arangorb', __FILE__)
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.color = true
|
7
|
-
config.before(:all) do
|
8
|
-
ArangoServer.default_server user: "root", password: "tretretre", server: "localhost", port: "8529"
|
9
|
-
ArangoServer.database = "MyDatabase"
|
10
|
-
ArangoServer.collection = "MyCollection"
|
11
|
-
ArangoServer.graph = "MyGraph"
|
12
|
-
ArangoServer.user = "MyUser"
|
13
|
-
ArangoServer.verbose = false
|
14
|
-
ArangoServer.async = false
|
15
|
-
@myDatabase = ArangoDatabase.new.create
|
16
|
-
@myGraph = ArangoGraph.new.create
|
17
|
-
@myCollection = ArangoCollection.new.create
|
18
|
-
@myCollectionB = ArangoCollection.new(collection: "MyCollectionB").create
|
19
|
-
@myDocument = ArangoDocument.new(body: {"Hello" => "World", "num" => 1}, key: "FirstDocument").create
|
20
|
-
@myEdgeCollection = ArangoCollection.new(collection: "MyEdgeCollection").create_edge_collection
|
21
|
-
@myGraph.addVertexCollection collection: "MyCollection"
|
22
|
-
@myGraph.addEdgeCollection collection: "MyEdgeCollection", from: "MyCollection", to: "MyCollection"
|
23
|
-
@myAQL = ArangoAQL.new query: "FOR u IN MyCollection RETURN u.num"
|
24
|
-
@myDoc = @myCollection.create_document document: [{"num" => 1, "_key" => "FirstKey"}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 1}, {"num" => 2}, {"num" => 2}, {"num" => 2}, {"num" => 3}, {"num" => 2}, {"num" => 5}, {"num" => 2}]
|
25
|
-
@myEdgeCollection.create_edge from: [@myDoc[0].id, @myDoc[1].id, @myDoc[2].id, @myDoc[3].id, @myDoc[7].id], to: [@myDoc[4].id, @myDoc[5].id, @myDoc[6].id, @myDoc[8].id]
|
26
|
-
@myVertex = ArangoVertex.new(body: {"Hello" => "World", "num" => 1}, key: "FirstVertex").create
|
27
|
-
@vertexA = ArangoVertex.new(body: {"Hello" => "World", "num" => 1}).create
|
28
|
-
@vertexB = ArangoVertex.new(body: {"Hello" => "Moon", "num" => 2}).create
|
29
|
-
@myEdge = ArangoEdge.new(from: @vertexA, to: @vertexB, collection: "MyEdgeCollection").create
|
30
|
-
@myIndex = @myCollection.createIndex unique: false, fields: "num", type: "hash", id: "MyIndex"
|
31
|
-
@myTraversal = ArangoTraversal.new
|
32
|
-
@myUser = ArangoUser.new.create
|
33
|
-
@myTask = ArangoTask.new id: "mytaskid", name: "MyTaskID", command: "(function(params) { require('@arangodb').print(params); })(params)", params: {"foo" => "bar", "bar" => "foo"}, period: 60
|
34
|
-
end
|
35
|
-
|
36
|
-
config.after(:all) do
|
37
|
-
ArangoDatabase.new.destroy
|
38
|
-
ArangoUser.new.destroy
|
39
|
-
@myUser.destroy unless @myUser.nil?
|
40
|
-
@myIndex.destroy unless @myIndex.nil?
|
41
|
-
end
|
42
|
-
end
|