Statistics
| Branch: | Tag: | Revision:

psng-pyserf / README @ ff14495b

History | View | Annotate | Download (2.78 KB)

1
### Dependencies
2

    
3
This software requires the following libraries:
4

    
5
argparse_actions
6
iproute2
7
portalocker
8

    
9

    
10
### Usage examples
11

    
12
In all the examples that follow we assume we want to use "psngc" as the channels
13
tag name (specified with option -t) and that the RPC deamon responds at address
14
127.0.0.1 on port 7373 (specified with options -a and -p respectively).
15

    
16
## Add a new channel
17

    
18
Suppose you want to add a new channel named "Channel1" and whose source IP
19
address and port are 192.168.100.2 and 6000 respectively. Then you execute the
20
following command:
21

    
22
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \
23
  set 192.168.100.2 6000 "Channel1" "Reserved"
24

    
25
The last string "Reserved" can be used to specify any additional parameters that
26
can be useful for whoever will receive this channel.
27

    
28
NOTE: It is not possible to add two different channel that use the same address
29
and port. This contraint is verified only on the local node, this means that is
30
responsibility of the local node to use the correct source channel IP address.
31

    
32
NOTE: Adding a new channel propagates a member-update event on the Serf network.
33
If the channel already exist on the list of channels of the local node, then the
34
member-update event is not generated.
35

    
36

    
37
## Delete a channel
38

    
39
Channel deletion is based exclusively on the source IP address and port of a
40
channel. The channel name and the "Reserved" string are ignored. Suppose you
41
want to delete the channel that was added in the previous example (address
42
192.168.100.2 and port 6000). The you execute the following command:
43

    
44
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \
45
  del 192.168.100.2 6000
46

    
47
NOTE: Deleting a channel propagates a member-update event on the Serf network.
48
If the channel is not present in the list of channels that belong to the local
49
node, then the member-update event is not generated.
50

    
51

    
52
## Running the software in background
53

    
54
All the nodes that are interested in keepeing an updted list of channels
55
existing on the network should run the software in background mode with the
56
following command:
57

    
58
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \
59
  bg /tmp/channels.db
60

    
61
the path specified at the end of the command is the channels database file that
62
the software will use to list the existing channels. This file is written for
63
the first time when the software starts and is updated everytime a channel is
64
added or deleted (this is known by listening to the member-update events). The
65
software use an exclusive file system file lock every time the file is updated.
66
The file is formatted by an header line (starting with the character "#") and by
67
a list of zero or more channels. Here an examples of the channels database file
68
containing two channels:
69

    
70
# channel_name,source_addr,source_port,channel_params
71
Channel1,192.168.100.2,6000,Reserved
72
Cool Channel,192.168.100.3,7000,720p h264
73