Class: Arango::Replication
- Inherits:
-
Object
- Object
- Arango::Replication
- Includes:
- Helper_Error
- 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 (also: #modifyReplication)
-
#serverId ⇒ Object
SERVER-ID.
-
#start(from: nil) ⇒ Object
REPLICATION.
- #state ⇒ Object
- #stop ⇒ Object
-
#sync ⇒ Object
SYNCRONISATION.
- #to_h ⇒ Object
Methods included from Helper_Error
#satisfy_category?, #satisfy_class?, #warning_deprecated
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.
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 33 34 |
# File 'lib/Replication.rb', line 7 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.
36 37 38 |
# File 'lib/Replication.rb', line 36 def adaptivePolling @adaptivePolling end |
#autoResync ⇒ Object
Returns the value of attribute autoResync.
36 37 38 |
# File 'lib/Replication.rb', line 36 def autoResync @autoResync end |
#autoResyncRetries ⇒ Object
Returns the value of attribute autoResyncRetries.
36 37 38 |
# File 'lib/Replication.rb', line 36 def autoResyncRetries @autoResyncRetries end |
#chunkSize ⇒ Object
Returns the value of attribute chunkSize.
36 37 38 |
# File 'lib/Replication.rb', line 36 def chunkSize @chunkSize end |
#connectionRetryWaitTime ⇒ Object
Returns the value of attribute connectionRetryWaitTime.
36 37 38 |
# File 'lib/Replication.rb', line 36 def connectionRetryWaitTime @connectionRetryWaitTime end |
#connectTimeout ⇒ Object
Returns the value of attribute connectTimeout.
36 37 38 |
# File 'lib/Replication.rb', line 36 def connectTimeout @connectTimeout end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
36 37 38 |
# File 'lib/Replication.rb', line 36 def endpoint @endpoint end |
#idleMaxWaitTime ⇒ Object
Returns the value of attribute idleMaxWaitTime.
36 37 38 |
# File 'lib/Replication.rb', line 36 def idleMaxWaitTime @idleMaxWaitTime end |
#idleMinWaitTime ⇒ Object
Returns the value of attribute idleMinWaitTime.
36 37 38 |
# File 'lib/Replication.rb', line 36 def idleMinWaitTime @idleMinWaitTime end |
#includeSystem ⇒ Object
Returns the value of attribute includeSystem.
36 37 38 |
# File 'lib/Replication.rb', line 36 def includeSystem @includeSystem end |
#incremental ⇒ Object
Returns the value of attribute incremental.
36 37 38 |
# File 'lib/Replication.rb', line 36 def incremental @incremental end |
#initialSyncMaxWaitTime ⇒ Object
Returns the value of attribute initialSyncMaxWaitTime.
36 37 38 |
# File 'lib/Replication.rb', line 36 def initialSyncMaxWaitTime @initialSyncMaxWaitTime end |
#master ⇒ Object
Returns the value of attribute master.
41 42 43 |
# File 'lib/Replication.rb', line 41 def master @master end |
#maxConnectRetries ⇒ Object
Returns the value of attribute maxConnectRetries.
36 37 38 |
# File 'lib/Replication.rb', line 36 def maxConnectRetries @maxConnectRetries end |
#password ⇒ Object
Returns the value of attribute password.
36 37 38 |
# File 'lib/Replication.rb', line 36 def password @password end |
#requestTimeout ⇒ Object
Returns the value of attribute requestTimeout.
36 37 38 |
# File 'lib/Replication.rb', line 36 def requestTimeout @requestTimeout end |
#requireFromPresent ⇒ Object
Returns the value of attribute requireFromPresent.
36 37 38 |
# File 'lib/Replication.rb', line 36 def requireFromPresent @requireFromPresent end |
#restrictCollections ⇒ Object
Returns the value of attribute restrictCollections.
41 42 43 |
# File 'lib/Replication.rb', line 41 def restrictCollections @restrictCollections end |
#restrictType ⇒ Object
Returns the value of attribute restrictType.
41 42 43 |
# File 'lib/Replication.rb', line 41 def restrictType @restrictType end |
#slave ⇒ Object
Returns the value of attribute slave.
41 42 43 |
# File 'lib/Replication.rb', line 41 def slave @slave end |
#username ⇒ Object
Returns the value of attribute username.
36 37 38 |
# File 'lib/Replication.rb', line 36 def username @username end |
#verbose ⇒ Object
Returns the value of attribute verbose.
36 37 38 |
# File 'lib/Replication.rb', line 36 def verbose @verbose end |
Instance Method Details
#configuration ⇒ Object
175 176 177 |
# File 'lib/Replication.rb', line 175 def configuration @slave.request("GET", "_api/replication/applier-config") end |
#enslave ⇒ Object
ENSLAVING
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/Replication.rb', line 135 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
209 210 211 |
# File 'lib/Replication.rb', line 209 def logger @slave.request("GET", "_api/replication/logger-state") end |
#loggerFirstTick ⇒ Object
223 224 225 |
# File 'lib/Replication.rb', line 223 def loggerFirstTick @slave.request("GET", "_api/replication/logger-first-tick", key: :firstTick) end |
#loggerFollow(from: nil, to: nil, chunkSize: nil, includeSystem: nil) ⇒ Object
213 214 215 216 217 218 219 220 221 |
# File 'lib/Replication.rb', line 213 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
227 228 229 |
# File 'lib/Replication.rb', line 227 def loggerRangeTick @slave.request("GET", "_api/replication/logger-tick-ranges") end |
#modify ⇒ Object Also known as: modifyReplication
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/Replication.rb', line 179 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
233 234 235 |
# File 'lib/Replication.rb', line 233 def serverId @slave.request("GET", "_api/replication/server-id", key: :serverId) end |
#start(from: nil) ⇒ Object
REPLICATION
163 164 165 |
# File 'lib/Replication.rb', line 163 def start(from: nil) @slave.request("PUT", "_api/replication/applier-start", query: {from: from}) end |
#state ⇒ Object
171 172 173 |
# File 'lib/Replication.rb', line 171 def state @slave.request("GET", "_api/replication/applier-state") end |
#stop ⇒ Object
167 168 169 |
# File 'lib/Replication.rb', line 167 def stop @slave.request("PUT", "_api/replication/applier-stop") end |
#sync ⇒ Object
SYNCRONISATION
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/Replication.rb', line 118 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
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 113 114 |
# File 'lib/Replication.rb', line 81 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 |