mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
58829cda49
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!
40 lines
1.4 KiB
ReStructuredText
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()
|