C syntax:
void phish_send(int iport) void phish_send_key(int iport, char *key, int nbytes) void phish_send_direct(int iport, int receiver)
C examples:
#include "phish.h" phish_send(0); phish_send_key(1,id,strlen(id)); phish_send_direct(0,3);
C++ syntax:
void send(int iport) void send_key(int iport, char *key, int nbytes) void send_direct(int iport, int receiver)
C++ examples:
#include "phish.hpp" phish::send(0); phish::send_key(1,id,strlen(id)); phish::send_direct(0,3);
Python syntax:
def send(iport) def send_key(iport,key) def send_direct(iport,receiver)
Python examples:
import phish phish.send(0) phish.send_key(1,id) phish.send_direct(0,3)
Description:
These are PHISH library functions which can be called from a minnow application. In PHISH lingo, a "minnow" is a stand-alone application which makes calls to the PHISH library.
These functions are used to send datums to other minnows. Before a datum can be sent, it must be packed into a buffer. See the doc page for the phish_pack functions to see how this is done.
All datums are sent via output ports the minnow defines and which the PHISH input script uses to route datums from one set of minnows to another set. Thus these send functions all take an iport argument to specify which output port to send thru.
The specific minnow(s) that the datum will be sent to is determined by the connection style(s) defined for the output port. See the PHISH input script hook command, as discussed on the bait.py tool doc page, for details. Some connection styles require additional information from the minnow to route the datum to the desired minnow. This is the reason for the phish_send_key() and phish_send_direct() variants of phish_send().
The phish_send() function sends a datum to the specified iport output port.
This generic form of a send can be used for all connection styles except the hashed and direct styles. See the PHISH input script hook command for details. Note that multiple sets of receiving minnows, each with their own connection style, can be connected to the same output port.
If phish_send() is used with a hashed or direct connection style, an error will result.
The phish_send_key() function sends a datum to the specified iport output port and allows specification of a byte string or key of length nbytes, which will be hashed by the PHISH library and converted into an index for choosing a specific receiving processor to send the datum to.
This form of sending must be used for a hashed connection style. See the PHISH input script hook command for details. If a connection style to a specific output port is not a hashed style, then the key and nbytes arguments are ignored, and the generic phish_send() form is used to send the datum.
The phish_send_direct() function sends a datum to the specified iport output port and allows a specific receiving minnow to be selected via the receiver argument. The receiver is an integer offset into the set of receiving minnows connected to this output port. If there are M minnows in the receiving set, then 0 <= receiver < M is required. The phish_query function can be used to query information about the receiving set of minnows. For example this phish_query() call would return M, assuming the receiving processors are connected to output port 0.
int m = phish_query("outport/direct",0,0);
This form of sending must be used for a direct connection style. See the PHISH input script hook command for details. If one or more of the connection styles connected to the output port is not a direct style, then the reciever argument is ignored, and the generic phish_send() form is used to send the datum.
Restrictions: none
Related commands: