Class: Quark::Mdk::Session

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/mdk.rb

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initializeSession

Returns a new instance of Session.



292
293
294
295
296
# File 'lib/mdk.rb', line 292

def initialize()
    self.__init_fields__

    nil
end

Instance Method Details

#__init_fields__Object



571
572
573
574
575
# File 'lib/mdk.rb', line 571

def __init_fields__()
    

    nil
end

#critical(category, text) ⇒ Object

Record a log entry at the CRITICAL logging level.

Raises:

  • (NotImplementedError)


322
323
324
325
326
# File 'lib/mdk.rb', line 322

def critical(category, text)
    raise NotImplementedError, '`Session.critical` is an abstract method'

    nil
end

#debug(category, text) ⇒ Object

Record a log entry at the DEBUG logging level.

Raises:

  • (NotImplementedError)


358
359
360
361
362
# File 'lib/mdk.rb', line 358

def debug(category, text)
    raise NotImplementedError, '`Session.debug` is an abstract method'

    nil
end

#error(category, text) ⇒ Object

Record a log entry at the ERROR logging level.

Raises:

  • (NotImplementedError)


331
332
333
334
335
# File 'lib/mdk.rb', line 331

def error(category, text)
    raise NotImplementedError, '`Session.error` is an abstract method'

    nil
end

#externalizeObject

Returns an externalized representation of the distributed session.

Raises:

  • (NotImplementedError)


313
314
315
316
317
# File 'lib/mdk.rb', line 313

def externalize()
    raise NotImplementedError, '`Session.externalize` is an abstract method'

    nil
end

#fail_interaction(message) ⇒ Object

Record an interaction as failed.

This will update circuit breaker state for the remote nodes, as well as reporting all nodes involved to the tracing system.

Raises:

  • (NotImplementedError)


454
455
456
457
458
# File 'lib/mdk.rb', line 454

def fail_interaction(message)
    raise NotImplementedError, '`Session.fail_interaction` is an abstract method'

    nil
end

#finish_interactionObject

Finish an interaction.

This marks an interaction as completed.

Raises:

  • (NotImplementedError)


466
467
468
469
470
# File 'lib/mdk.rb', line 466

def finish_interaction()
    raise NotImplementedError, '`Session.finish_interaction` is an abstract method'

    nil
end

#getEnvironmentObject

Return the session’s Environment.

Raises:

  • (NotImplementedError)


565
566
567
568
569
# File 'lib/mdk.rb', line 565

def getEnvironment()
    raise NotImplementedError, '`Session.getEnvironment` is an abstract method'

    nil
end

#getProperty(property) ⇒ Object

Return the value of a property from the distributed session.

Raises:

  • (NotImplementedError)


531
532
533
534
535
# File 'lib/mdk.rb', line 531

def getProperty(property)
    raise NotImplementedError, '`Session.getProperty` is an abstract method'

    nil
end

#getRemainingTimeObject

Return how many seconds until the session ought to end.

This will only be accurate across multiple servers insofar as their clocks are in sync.

If a timeout has not been set the result will be null.

Raises:

  • (NotImplementedError)


522
523
524
525
526
# File 'lib/mdk.rb', line 522

def getRemainingTime()
    raise NotImplementedError, '`Session.getRemainingTime` is an abstract method'

    nil
end

#hasProperty(property) ⇒ Object

Return whether the distributed session has a property.

Raises:

  • (NotImplementedError)


556
557
558
559
560
# File 'lib/mdk.rb', line 556

def hasProperty(property)
    raise NotImplementedError, '`Session.hasProperty` is an abstract method'

    nil
end

#info(category, text) ⇒ Object

Record a log entry at the INFO logging level.

Raises:

  • (NotImplementedError)


349
350
351
352
353
# File 'lib/mdk.rb', line 349

def info(category, text)
    raise NotImplementedError, '`Session.info` is an abstract method'

    nil
end

#injectObject

Grabs the encoded context.

Raises:

  • (NotImplementedError)


304
305
306
307
308
# File 'lib/mdk.rb', line 304

def inject()
    raise NotImplementedError, '`Session.inject` is an abstract method'

    nil
end

#interact(callable) ⇒ Object

This is a convenience API that will perform start_interaction() followed by callable(ssn) followed by finish_interaction().

Raises:

  • (NotImplementedError)


479
480
481
482
483
# File 'lib/mdk.rb', line 479

def interact(callable)
    raise NotImplementedError, '`Session.interact` is an abstract method'

    nil
end

#resolve(service, version) ⇒ Object

Locate a compatible service instance.

Uses a minimum of 10 seconds and the timeout set on the session.

Raises:

  • (NotImplementedError)


396
397
398
399
400
# File 'lib/mdk.rb', line 396

def resolve(service, version)
    raise NotImplementedError, '`Session.resolve` is an abstract method'

    nil
end

#resolve_async(service, version) ⇒ Object

Locate a compatible service instance asynchronously. The result is returned as a promise.

Raises:

  • (NotImplementedError)


416
417
418
419
420
# File 'lib/mdk.rb', line 416

def resolve_async(service, version)
    raise NotImplementedError, '`Session.resolve_async` is an abstract method'

    nil
end

#resolve_until(service, version, timeout) ⇒ Object

Locate a compatible service instance with a non-default timeout.

Raises:

  • (NotImplementedError)


406
407
408
409
410
# File 'lib/mdk.rb', line 406

def resolve_until(service, version, timeout)
    raise NotImplementedError, '`Session.resolve_until` is an abstract method'

    nil
end

#route(service, version, target, targetVersion) ⇒ Object

EXPERIMENTAL; requires MDK_EXPERIMENTAL=1 environment variable to function.

Override service resolution for the current distributed session. All attempts to resolve service, version will be replaced with an attempt to resolve target, targetVersion. This effect will be propogated to any downstream services involved in the distributed session.

Raises:

  • (NotImplementedError)


384
385
386
387
388
# File 'lib/mdk.rb', line 384

def route(service, version, target, targetVersion)
    raise NotImplementedError, '`Session.route` is an abstract method'

    nil
end

#setDeadline(seconds) ⇒ Object

Set how many seconds the session is expected to live from this point.

If a timeout has previously been set the new timeout will only be used if it is lower than the existing timeout.

The MDK will not enforce the timeout. Rather, it provides the information to any process or server in the same session (even if they are on different machines). By passing this timeout to blocking APIs you can ensure timeouts are enforced across a whole distributed session.

Raises:

  • (NotImplementedError)


498
499
500
501
502
# File 'lib/mdk.rb', line 498

def setDeadline(seconds)
    raise NotImplementedError, '`Session.setDeadline` is an abstract method'

    nil
end

#setProperty(property, value) ⇒ Object

Set a property on the distributed session.

The key should be prefixed with a namespace so that it doesn’t conflict with built-in properties, e.g. ‘examplenamespace:myproperty’ instead of ‘myproperty’.

The value should be JSON serializable.

Raises:

  • (NotImplementedError)


547
548
549
550
551
# File 'lib/mdk.rb', line 547

def setProperty(property, value)
    raise NotImplementedError, '`Session.setProperty` is an abstract method'

    nil
end

#setTimeout(seconds) ⇒ Object

DEPRECATED, use setDeadline().

Raises:

  • (NotImplementedError)


507
508
509
510
511
# File 'lib/mdk.rb', line 507

def setTimeout(seconds)
    raise NotImplementedError, '`Session.setTimeout` is an abstract method'

    nil
end

#start_interactionObject

Start an interaction with a remote service.

The session tracks any nodes resolved during an interactin with a remote service.

The service resolution API permits a compatible instance of the service to be located. In addition, it tracks which exact instances are in use during any interaction. Should the interaction fail, circuit breaker state is updated for those nodes, and all involved instances involved are reported to the tracing services.

This permits realtime reporting of integration issues when services are updated, and also allows circuit breakers to mitigate the impact of any such issues.

Raises:

  • (NotImplementedError)


440
441
442
443
444
# File 'lib/mdk.rb', line 440

def start_interaction()
    raise NotImplementedError, '`Session.start_interaction` is an abstract method'

    nil
end

#trace(level) ⇒ Object

EXPERIMENTAL: Set the logging level for the session.

Raises:

  • (NotImplementedError)


367
368
369
370
371
# File 'lib/mdk.rb', line 367

def trace(level)
    raise NotImplementedError, '`Session.trace` is an abstract method'

    nil
end

#warn(category, text) ⇒ Object

Record a log entry at the WARN logging level.

Raises:

  • (NotImplementedError)


340
341
342
343
344
# File 'lib/mdk.rb', line 340

def warn(category, text)
    raise NotImplementedError, '`Session.warn` is an abstract method'

    nil
end