with-mirroring-enabledStreamingwrite-streamer-queuewith-queued-streamingGoTo Top

with-queued-streaming   (streamer [tag [write-empty-queue-p]]) form* => result*[Macro]

Queue streaming during evaluation of forms.

Package   :gbbopen

Module   :streaming

Arguments and values

streamer     A streamer
tag     An object (default is nil)
write-empty-queue-p     A generalized boolean (default is nil)
forms     An implicit progn of forms to be evaluated
results     The values returned by evaluating the last form

The values returned by evaluating the last form.

Instead of writing changes directly to a streamer's journal file or network connection, the changes are queued until the last form has been evaluated. Then the queued changes are written as a block that is marked with the tag value. Queued streaming is thread-local (so different threads can have their own open queues at the same time) and with-queued-streaming forms can be nested within a single thread.

If the value of write-empty-queue-p is true, the streamer queue is written even if it is empty (and read-queued-streaming-block will be called with the tag value when the empty queue is received at a streamer node or read during journal loading).

See also

Assuming that hyp  unit instances are being mirrored to streamer *streamer*, queue the mirroring of a created hyp tagged with the space instance (bb hyps):

  > (with-queued-streaming (*streamer* (find-space-instance-by-path '(bb hyps)))
       (make-instance 'hyp 
          :location (list x y)
          :classification '(:car :truck)
          :color ':red
          :belief .85
          :velocity-range '(5 35)
          :supporting-hyps supporting-hyps))
  #<hyp 419 (1835 4791) 0.85 [5..35]>

Write an empty queue (with tag :empty) to streamer *streamer*:

  > (with-queued-streaming (*streamer* ':empty 't))

The GBBopen Project

with-mirroring-enabledStreamingwrite-streamer-queuewith-queued-streamingGoTo Top