AsynchronousUpdates

From ParaQ Wiki
Revision as of 13:02, 2 December 2005 by Tshead (talk | contribs)
Jump to navigationJump to search

Rough Draft ...

Requirements

  • When multiple clients are connected to a server, ensure that server state changes are propagated to all clients so they remain in-sync.
  • Ensure that user interfaces remain responsive at all times.
  • Avoid multithreading, see ThreadedGUI.

Use Cases

  • Two-or-more clients are connected to a server. Client "A" makes a change to the server state. Client "B", et al, are notified of the change.
  • A client with a graphical user interface is connected to a server. The client initiates a time-consuming recalculation of the visualization network. The call to the server should return immediately, and the client should be notified asynchronously as calculation progresses and when the calculations are complete.

Design

VTK already provides a straightforward implementation of Observer Design Pattern, using derivatives of the vtkCommand class, plus methods of vtkObject. The ParaView Server Manager can easily expose an API based on vtkCommand that will allow clients to register observers for server events.

To maintain the responsiveness of graphical user interfaces on the client, the client's event loop must be allowed to run continuously. At the same time, the server manager must also be allowed to run frequently, so that it can handle I/O with connected servers and emit asyncronous events. To accomplish this, the server manager will expose an API function that is called periodically by the client. This function can be called in an idle handler or by a timer, allowing the UI to remain responsive to user input. This assumes that the server manager is coded so that commands issued by the client return immediately.

Implementation

  • The set of events enumerated in vtkCommand::EventIds will have to be expanded to include events appropriate to the server manager:
    • ProxyAdded
    • ProxyDeleted
    • PropertyValueChanged
    • PropertyDomainChanged
    • PropertyConnected
    • PropertyDisconnected
    • RenderStarted
    • RenderProgress
    • RenderComplete
  • The server manager provides objects where observers can register to receive events, either:
    • A single server manager object that emits events on behalf of all servers/proxies/etc
    • A per-server object that emits events on behalf of all proxies/etc for that server
    • Proxies/etc emit their own events
  • The server manager provides a method clients call periodically, either:
    • A single server manager function that allows the server manager to process I/O and events for all connected servers
    • Per-server functions that allow the server manager to process I/O and events for individual connected servers