| Module | Toolshed |
| In: |
lib/toolshed.rb
|
This module provides a toolkit of helper methods to Abundance
It uses the Socket Ruby standard library to provide a communication mechanism between Abundance concurent processes. It‘s used as both a namespace for init variables of the different Abundance Classes, using Toolshed‘s Class Method like qualified names, and as mixins methods which access directly the instance variables of the client classes .
| Author: | lp (lp@spiralix.org) |
| Copyright: | 2008 Louis-Philippe Perron - Released under the terms of the MIT license |
| SOCKET_ROOT | = | '/tmp/abundance/' |
The Toolshed::block_size= method sets the Socket block size for UNIXSocket operations.
The my_socket_path method act as an attribute reader for the @my_socket_path instance variable of the calling object.
The set_my_socket_as_a method sets a UNIXServer socket as an instance variable for the calling object in a role based fashion. When the specified role is not a :garden, the Garden‘s socket path is also stored as an instance variable for the calling object.
The socket_duplex method open a UNIXSocket and send packets to a UNIXServer socket, then wait for loopback communication from destination and return results like socket_recv.
The socket_recv method calls accept on a UNIXServer socket, receives all the packets from a UNIXSocket sender, join the packets back as the original block message.
The socket_send method open a UNIXSocket and send packets to a UNIXServer socket. When the server_socket_path is not specified, it defaults sending to the Garden UNIXServer.