Class: Arango::Replication
- Inherits:
-
Object
- Object
- Arango::Replication
- Defined in:
- lib/Replication.rb
Instance Attribute Summary collapse
-
#adaptivePolling ⇒ Object
Returns the value of attribute adaptivePolling.
-
#autoResync ⇒ Object
Returns the value of attribute autoResync.
-
#autoResyncRetries ⇒ Object
Returns the value of attribute autoResyncRetries.
-
#chunkSize ⇒ Object
Returns the value of attribute chunkSize.
-
#connectionRetryWaitTime ⇒ Object
Returns the value of attribute connectionRetryWaitTime.
-
#connectTimeout ⇒ Object
Returns the value of attribute connectTimeout.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#idleMaxWaitTime ⇒ Object
Returns the value of attribute idleMaxWaitTime.
-
#idleMinWaitTime ⇒ Object
Returns the value of attribute idleMinWaitTime.
-
#includeSystem ⇒ Object
Returns the value of attribute includeSystem.
-
#incremental ⇒ Object
Returns the value of attribute incremental.
-
#initialSyncMaxWaitTime ⇒ Object
Returns the value of attribute initialSyncMaxWaitTime.
-
#master ⇒ Object
Returns the value of attribute master.
-
#maxConnectRetries ⇒ Object
Returns the value of attribute maxConnectRetries.
-
#password ⇒ Object
Returns the value of attribute password.
-
#requestTimeout ⇒ Object
Returns the value of attribute requestTimeout.
-
#requireFromPresent ⇒ Object
Returns the value of attribute requireFromPresent.
-
#restrictCollections ⇒ Object
Returns the value of attribute restrictCollections.
-
#restrictType ⇒ Object
Returns the value of attribute restrictType.
-
#slave ⇒ Object
Returns the value of attribute slave.
-
#username ⇒ Object
Returns the value of attribute username.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #configuration ⇒ Object
-
#enslave ⇒ Object
ENSLAVING.
-
#initialize(master:, slave:, includeSystem: true, initialSyncMaxWaitTime: nil, incremental: nil, restrictCollections: nil, connectTimeout: nil, autoResync: nil, idleMinWaitTime: nil, requestTimeout: nil, requireFromPresent: nil, idleMaxWaitTime: nil, restrictType: nil, maxConnectRetries: nil, adaptivePolling: nil, connectionRetryWaitTime: nil, autoResyncRetries: nil, chunkSize: nil, verbose: nil) ⇒ Replication
constructor
A new instance of Replication.
-
#logger ⇒ Object
LOGGER.
- #loggerFirstTick ⇒ Object
- #loggerFollow(from: nil, to: nil, chunkSize: nil, includeSystem: nil) ⇒ Object
- #loggerRangeTick ⇒ Object
- #modify ⇒ Object
-
#serverId ⇒ Object
SERVER-ID.
-
#start(from: nil) ⇒ Object
REPLICATION.
- #state ⇒ Object
- #stop ⇒ Object
-
#sync ⇒ Object
SYNCRONISATION.
- #to_h ⇒ Object
Constructor Details
#initialize(master:, slave:, includeSystem: true, initialSyncMaxWaitTime: nil, incremental: nil, restrictCollections: nil, connectTimeout: nil, autoResync: nil, idleMinWaitTime: nil, requestTimeout: nil, requireFromPresent: nil, idleMaxWaitTime: nil, restrictType: nil, maxConnectRetries: nil, adaptivePolling: nil, connectionRetryWaitTime: nil, autoResyncRetries: nil, chunkSize: nil, verbose: nil) ⇒ Replication
Returns a new instance of Replication.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/Replication.rb', line 5 def initialize(master:, slave:, includeSystem: true, initialSyncMaxWaitTime: nil, incremental: nil, restrictCollections: nil, connectTimeout: nil, autoResync: nil, idleMinWaitTime: nil, requestTimeout: nil, requireFromPresent: nil, idleMaxWaitTime: nil, restrictType: nil, maxConnectRetries: nil, adaptivePolling: nil, connectionRetryWaitTime: nil, autoResyncRetries: nil, chunkSize: nil, verbose: nil) assign_master(master) assign_slave(slave) assign_restrictType(restrictType) assign_restrictCollections(restrictCollections) @includeSytem = includeSystem @initialSyncMaxWaitTime = initialSyncMaxWaitTime, @incremental = incremental @connectTimeout = connectTimeout @autoResync = autoResync @idleMinWaitTime = idleMinWaitTime @requestTimeout = requestTimeout @requireFromPresent = requireFromPresent @idleMaxWaitTime = idleMaxWaitTime @maxConnectRetries = maxConnectRetries @adaptivePolling = adaptivePolling @connectionRetryWaitTime = connectionRetryWaitTime @autoResyncRetries = autoResyncRetries @chunkSize = chunkSize @verbose = verbose end |
Instance Attribute Details
#adaptivePolling ⇒ Object
Returns the value of attribute adaptivePolling.
34 35 36 |
# File 'lib/Replication.rb', line 34 def adaptivePolling @adaptivePolling end |
#autoResync ⇒ Object
Returns the value of attribute autoResync.
34 35 36 |
# File 'lib/Replication.rb', line 34 def autoResync @autoResync end |
#autoResyncRetries ⇒ Object
Returns the value of attribute autoResyncRetries.
34 35 36 |
# File 'lib/Replication.rb', line 34 def autoResyncRetries @autoResyncRetries end |
#chunkSize ⇒ Object
Returns the value of attribute chunkSize.
34 35 36 |
# File 'lib/Replication.rb', line 34 def chunkSize @chunkSize end |
#connectionRetryWaitTime ⇒ Object
Returns the value of attribute connectionRetryWaitTime.
34 35 36 |
# File 'lib/Replication.rb', line 34 def connectionRetryWaitTime @connectionRetryWaitTime end |
#connectTimeout ⇒ Object
Returns the value of attribute connectTimeout.
34 35 36 |
# File 'lib/Replication.rb', line 34 def connectTimeout @connectTimeout end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
34 35 36 |
# File 'lib/Replication.rb', line 34 def endpoint @endpoint end |
#idleMaxWaitTime ⇒ Object
Returns the value of attribute idleMaxWaitTime.
34 35 36 |
# File 'lib/Replication.rb', line 34 def idleMaxWaitTime @idleMaxWaitTime end |
#idleMinWaitTime ⇒ Object
Returns the value of attribute idleMinWaitTime.
34 35 36 |
# File 'lib/Replication.rb', line 34 def idleMinWaitTime @idleMinWaitTime end |
#includeSystem ⇒ Object
Returns the value of attribute includeSystem.
34 35 36 |
# File 'lib/Replication.rb', line 34 def includeSystem @includeSystem end |
#incremental ⇒ Object
Returns the value of attribute incremental.
34 35 36 |
# File 'lib/Replication.rb', line 34 def incremental @incremental end |
#initialSyncMaxWaitTime ⇒ Object
Returns the value of attribute initialSyncMaxWaitTime.
34 35 36 |
# File 'lib/Replication.rb', line 34 def initialSyncMaxWaitTime @initialSyncMaxWaitTime end |
#master ⇒ Object
Returns the value of attribute master.
39 40 41 |
# File 'lib/Replication.rb', line 39 def master @master end |
#maxConnectRetries ⇒ Object
Returns the value of attribute maxConnectRetries.
34 35 36 |
# File 'lib/Replication.rb', line 34 def maxConnectRetries @maxConnectRetries end |
#password ⇒ Object
Returns the value of attribute password.
34 35 36 |
# File 'lib/Replication.rb', line 34 def password @password end |
#requestTimeout ⇒ Object
Returns the value of attribute requestTimeout.
34 35 36 |
# File 'lib/Replication.rb', line 34 def requestTimeout @requestTimeout end |
#requireFromPresent ⇒ Object
Returns the value of attribute requireFromPresent.
34 35 36 |
# File 'lib/Replication.rb', line 34 def requireFromPresent @requireFromPresent end |
#restrictCollections ⇒ Object
Returns the value of attribute restrictCollections.
39 40 41 |
# File 'lib/Replication.rb', line 39 def restrictCollections @restrictCollections end |
#restrictType ⇒ Object
Returns the value of attribute restrictType.
39 40 41 |
# File 'lib/Replication.rb', line 39 def restrictType @restrictType end |
#slave ⇒ Object
Returns the value of attribute slave.
39 40 41 |
# File 'lib/Replication.rb', line 39 def slave @slave end |
#username ⇒ Object
Returns the value of attribute username.
34 35 36 |
# File 'lib/Replication.rb', line 34 def username @username end |
#verbose ⇒ Object
Returns the value of attribute verbose.
34 35 36 |
# File 'lib/Replication.rb', line 34 def verbose @verbose end |
Instance Method Details
#configuration ⇒ Object
173 174 175 |
# File 'lib/Replication.rb', line 173 def configuration @slave.request("GET", "_api/replication/applier-config") end |
#enslave ⇒ Object
ENSLAVING
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/Replication.rb', line 133 def enslave body = { "username": @master_server.username, "password": @master_server.password, "includeSystem": @includeSystem, "endpoint": @server.endpoint, "initialSyncMaxWaitTime": @initialSyncMaxWaitTime, "database": @database.name, "verbose": verbose, "connectTimeout": @connectTimeout, "autoResync": @autoResync, "idleMinWaitTime": @idleMinWaitTime, "requestTimeout": @requestTimeout, "requireFromPresent": @requireFromPresent, "idleMaxWaitTime": @idleMaxWaitTime, "restrictType": @restrictType, "maxConnectRetries": @maxConnectRetries, "adaptivePolling": @adaptivePolling, "connectionRetryWaitTime": @connectionRetryWaitTime, "restrictCollections": @restrictCollections, "autoResyncRetries": @autoResyncRetries, "chunkSize": @chunkSize } @slave.request("PUT", "_api/replication/make-slave", body: body) end |
#logger ⇒ Object
LOGGER
207 208 209 |
# File 'lib/Replication.rb', line 207 def logger @slave.request("GET", "_api/replication/logger-state") end |
#loggerFirstTick ⇒ Object
221 222 223 |
# File 'lib/Replication.rb', line 221 def loggerFirstTick @slave.request("GET", "_api/replication/logger-first-tick", key: :firstTick) end |
#loggerFollow(from: nil, to: nil, chunkSize: nil, includeSystem: nil) ⇒ Object
211 212 213 214 215 216 217 218 219 |
# File 'lib/Replication.rb', line 211 def loggerFollow(from: nil, to: nil, chunkSize: nil, includeSystem: nil) query = { "from": from, "to": to, "chunkSize": chunkSize, "includeSystem": includeSystem } @slave.request("GET", "_api/replication/logger-follow", query: query) end |
#loggerRangeTick ⇒ Object
225 226 227 |
# File 'lib/Replication.rb', line 225 def loggerRangeTick @slave.request("GET", "_api/replication/logger-tick-ranges") end |
#modify ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/Replication.rb', line 177 def modify body = { "username": @master_server.username, "password": @master_server.password, "endpoint": @master_server.endpoint, "database": @master.name, "verbose": @verbose, "autoResync": @autoResync, "autoStart": @autoStart, "chunkSize": @chunkSize, "includeSystem": @includeSystem, "connectTimeout": @connectTimeout, "idleMinWaitTime": @idleMinWaitTime, "requestTimeout": @requestTimeout, "restrictType": @restrictType, "requireFromPresent": @requireFromPresent, "idleMaxWaitTime": @idleMaxWaitTime, "maxConnectRetries": @maxConnectRetries, "adaptivePolling": @adaptivePolling, "initialSyncMaxWaitTime": @initialSyncMaxWaitTime, "connectionRetryWaitTime": @connectionRetryWaitTime, "restrictCollections": @restrictCollections, "autoResyncRetries": @autoResyncRetries } @slave.request("PUT", "_api/replication/applier-config", body: body) end |
#serverId ⇒ Object
SERVER-ID
231 232 233 |
# File 'lib/Replication.rb', line 231 def serverId @slave.request("GET", "_api/replication/server-id", key: :serverId) end |
#start(from: nil) ⇒ Object
REPLICATION
161 162 163 |
# File 'lib/Replication.rb', line 161 def start(from: nil) @slave.request("PUT", "_api/replication/applier-start", query: {from: from}) end |
#state ⇒ Object
169 170 171 |
# File 'lib/Replication.rb', line 169 def state @slave.request("GET", "_api/replication/applier-state") end |
#stop ⇒ Object
165 166 167 |
# File 'lib/Replication.rb', line 165 def stop @slave.request("PUT", "_api/replication/applier-stop") end |
#sync ⇒ Object
SYNCRONISATION
116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/Replication.rb', line 116 def sync body = { "username": @master_server.username, "password": @master_server.password, "endpoint": @master_server.endpoint, "database": @master.name, "restrictType": @restrictType, "incremental": @incremental, "includeSystem": @includeSystem, "restrictCollections": @restrictCollections, "initialSyncMaxWaitTime": @initialSyncMaxWaitTime } @slave.request("PUT", "_api/replication/sync", body: body) end |
#to_h ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/Replication.rb', line 79 def to_h master { "master": { "database": @master.name, "username": @master_server.username, "endpoint": @master_server.endpoint }, "slave": { "database": @slave.name, "username": @slave_server.username, "endpoint": @slave_server.endpoint }, "options": { "includeSytem": @includeSystem, "initialSyncMaxWaitTime": @initialSyncMaxWaitTime, "restrictType": @restrictType, "incremental": @incremental, "restrictCollections": @restrictCollections, "verbose": @verbose, "connectTimeout": @connectTimeout, "autoResync": @autoResync, "idleMinWaitTime": @idleMinWaitTime, "requestTimeout": @requestTimeout, "requireFromPresent": @requireFromPresent, "idleMaxWaitTime": @idleMaxWaitTime, "maxConnectRetries": @maxConnectRetries, "adaptivePolling": @adaptivePolling, "connectionRetryWaitTime": @connectionRetryWaitTime, "autoResyncRetries": @autoResyncRetries, "chunkSize": @chunkSize }.delete_if{|k,v| v.nil?} } end |