Talk:Peerd

From Organic Design wiki
  1. Immediate development notes
  • array aspect needs to be unified with hash access using next/prev associations because many orthogonal lists must be able to exist in the same context.
    • This method matches list-space more closely too, using PERL's own array methods was merely a convenience.
    • This method also matches peer.as because ECMA's array and hash syntax can't be used for this anyway as it failed the key-as-hashref test.
This change is not necessary as multiple lists are just multiple associations (such as x,y,z) which each has a single list aspect,
and the SWF can return an array-ref for the list aspect just like PERL does.
  1. +Wikid & peerd
  1. Hash-Tables & Associative Arrays

The idea of variables is absolutely fundamentle to computer programming; essentially it is the idea of assigning an identity to a changable value so that it can be referred to for accessing and changing throughout time.

The idea of variables alone can get "messy" when used to construct models of real systems because in reality systems are complex and recursive. A hash table extends the simple idea of associating identifiers with values by adding the concept of containment (hierarchy). A hash-table is itself a variable, but its value is a list of identifer-value pairs (the identifiers are called keys). Hash-tables can of course work recursively since any value could be another hash-table.

Hash-tables allow programs to structure their data in a very organised way, like a directory structure for files. Since hash-tables offer such a high level of organisation to a program's data, it is often easy to use a single hash-table for all the data needs, and almost forget about free-standing variables all together.

Note that the term "hash table" is actually a specific implementation of this concept using hashing-algorithms as part of its internal data structure. Some more general terms which describe this key/value kind of functionality are associative array and Dictionary. In the strict implementation of the Nodal model, the associative-array functionality does not use hashing, but rather uses a tree in which each node uses the binary sequence of its global integer index as the path of its location in the tree. This kind of tree which is formed of such sequences is called a prefix tree or Trie.

The current implementation of the Nodal model is an extention of PERL's native hash-table functionality which has been done for simplicity of development. A binary-Trie offers far superior performance to hash-tables in terms of both space and time within the context of the Nodal methodology.

    1. Keys & References

todo: note about hashrefs as keys

  1. Persistence

Since all the program's data is somewhere within the same unified hash-table, it means that all persistence (saving and loading of data) can be handled by a single function. Most languages allow their native hash-table functionality to be extended to allow transparent persistence.

  1. Distributed Hash-Tables

The next logical step in making the hash-table useful to a broader context is to make it a shared data structure accessible by many clients. Again this can be done transparently so that from the programs perspective it's dealt with as a normal local hash-table using the usual syntax. This makes the hash-table very powerful, it unifies the local data-structure with a network-filing-system functionality.

  1. Computational Spaces & Reduction

A computational space is a global environment into which queues of tasks can be placed. The tasks are designed to be able to be broken down into many smaller parts which can be processed in parallel by separate entities. Processors can be arbitrarily added or removed from the space and don't need to communicate with each other, they can remove items from the space which need processing, process them and then return them to the space in an updated form.

This abstraction of processors from tasks effectively allows the design of networks which contain both information and processing ability. The nodes of the network are offering both space and processing resource to the network. The network then distributes the information and tasks across the available storage and processing resources.

The processing of tasks in such a space is often called reduction because it has the effect of reducing the queues of tasks.

    1. n-Torus Geometry

When the nodal model is based on List Space instead of the less fundamental hash-table approach, the queue's are circular having no start or end. This is because in list-space every item in a queue has links to the previous and next, items can be inserted or removed, but there is no numerical index on which to relate the idea of a start or end.

Since the items in a queue (loop) can also be loops, the overall geometry of a nodal reduction-tree is an n-Torus. In an n-Torus, each radius scribes a circle in the next higher dimension which is orthogonal relative to the last and the next.

    1. Space & Time

There are two "applications" in the root context which each receive 50% of the quanta, space (propagation of change) and time (reduction). In this way the domain of change is receiving the odd-numbered quanta, and that of space receives the even-numbered quanta.

  1. PERL Hash-Tables

The PERL hash syntax uses curly braces, eg: $myHash{foo} = 'bar'. If the hash values are also hashes, then a tree is formed. The syntax for accessing a hash tree ("walking" the hash) is simple: $myHash{foo}{bar} = 'baz'. In PERL5 hashes can be tied which allows the inherent hash functionality to be extended while still using the usual syntax. Peerd uses tie to make a new kind of hash called NodalHash which is has the following additional features:

  • Distributed Persistence
  • Events (onChange, onAccess)
  • Reduction (each node has a scheduled queue and history)
  1. peerd: Distributed Reducing Hash Table

Now we're in a position to talk about what the peer does. The peer itself is not really an application which is dealt with directly, but rather a daemon or service which runs in the background responding to various requests. The basic job of all the peers is to maintain a Distributed Reducing Hash Table by offering a portion of the local processing resource to Nodal Reduction.

  • NOTE: the term Hash-Table within the context of the nodal model is merely referring to the concept of its use. Although peerd is built by extending PERL's own hash-table functionality, the final version will be based on ListSpace which does not use any hashing algorithms internally to achieve its distributed key-value functionality.
    1. HUSK

The actual executable script which is downloaded and run to instantiate a peer daemon/service is called the Husk. It is the minimum code necessary for the peer to connect to other peers and obtain further functionality.

    1. +Nodal Runtime
  1. Notes

peerd is now the main script for the peer daemon/service. The snipits are being moved into the main nodal structure and are therefore handled by nodal reduction instead of the declare() subroutine.


The currently running public peer is at www.organicdesign.co.nz:1729 and is an instance on wikid.pl. peerd is in the debugging phase at the moment and not able to run persistently.

  1. Conceptual Questions & Issues
  • MW1.6 uses a job-queue model to allow many articles categorisation to be updated when cat links in a template change and affect many other articles. How does the peer deal with this?

See Also