Class: Quark::Mdk::MDK

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

#initializeMDK

Returns a new instance of MDK.



110
111
112
113
114
# File 'lib/mdk.rb', line 110

def initialize()
    self.__init_fields__

    nil
end

Instance Method Details

#__init_fields__Object



229
230
231
232
233
# File 'lib/mdk.rb', line 229

def __init_fields__()
    

    nil
end

#derive(encodedContext) ⇒ Object

Create a new Session. The given encoded distributed session’s properties will be used to configure the new Session, e.g. overrides will be preserved. However, because this is a new Session the timeout will not be copied from the encoded session.

This is intended for use for encoded context received via a broadcast medium (pub/sub, message queues with multiple readers, etc.). If you know only you received the encoded context, e.g. you’re coding a server that receives the context from a HTTP request, you should join() instead.

Raises:

  • (NotImplementedError)


223
224
225
226
227
# File 'lib/mdk.rb', line 223

def derive(encodedContext)
    raise NotImplementedError, '`MDK.derive` is an abstract method'

    nil
end

#join(encodedContext) ⇒ Object

Create a new Session and join it to an existing distributed sesion.

This should only ever be done once per an encoded context. That means you should only use it for RPC or similar one-off calls. If you received the encoded context via a broadcast medium (pub/sub, message queues with multiple readers, etc.) you should use childSession() instead.

Raises:

  • (NotImplementedError)


204
205
206
207
208
# File 'lib/mdk.rb', line 204

def join(encodedContext)
    raise NotImplementedError, '`MDK.join` is an abstract method'

    nil
end

#register(service, version, address) ⇒ Object

Registers a service endpoint with the discovery system. This can be called at any point, however registered endpoints will not be advertised to the discovery system until the MDK is started.

Raises:

  • (NotImplementedError)


151
152
153
154
155
# File 'lib/mdk.rb', line 151

def register(service, version, address)
    raise NotImplementedError, '`MDK.register` is an abstract method'

    nil
end

#sessionObject

Creates a new Session. A Session created in this way will result in a new distributed trace. This should therefore be used primarily by edge services. Intermediary and foundational services should make use of join(encodedContext) in order to preserve distributed traces.

Raises:

  • (NotImplementedError)


188
189
190
191
192
# File 'lib/mdk.rb', line 188

def session()
    raise NotImplementedError, '`MDK.session` is an abstract method'

    nil
end

#setDefaultDeadline(seconds) ⇒ Object

Set the default timeout for MDK sessions.

This is the maximum timeout; if a joined session has a lower timeout that will be used.

Raises:

  • (NotImplementedError)


164
165
166
167
168
# File 'lib/mdk.rb', line 164

def setDefaultDeadline(seconds)
    raise NotImplementedError, '`MDK.setDefaultDeadline` is an abstract method'

    nil
end

#setDefaultTimeout(seconds) ⇒ Object

DEPRECATED, use setDefaultDeadline().

Raises:

  • (NotImplementedError)


173
174
175
176
177
# File 'lib/mdk.rb', line 173

def setDefaultTimeout(seconds)
    raise NotImplementedError, '`MDK.setDefaultTimeout` is an abstract method'

    nil
end

#startObject

Start the MDK. An MDK instance will not communicate with foundational services unless it is started.

Raises:

  • (NotImplementedError)


124
125
126
127
128
# File 'lib/mdk.rb', line 124

def start()
    raise NotImplementedError, '`MDK.start` is an abstract method'

    nil
end

#stopObject

Stop the MDK. When the MDK stops unregisters any service endpoints from the discovery system. This should always be done prior to process exit in order to propogate node shutdowns in realtime rather than waiting for heartbeats to detect node departures.

Raises:

  • (NotImplementedError)


138
139
140
141
142
# File 'lib/mdk.rb', line 138

def stop()
    raise NotImplementedError, '`MDK.stop` is an abstract method'

    nil
end