arangorb 1.2.0 → 1.3.0
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/ArangoRB.gemspec +18 -18
- data/Gemfile +8 -7
- data/LICENSE +21 -21
- data/README.md +906 -867
- data/lib/ArangoRB_AQL.rb +181 -160
- data/lib/ArangoRB_Cache.rb +174 -174
- data/lib/ArangoRB_Col.rb +526 -499
- data/lib/ArangoRB_DB.rb +363 -339
- data/lib/ArangoRB_Doc.rb +319 -298
- data/lib/ArangoRB_Edg.rb +184 -169
- data/lib/ArangoRB_Gra.rb +201 -180
- data/lib/ArangoRB_Index.rb +135 -115
- data/lib/ArangoRB_Replication.rb +261 -0
- data/lib/ArangoRB_Ser.rb +446 -441
- data/lib/ArangoRB_Task.rb +129 -113
- data/lib/ArangoRB_Tra.rb +169 -142
- data/lib/ArangoRB_Tran.rb +68 -53
- data/lib/ArangoRB_User.rb +149 -136
- data/lib/ArangoRB_Ver.rb +162 -147
- data/lib/arangorb.rb +16 -15
- data/spec/arangoRB_helper.rb +4 -4
- data/spec/arangoRestart_helper.rb +14 -14
- data/spec/lib/0.1.0/arangoAQL_helper.rb +64 -64
- data/spec/lib/0.1.0/arangoC_helper.rb +170 -170
- data/spec/lib/0.1.0/arangoDB_helper.rb +119 -119
- data/spec/lib/0.1.0/arangoDoc_helper.rb +79 -79
- data/spec/lib/0.1.0/arangoE_helper.rb +50 -50
- data/spec/lib/0.1.0/arangoG_helper.rb +78 -78
- data/spec/lib/0.1.0/arangoS_helper.rb +37 -37
- data/spec/lib/0.1.0/arangoT_helper.rb +48 -48
- data/spec/lib/0.1.0/arangoV_helper.rb +65 -65
- data/spec/lib/1.0.0/arangoC_helper.rb +73 -73
- data/spec/lib/1.0.0/arangoDB_helper.rb +48 -48
- data/spec/lib/1.0.0/arangoI_helper.rb +43 -43
- data/spec/lib/1.0.0/arangoS_helper.rb +192 -192
- data/spec/lib/1.0.0/arangoTa_helper.rb +49 -49
- data/spec/lib/1.0.0/arangoTr_helper.rb +15 -15
- data/spec/lib/1.0.0/arangoU_helper.rb +72 -72
- data/spec/lib/1.1.0/arangoRB_helper.rb +144 -144
- data/spec/lib/1.1.0/arangoRB_walks_helper.rb +19 -19
- data/spec/lib/1.2.0/arangoCache_helper.rb +66 -66
- data/spec/lib/1.3.0/arangoHash_helper.rb +30 -0
- data/spec/lib/arangoRB_0.1.0_helper.rb +9 -9
- data/spec/lib/arangoRB_1.0.0_helper.rb +6 -6
- data/spec/lib/arangoRB_1.1.0_helper.rb +2 -2
- data/spec/lib/arangoRB_1.2.0_helper.rb +2 -1
- data/spec/spec_helper.rb +41 -41
- metadata +6 -5
data/lib/ArangoRB_Index.rb
CHANGED
@@ -1,115 +1,135 @@
|
|
1
|
-
# === INDEXES ===
|
2
|
-
|
3
|
-
class ArangoIndex < ArangoServer
|
4
|
-
def initialize(collection: @@collection, database: @@database, body: {}, id: nil, type: nil, unique: nil, fields:, sparse: nil) # TESTED
|
5
|
-
if collection.is_a?(String)
|
6
|
-
@collection = collection
|
7
|
-
elsif collection.is_a?(ArangoCollection)
|
8
|
-
@collection = collection.collection
|
9
|
-
else
|
10
|
-
raise "collection should be a String or a ArangoCollection instance, not a #{collection.class}"
|
11
|
-
end
|
12
|
-
|
13
|
-
if database.is_a?(String)
|
14
|
-
@database = database
|
15
|
-
elsif database.is_a?(ArangoDatabase)
|
16
|
-
@database = database.database
|
17
|
-
else
|
18
|
-
raise "database should be a String or a ArangoDatabase instance, not a #{database.class}"
|
19
|
-
end
|
20
|
-
|
21
|
-
if body.is_a?(Hash)
|
22
|
-
@body = body
|
23
|
-
else
|
24
|
-
raise "body should be a Hash, not a #{body.class}"
|
25
|
-
end
|
26
|
-
|
27
|
-
unless id.nil?
|
28
|
-
@key = id.split("/")[1]
|
29
|
-
@id = id
|
30
|
-
end
|
31
|
-
@type = type
|
32
|
-
@sparse = sparse
|
33
|
-
@unique = unique unless unique.nil?
|
34
|
-
|
35
|
-
if fields.is_a?(String)
|
36
|
-
@fields = [fields]
|
37
|
-
elsif fields.is_a?(Array)
|
38
|
-
@fields = fields
|
39
|
-
else
|
40
|
-
raise "fields should be a String or an Array, not a #{database.class}"
|
41
|
-
end
|
42
|
-
|
43
|
-
@idCache = "IND_#{@id}"
|
44
|
-
end
|
45
|
-
|
46
|
-
attr_reader :body, :type, :id, :unique, :fields, :key, :sparse, :idCache
|
47
|
-
|
48
|
-
### RETRIEVE ###
|
49
|
-
|
50
|
-
def
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
@
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
result =
|
79
|
-
return result
|
80
|
-
result
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
result
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
result
|
100
|
-
return result if
|
101
|
-
|
102
|
-
result.
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
1
|
+
# === INDEXES ===
|
2
|
+
|
3
|
+
class ArangoIndex < ArangoServer
|
4
|
+
def initialize(collection: @@collection, database: @@database, body: {}, id: nil, type: nil, unique: nil, fields:, sparse: nil) # TESTED
|
5
|
+
if collection.is_a?(String)
|
6
|
+
@collection = collection
|
7
|
+
elsif collection.is_a?(ArangoCollection)
|
8
|
+
@collection = collection.collection
|
9
|
+
else
|
10
|
+
raise "collection should be a String or a ArangoCollection instance, not a #{collection.class}"
|
11
|
+
end
|
12
|
+
|
13
|
+
if database.is_a?(String)
|
14
|
+
@database = database
|
15
|
+
elsif database.is_a?(ArangoDatabase)
|
16
|
+
@database = database.database
|
17
|
+
else
|
18
|
+
raise "database should be a String or a ArangoDatabase instance, not a #{database.class}"
|
19
|
+
end
|
20
|
+
|
21
|
+
if body.is_a?(Hash)
|
22
|
+
@body = body
|
23
|
+
else
|
24
|
+
raise "body should be a Hash, not a #{body.class}"
|
25
|
+
end
|
26
|
+
|
27
|
+
unless id.nil?
|
28
|
+
@key = id.split("/")[1]
|
29
|
+
@id = id
|
30
|
+
end
|
31
|
+
@type = type
|
32
|
+
@sparse = sparse
|
33
|
+
@unique = unique unless unique.nil?
|
34
|
+
|
35
|
+
if fields.is_a?(String)
|
36
|
+
@fields = [fields]
|
37
|
+
elsif fields.is_a?(Array)
|
38
|
+
@fields = fields
|
39
|
+
else
|
40
|
+
raise "fields should be a String or an Array, not a #{database.class}"
|
41
|
+
end
|
42
|
+
|
43
|
+
@idCache = "IND_#{@id}"
|
44
|
+
end
|
45
|
+
|
46
|
+
attr_reader :body, :type, :id, :unique, :fields, :key, :sparse, :idCache
|
47
|
+
|
48
|
+
### RETRIEVE ###
|
49
|
+
|
50
|
+
def to_hash
|
51
|
+
{
|
52
|
+
"key" => @key,
|
53
|
+
"id" => @id,
|
54
|
+
"collection" => @collection,
|
55
|
+
"database" => @database,
|
56
|
+
"body" => @body,
|
57
|
+
"type" => @type,
|
58
|
+
"sparse" => @sparse,
|
59
|
+
"unique" => @unique,
|
60
|
+
"fields" => @fields,
|
61
|
+
"idCache" => @idCache
|
62
|
+
}.delete_if{|k,v| v.nil?}
|
63
|
+
end
|
64
|
+
alias to_h to_hash
|
65
|
+
|
66
|
+
def database
|
67
|
+
ArangoDatabase.new(database: @database)
|
68
|
+
end
|
69
|
+
|
70
|
+
def collection
|
71
|
+
ArangoCollection.new(collection: @collection, database: @database)
|
72
|
+
end
|
73
|
+
|
74
|
+
def retrieve # TESTED
|
75
|
+
result = self.class.get("/_db/#{@database}/_api/index/#{@id}", @@request)
|
76
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
77
|
+
return true if @@async
|
78
|
+
result = result.parsed_response
|
79
|
+
return result if @@verbose
|
80
|
+
return result["errorMessage"] if result["error"]
|
81
|
+
result.delete_if{|k,v| k == "error" || k == "code"}
|
82
|
+
@body = result
|
83
|
+
@type = result["type"]
|
84
|
+
@unique = result["unique"]
|
85
|
+
@fields = result["fields"]
|
86
|
+
@sparse = result["sparse"]
|
87
|
+
self
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.indexes(database: @@database, collection: @@collection) # TESTED
|
91
|
+
database = database.database if database.is_a?(ArangoDatabase)
|
92
|
+
collection = collection.collection if collection.is_a?(ArangoCollection)
|
93
|
+
query = { "collection": collection }
|
94
|
+
request = @@request.merge({ :query => query })
|
95
|
+
result = get("/_db/#{database}/_api/index", request)
|
96
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
97
|
+
return true if @@async
|
98
|
+
result = result.parsed_response
|
99
|
+
return result if @@verbose
|
100
|
+
return result["errorMessage"] if result["error"]
|
101
|
+
result.delete_if{|k,v| k == "error" || k == "code"}
|
102
|
+
result["indexes"] = result["indexes"].map{|x| ArangoIndex.new(body: x, id: x["id"], database: database, collection: collection, type: x["type"], unique: x["unique"], fields: x["fields"], sparse: x["sparse"])}
|
103
|
+
result
|
104
|
+
end
|
105
|
+
|
106
|
+
def create # TESTED
|
107
|
+
body = @body.merge({
|
108
|
+
"fields" => @fields,
|
109
|
+
"unique" => @unique,
|
110
|
+
"type" => @type,
|
111
|
+
"id" => @id
|
112
|
+
}.delete_if{|k,v| v.nil?})
|
113
|
+
query = { "collection": @collection }
|
114
|
+
request = @@request.merge({ :body => body.to_json, :query => query })
|
115
|
+
result = self.class.post("/_db/#{@database}/_api/index", request)
|
116
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
117
|
+
return true if @@async
|
118
|
+
result = result.parsed_response
|
119
|
+
return result if @@verbose
|
120
|
+
return result["errorMessage"] if result["error"]
|
121
|
+
result.delete_if{|k,v| k == "error" || k == "code"}
|
122
|
+
@body = result
|
123
|
+
@id = result["id"]
|
124
|
+
@key = @id.split("/")[1]
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
def destroy # TESTED
|
129
|
+
result = self.class.delete("/_db/#{@database}/_api/index/#{id}", @@request)
|
130
|
+
return result.headers["x-arango-async-id"] if @@async == "store"
|
131
|
+
return true if @@async
|
132
|
+
result = result.parsed_response
|
133
|
+
@@verbose ? result : result["error"] ? result["errorMessage"] : true
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,261 @@
|
|
1
|
+
# === REPLICATION ===
|
2
|
+
|
3
|
+
class ArangoReplication < ArangoServer
|
4
|
+
def initialize(endpoint:, username:, password:, database: nil, includeSystem: true, initialSyncMaxWaitTime: nil, incremental: nil, restrictCollections: nil, verbose: false, connectTimeout: nil, autoResync: nil, idleMinWaitTime: nil, requestTimeout: nil, requireFromPresent: nil, idleMaxWaitTime: nil, restrictType: nil, maxConnectRetries: nil, adaptivePolling: nil, connectionRetryWaitTime: nil, autoResyncRetries: nil, chunkSize: nil)
|
5
|
+
if database.is_a?(String) || database.nil?
|
6
|
+
@database = database
|
7
|
+
elsif database.is_a?(ArangoDatabase)
|
8
|
+
@database = database.database
|
9
|
+
else
|
10
|
+
raise "database should be nil, a String or an ArangoDatabase instance, not a #{database.class}"
|
11
|
+
end
|
12
|
+
|
13
|
+
if restrictType == "include" || restrictType == "exclude" || restrictType.nil?
|
14
|
+
@restrictType = restrictType
|
15
|
+
else
|
16
|
+
raise "restrictType can be only \"include\" or \"exclude\"."
|
17
|
+
end
|
18
|
+
|
19
|
+
if restrictCollections.nil?
|
20
|
+
@restrictCollections = nil
|
21
|
+
else
|
22
|
+
@restrictCollections = []
|
23
|
+
restrictCollections.each do |v|
|
24
|
+
if v.is_a? (String)
|
25
|
+
@restrictCollections << v
|
26
|
+
elsif v.is_a? (ArangoCollection)
|
27
|
+
@restrictCollections << v.name
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
@endpoint = endpoint
|
33
|
+
@username = username
|
34
|
+
@password = password
|
35
|
+
@includeSytem = includeSystem
|
36
|
+
@initialSyncMaxWaitTime = initialSyncMaxWaitTime,
|
37
|
+
@incremental = incremental
|
38
|
+
@verbose = verbose,
|
39
|
+
@connectTimeout = connectTimeout
|
40
|
+
@autoResync = autoResync
|
41
|
+
@idleMinWaitTime = idleMinWaitTime
|
42
|
+
@requestTimeout = requestTimeout
|
43
|
+
@requireFromPresent = requireFromPresent
|
44
|
+
@idleMaxWaitTime = idleMaxWaitTime
|
45
|
+
@maxConnectRetries = maxConnectRetries
|
46
|
+
@adaptivePolling = adaptivePolling
|
47
|
+
@connectionRetryWaitTime = connectionRetryWaitTime
|
48
|
+
@autoResyncRetries = autoResyncRetries
|
49
|
+
@chunkSize = chunkSize
|
50
|
+
end
|
51
|
+
|
52
|
+
def master(endpoint:, username:, password:, database: nil)
|
53
|
+
if database.is_a?(String) || database.nil?
|
54
|
+
@database = database
|
55
|
+
elsif database.is_a?(ArangoDatabase)
|
56
|
+
@database = database.database
|
57
|
+
else
|
58
|
+
raise "database should be nil, a String or an ArangoDatabase instance, not a #{database.class}"
|
59
|
+
end
|
60
|
+
|
61
|
+
@endpoint = endpoint
|
62
|
+
@username = username
|
63
|
+
@password = password
|
64
|
+
end
|
65
|
+
|
66
|
+
attr_accessor :endpoint, :username, :password, :includeSystem, :initialSyncMaxWaitTime, :incremental, :verbose, :connectTimeout, :autoResync, :idleMinWaitTime, :requestTimeout, :requireFromPresent, :idleMaxWaitTime, :maxConnectRetries, :adaptivePolling, :connectionRetryWaitTime, :autoResyncRetries, :chunkSize
|
67
|
+
attr_reader :database, :restrictType, :restrictCollections
|
68
|
+
|
69
|
+
def restrictType=(value)
|
70
|
+
if value == "include" || value == "exclude" || value.nil?
|
71
|
+
@restrictType = value
|
72
|
+
else
|
73
|
+
raise "restrictType can be only \"include\" or \"exclude\"."
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def restrictCollections=(value)
|
78
|
+
if value.nil?
|
79
|
+
@restrictCollections = nil
|
80
|
+
else
|
81
|
+
value = [value] unless value.is_a? Array
|
82
|
+
@restrictCollections = []
|
83
|
+
value.each do |v|
|
84
|
+
if v.is_a? (String)
|
85
|
+
@restrictCollections << v
|
86
|
+
elsif v.is_a? (ArangoCollection)
|
87
|
+
@restrictCollections << v.name
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def to_hash
|
94
|
+
master
|
95
|
+
{
|
96
|
+
"master" => {
|
97
|
+
"endpoint" => @endpoint,
|
98
|
+
"username" => @username,
|
99
|
+
"password" => @password,
|
100
|
+
"database" => @database
|
101
|
+
}.delete_if{|k,v| v.nil?},
|
102
|
+
"options" => {
|
103
|
+
"includeSytem" => @includeSystem,
|
104
|
+
"initialSyncMaxWaitTime" => @initialSyncMaxWaitTime,
|
105
|
+
"restrictType" => @restrictType,
|
106
|
+
"incremental" => @incremental,
|
107
|
+
"restrictCollections" => @restrictCollections,
|
108
|
+
"verbose" => @verbose,
|
109
|
+
"connectTimeout" => @connectTimeout,
|
110
|
+
"autoResync" => @autoResync,
|
111
|
+
"idleMinWaitTime" => @idleMinWaitTime,
|
112
|
+
"requestTimeout" => @requestTimeout,
|
113
|
+
"requireFromPresent" => @requireFromPresent,
|
114
|
+
"idleMaxWaitTime" => @idleMaxWaitTime,
|
115
|
+
"maxConnectRetries" => @maxConnectRetries,
|
116
|
+
"adaptivePolling" => @adaptivePolling,
|
117
|
+
"connectionRetryWaitTime" => @connectionRetryWaitTime,
|
118
|
+
"autoResyncRetries" => @autoResyncRetries,
|
119
|
+
"chunkSize" => @chunkSize
|
120
|
+
}.delete_if{|k,v| v.nil?}
|
121
|
+
}
|
122
|
+
end
|
123
|
+
alias to_h to_hash
|
124
|
+
|
125
|
+
# SYNCRONISATION
|
126
|
+
|
127
|
+
def sync
|
128
|
+
body = {
|
129
|
+
"username" => @username,
|
130
|
+
"password" => @password,
|
131
|
+
"endpoint" => @endpoint,
|
132
|
+
"database" => @database,
|
133
|
+
"includeSystem" => @includeSystem,
|
134
|
+
"initialSyncMaxWaitTime" => @initialSyncMaxWaitTime,
|
135
|
+
"restrictType" => @restrictType,
|
136
|
+
"incremental" => @incremental,
|
137
|
+
"restrictCollections" => @restrictCollections
|
138
|
+
}.delete_if{|k,v| v.nil?}
|
139
|
+
request = @@request.merge({ :body => body.to_json })
|
140
|
+
result = self.class.put("/_api/replication/sync", request)
|
141
|
+
self.class.return_result result: result
|
142
|
+
end
|
143
|
+
|
144
|
+
# ENSLAVE
|
145
|
+
|
146
|
+
def enslave
|
147
|
+
body = {
|
148
|
+
"username" => @username,
|
149
|
+
"password" => @password,
|
150
|
+
"endpoint" => @endpoint,
|
151
|
+
"database" => @database,
|
152
|
+
"includeSystem" => @includeSystem,
|
153
|
+
"initialSyncMaxWaitTime" => @initialSyncMaxWaitTime,
|
154
|
+
"verbose" => @verbose,
|
155
|
+
"connectTimeout" => @connectTimeout,
|
156
|
+
"autoResync" => @autoResync,
|
157
|
+
"idleMinWaitTime" => @idleMinWaitTime,
|
158
|
+
"requestTimeout" => @requestTimeout,
|
159
|
+
"requireFromPresent" => @requireFromPresent,
|
160
|
+
"idleMaxWaitTime" => @idleMaxWaitTime,
|
161
|
+
"restrictType" => @restrictType,
|
162
|
+
"maxConnectRetries" => @maxConnectRetries,
|
163
|
+
"adaptivePolling" => @adaptivePolling,
|
164
|
+
"connectionRetryWaitTime" => @connectionRetryWaitTime,
|
165
|
+
"restrictCollections" => @restrictCollections,
|
166
|
+
"autoResyncRetries" => @autoResyncRetries,
|
167
|
+
"chunkSize" => @chunkSize
|
168
|
+
}.delete_if{|k,v| v.nil?}
|
169
|
+
request = @@request.merge({ :body => body.to_json })
|
170
|
+
result = self.class.put("/_api/replication/make-slave", request)
|
171
|
+
self.class.return_result result: result
|
172
|
+
end
|
173
|
+
|
174
|
+
# MANAGE CONFIGURATION
|
175
|
+
|
176
|
+
def stateReplication # TESTED
|
177
|
+
result = self.class.get("/_db/#{@database}/_api/replication/applier-state", @@request)
|
178
|
+
self.class.return_result result: result
|
179
|
+
end
|
180
|
+
|
181
|
+
def configurationReplication
|
182
|
+
result = self.class.get("/_api/replication/applier-config", @@request)
|
183
|
+
self.class.return_result result: result
|
184
|
+
end
|
185
|
+
|
186
|
+
def modifyConfigurationReplication
|
187
|
+
body = {
|
188
|
+
"username" => @username,
|
189
|
+
"password" => @password,
|
190
|
+
"includeSystem" => @includeSystem,
|
191
|
+
"endpoint" => @endpoint,
|
192
|
+
"initialSyncMaxWaitTime" => @initialSyncMaxWaitTime,
|
193
|
+
"database" => @database,
|
194
|
+
"verbose" => @verbose,
|
195
|
+
"connectTimeout" => @connectTimeout,
|
196
|
+
"autoResync" => @autoResync,
|
197
|
+
"idleMinWaitTime" => @idleMinWaitTime,
|
198
|
+
"requestTimeout" => @requestTimeout,
|
199
|
+
"requireFromPresent" => @requireFromPresent,
|
200
|
+
"idleMaxWaitTime" => @idleMaxWaitTime,
|
201
|
+
"restrictType" => @restrictType,
|
202
|
+
"maxConnectRetries" => @maxConnectRetries,
|
203
|
+
"autoStart" => @autoStart,
|
204
|
+
"adaptivePolling" => @adaptivePolling,
|
205
|
+
"connectionRetryWaitTime" => @connectionRetryWaitTime,
|
206
|
+
"restrictCollections" => @restrictCollections,
|
207
|
+
"autoResyncRetries" => @autoResyncRetries,
|
208
|
+
"chunkSize" => @chunkSize
|
209
|
+
}.delete_if{|k,v| v.nil?}
|
210
|
+
request = @@request.merge({ :body => body.to_json })
|
211
|
+
result = self.class.put("/_api/replication/applier-config", request)
|
212
|
+
self.class.return_result result: result
|
213
|
+
end
|
214
|
+
alias modifyReplication modifyConfigurationReplication
|
215
|
+
|
216
|
+
def startReplication(from: nil) # TESTED
|
217
|
+
query = {from: from}.delete_if{|k,v| v.nil?}
|
218
|
+
request = @@request.merge({ :query => query })
|
219
|
+
result = self.class.put("/_api/replication/applier-start", request)
|
220
|
+
self.class.return_result result: result
|
221
|
+
end
|
222
|
+
|
223
|
+
def stopReplication # TESTED
|
224
|
+
result = self.class.put("/_api/replication/applier-stop", @@request)
|
225
|
+
self.class.return_result result: result
|
226
|
+
end
|
227
|
+
|
228
|
+
# INFO
|
229
|
+
|
230
|
+
def serverId # TESTED
|
231
|
+
result = self.class.get("/_db/#{@database}/_api/replication/server-id", @@request)
|
232
|
+
self.class.return_result result: result, key: "serverId"
|
233
|
+
end
|
234
|
+
|
235
|
+
def logger # TESTED
|
236
|
+
result = self.class.get("/_db/#{@database}/_api/replication/logger-state")
|
237
|
+
self.class.return_result result: result
|
238
|
+
end
|
239
|
+
|
240
|
+
def loggerFollow(from: nil, to: nil, chunkSize: nil, includeSystem: false) # TESTED
|
241
|
+
query = {
|
242
|
+
"from": from,
|
243
|
+
"to": to,
|
244
|
+
"chunkSize": chunkSize,
|
245
|
+
"includeSystem": includeSystem
|
246
|
+
}.delete_if{|k,v| v.nil?}
|
247
|
+
request = @@request.merge({ :query => query })
|
248
|
+
result = self.class.get("/_db/#{@database}/_api/replication/logger-follow", request)
|
249
|
+
self.class.return_result result: result
|
250
|
+
end
|
251
|
+
|
252
|
+
def firstTick # TESTED
|
253
|
+
result = self.class.get("/_db/#{@database}/_api/replication/logger-first-tick")
|
254
|
+
self.class.return_result result: result, key: "firstTick"
|
255
|
+
end
|
256
|
+
|
257
|
+
def rangeTick # TESTED
|
258
|
+
result = self.class.get("/_db/#{@database}/_api/replication/logger-tick-ranges")
|
259
|
+
self.class.return_result result: result
|
260
|
+
end
|
261
|
+
end
|