Class: Quark::MdkTracing::Protocol::TracingClient
- Inherits:
-
DatawireQuarkCore::QuarkObject
- Object
- DatawireQuarkCore::QuarkObject
- Quark::MdkTracing::Protocol::TracingClient
- Extended by:
- DatawireQuarkCore::Static
- Defined in:
- lib/mdk_tracing/protocol.rb
Constant Summary
Constants included from DatawireQuarkCore::Static
DatawireQuarkCore::Static::Unassigned
Instance Attribute Summary collapse
-
#_dispatcher ⇒ Object
Returns the value of attribute _dispatcher.
-
#_handler ⇒ Object
Returns the value of attribute _handler.
-
#_mutex ⇒ Object
Returns the value of attribute _mutex.
-
#_sendWithAcks ⇒ Object
Returns the value of attribute _sendWithAcks.
-
#_sock ⇒ Object
Returns the value of attribute _sock.
-
#_started ⇒ Object
Returns the value of attribute _started.
-
#_tracer ⇒ Object
Returns the value of attribute _tracer.
-
#_wsclient ⇒ Object
Returns the value of attribute _wsclient.
Instance Method Summary collapse
- #__init_fields__ ⇒ Object
- #_getClass ⇒ Object
- #_getField(name) ⇒ Object
- #_setField(name, value) ⇒ Object
-
#initialize(tracer, wsclient) ⇒ TracingClient
constructor
A new instance of TracingClient.
-
#log(evt) ⇒ Object
Queue a log message for delivery to the server.
- #onLogAck(ack) ⇒ Object
- #onLogEvent(evt) ⇒ Object
- #onMessage(origin, message) ⇒ Object
- #onMessageFromServer(message) ⇒ Object
- #onPump ⇒ Object
- #onStart(dispatcher) ⇒ Object
- #onStop ⇒ Object
- #onWSConnected(websock) ⇒ Object
-
#subscribe(handler) ⇒ Object
Attach a subscriber that will receive results of queries.
Methods included from DatawireQuarkCore::Static
_lazy_statics, static, unlazy_statics
Methods inherited from DatawireQuarkCore::QuarkObject
Constructor Details
#initialize(tracer, wsclient) ⇒ TracingClient
Returns a new instance of TracingClient.
279 280 281 282 283 284 285 286 287 288 |
# File 'lib/mdk_tracing/protocol.rb', line 279 def initialize(tracer, wsclient) self.__init_fields__ @_tracer = tracer @_wsclient = wsclient @_sendWithAcks = ::Quark.mdk_protocol.SendWithAcks.new() wsclient.subscribe(self) nil end |
Instance Attribute Details
#_dispatcher ⇒ Object
Returns the value of attribute _dispatcher.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _dispatcher @_dispatcher end |
#_handler ⇒ Object
Returns the value of attribute _handler.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _handler @_handler end |
#_mutex ⇒ Object
Returns the value of attribute _mutex.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _mutex @_mutex end |
#_sendWithAcks ⇒ Object
Returns the value of attribute _sendWithAcks.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _sendWithAcks @_sendWithAcks end |
#_sock ⇒ Object
Returns the value of attribute _sock.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _sock @_sock end |
#_started ⇒ Object
Returns the value of attribute _started.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _started @_started end |
#_tracer ⇒ Object
Returns the value of attribute _tracer.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _tracer @_tracer end |
#_wsclient ⇒ Object
Returns the value of attribute _wsclient.
272 273 274 |
# File 'lib/mdk_tracing/protocol.rb', line 272 def _wsclient @_wsclient end |
Instance Method Details
#__init_fields__ ⇒ Object
465 466 467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/mdk_tracing/protocol.rb', line 465 def __init_fields__() self._tracer = nil self._started = false self._mutex = ::DatawireQuarkCore::Lock.new() self._handler = nil self._dispatcher = nil self._wsclient = nil self._sock = nil self._sendWithAcks = nil nil end |
#_getClass ⇒ Object
397 398 399 400 401 402 |
# File 'lib/mdk_tracing/protocol.rb', line 397 def _getClass() return "mdk_tracing.protocol.TracingClient" nil end |
#_getField(name) ⇒ Object
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/mdk_tracing/protocol.rb', line 404 def _getField(name) if ((name) == ("_tracer")) return (self)._tracer end if ((name) == ("_started")) return (self)._started end if ((name) == ("_mutex")) return (self)._mutex end if ((name) == ("_handler")) return (self)._handler end if ((name) == ("_dispatcher")) return (self)._dispatcher end if ((name) == ("_wsclient")) return (self)._wsclient end if ((name) == ("_sock")) return (self)._sock end if ((name) == ("_sendWithAcks")) return (self)._sendWithAcks end return nil nil end |
#_setField(name, value) ⇒ Object
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/mdk_tracing/protocol.rb', line 435 def _setField(name, value) if ((name) == ("_tracer")) (self)._tracer = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_tracing.Tracer } end if ((name) == ("_started")) (self)._started = ::DatawireQuarkCore.cast(value) { ::Object } end if ((name) == ("_mutex")) (self)._mutex = ::DatawireQuarkCore.cast(value) { ::DatawireQuarkCore::Lock } end if ((name) == ("_handler")) (self)._handler = ::DatawireQuarkCore.cast(value) { ::Quark.quark.UnaryCallable } end if ((name) == ("_dispatcher")) (self)._dispatcher = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.actors.MessageDispatcher } end if ((name) == ("_wsclient")) (self)._wsclient = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_protocol.WSClient } end if ((name) == ("_sock")) (self)._sock = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.actors.Actor } end if ((name) == ("_sendWithAcks")) (self)._sendWithAcks = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_protocol.SendWithAcks } end nil end |
#log(evt) ⇒ Object
Queue a log message for delivery to the server.
388 389 390 391 392 393 394 395 |
# File 'lib/mdk_tracing/protocol.rb', line 388 def log(evt) @_mutex.acquire() (self)._sendWithAcks.send(::Quark.mdk_tracing.protocol.LogEvent._json_type, evt) @_mutex.release() nil end |
#onLogAck(ack) ⇒ Object
376 377 378 379 380 381 382 383 |
# File 'lib/mdk_tracing/protocol.rb', line 376 def onLogAck(ack) @_mutex.acquire() (self)._sendWithAcks.onAck((ack).sequence) @_mutex.release() nil end |
#onLogEvent(evt) ⇒ Object
365 366 367 368 369 370 371 372 373 374 |
# File 'lib/mdk_tracing/protocol.rb', line 365 def onLogEvent(evt) @_mutex.acquire() if ((@_handler) != (nil)) (@_handler).call(evt) end @_mutex.release() nil end |
#onMessage(origin, message) ⇒ Object
319 320 321 322 323 324 |
# File 'lib/mdk_tracing/protocol.rb', line 319 def onMessage(origin, ) ::Quark.mdk_protocol._subscriberDispatch(self, ) nil end |
#onMessageFromServer(message) ⇒ Object
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/mdk_tracing/protocol.rb', line 348 def onMessageFromServer() type = (::Quark.quark.reflect.QuarkClass.get(::DatawireQuarkCore._getClass())).id if ((type) == ("mdk_tracing.protocol.LogEvent")) event = ::DatawireQuarkCore.cast() { ::Quark.mdk_tracing.protocol.LogEvent } self.onLogEvent(event) return end if ((type) == ("mdk_tracing.protocol.LogAck")) ack = ::DatawireQuarkCore.cast() { ::Quark.mdk_tracing.protocol.LogAck } self.onLogAck(ack) return end nil end |
#onPump ⇒ Object
339 340 341 342 343 344 345 346 |
# File 'lib/mdk_tracing/protocol.rb', line 339 def onPump() @_mutex.acquire() (self)._sendWithAcks.onPump(::Quark.mdk_protocol.WSSend.new(self, (self)._dispatcher, (self)._sock)) @_mutex.release() nil end |
#onStart(dispatcher) ⇒ Object
305 306 307 308 309 310 |
# File 'lib/mdk_tracing/protocol.rb', line 305 def onStart(dispatcher) (self)._dispatcher = dispatcher nil end |
#onStop ⇒ Object
312 313 314 315 316 317 |
# File 'lib/mdk_tracing/protocol.rb', line 312 def onStop() nil nil end |
#onWSConnected(websock) ⇒ Object
326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/mdk_tracing/protocol.rb', line 326 def onWSConnected(websock) @_mutex.acquire() (self)._sock = websock if ((@_handler) != (nil)) (self)._dispatcher.tell(self, ::Quark.mdk_tracing.protocol.Subscribe.new().encode(), (self)._sock) end (self)._sendWithAcks.onConnected(::Quark.mdk_protocol.WSSend.new(self, (self)._dispatcher, (self)._sock)) @_mutex.release() nil end |
#subscribe(handler) ⇒ Object
Attach a subscriber that will receive results of queries.
296 297 298 299 300 301 302 303 |
# File 'lib/mdk_tracing/protocol.rb', line 296 def subscribe(handler) @_mutex.acquire() @_handler = handler @_mutex.release() nil end |