Basic Architecture

The moniker “Distributed Data Structure” is perhaps somewhat incorrect in reference to the Shared Dictionary – as we have seen, it is a copied centralized data structure that receives and sends updates made to it. Each instance of the data structure contains complete data for every entry that it subscribes to.

When a client requests a value from the dictionary, it gets it from the local copy of the dictionary.

When a client changes a value in the dictionary, that change is immediately made locally. The change is then place in a queue of information to be sent to the server. When the server receives this update, it changes its value for that entry and sends the new value out to the subscribers.

Similar things happen when entries are added or removed. When a client adds an entry to the dictionary (sets a value for a path that does not exist) to a server, it first adds the object locally (generating a notification location), then sends the new entry to the server. The server adds this entry to its dictionary and then sends this new value to all clients who subscribe to a pattern that includes the new entry. These clients, in turn, generate notification messages.

Notifications are not sent over the wire; rather, they are generated locally by clients when an entry in their dictionary is updated or added. The event is not actually invoked immediately, however – events are placed in a queue and drained when the thread assigned to them has time to process them. This is unlikely to cause any noticeable disconnect between receiving data and the notification of the change in data.