salt/doc/topics/transports/raet/programming_intro.rst
Thomas S Hatch 58829cda49 Initial, very dirty, docs on RAET
I need to push where I am here, but I am out of time today to get more
in.

RAET works! Albeit just barely, it is very KDE 4.0, still
needs much work, but we want it in the hands of the people!
2014-03-21 15:10:03 -06:00

40 lines
1.4 KiB
ReStructuredText

=========================
Intro to RAET Programming
=========================
.. note::
This page is still under construction
The first thing to cover is that RAET does not present a socket api, it
presents and queueing api, all messages in RAET are made available to via
queues. This is the single most differentiating factor with RAET vs other
networking libraries, instead of making a socket, a stack is created.
Instead of calling send() or recv(), messages are placed on the stack to be
sent and messages that are recived appear on the stack.
Different kinds of stacks are also available, currently two stacks exist,
the UDP stack, and the UXD stack. The UDP stack is used to communicate over
udp sockets, and the UXD stack is used to communicate over Unix Domain
Sockets.
The UDP stack runs a context for communicating over networks, while the
UXD stack has contexts for communicating between processes.
UDP Stack Messages
==================
To create a UDP stack in RAET, simply create the stack, manage the queues,
and process messages:
.. code-block:: python
from salt.transport.road.raet import stacking
from salt.transport.road.raet import estating
udp_stack = stacking.StackUdp(ha=('127.0.0.1', 7870))
r_estate = estating.Estate(stack=stack, name='foo', ha=('192.168.42.42', 7870))
msg = {'hello': 'world'}
udp_stack.transmit(msg, udp_stack.estates[r_estate.name])
udp_stack.serviceAll()