indra::ipc::saranwrap Namespace Reference


Classes

class  BadResponse
class  BadRequest
class  UnrecoverableError
class  Request
class  Proxy
class  ObjectProxy
class  CallableProxy
class  Server

Functions

def pythonpath_sync
def wrap
def wrap_module
def status
def _read_lp_hunk
def _read_response
def _write_lp_hunk
def _write_request
def _is_local
def _prnt
def _log
def _unmunge_attr_name
def proxied_type
def raise_a_weird_error
def raise_an_unpicklable_error
def raise_standard_error
def print_string
def err_string
def main

Variables

 set = set
 frozenset = frozenset
 _g_debug_mode = False
 _g_logfile = None


Detailed Description

\
@file saranwrap.py
@author Phoenix
@date 2007-07-13
@brief A simple, pickle based rpc mechanism which reflects python
objects and callables.

$LicenseInfo:firstyear=2007&license=mit$

Copyright (c) 2007-2008, Linden Research, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
$/LicenseInfo$

This file provides classes and exceptions used for simple python level
remote procedure calls. This is achieved by intercepting the basic
getattr and setattr calls in a client proxy, which commnicates those
down to the server which will dispatch them to objects in it's process
space.

The basic protocol to get and set attributes is for the client proxy
to issue the command:

getattr $id $name
setattr $id $name $value

getitem $id $item
setitem $id $item $value
eq $id $rhs
del $id

When the get returns a callable, the client proxy will provide a
callable proxy which will invoke a remote procedure call. The command
issued from the callable proxy to server is:

call $id $name $args $kwargs

If the client supplies an id of None, then the get/set/call is applied
to the object(s) exported from the server.

The server will parse the get/set/call, take the action indicated, and
return back to the caller one of:

value $val
callable
object $id
exception $excp

To handle object expiration, the proxy will instruct the rpc server to
discard objects which are no longer in use. This is handled by
catching proxy deletion and sending the command:

del $id

The server will handle this by removing clearing it's own internal
references. This does not mean that the object will necessarily be
cleaned from the server, but no artificial references will remain
after successfully completing. On completion, the server will return
one of:

value None
exception $excp

The server also accepts a special command for debugging purposes:

status

Which will be intercepted by the server to write back:

status {...}

The wire protocol is to pickle the Request class in this file. The
request class is basically an action and a map of parameters'

Function Documentation

def indra::ipc::saranwrap::_is_local (   attribute  )  [private]

Definition at line 218 of file saranwrap.py.

def indra::ipc::saranwrap::_log (   message  )  [private]

Definition at line 232 of file saranwrap.py.

def indra::ipc::saranwrap::_prnt (   message  )  [private]

Definition at line 226 of file saranwrap.py.

def indra::ipc::saranwrap::_read_lp_hunk (   stream  )  [private]

Definition at line 180 of file saranwrap.py.

def indra::ipc::saranwrap::_read_response (   id,
  attribute,
  input,
  output,
  dead_list 
) [private]

@brief local helper method to read respones from the rpc server.

Definition at line 186 of file saranwrap.py.

def indra::ipc::saranwrap::_unmunge_attr_name (   name  )  [private]

Sometimes attribute names come in with classname prepended, not sure why.
This function removes said classname, because we're huge hackers and we didn't
find out what the true right thing to do is.  *FIX: find out. 

Definition at line 239 of file saranwrap.py.

def indra::ipc::saranwrap::_write_lp_hunk (   stream,
  hunk 
) [private]

Definition at line 207 of file saranwrap.py.

def indra::ipc::saranwrap::_write_request (   param,
  output 
) [private]

Definition at line 213 of file saranwrap.py.

def indra::ipc::saranwrap::err_string (   str  ) 

Definition at line 610 of file saranwrap.py.

def indra::ipc::saranwrap::main (  ) 

Definition at line 613 of file saranwrap.py.

def indra::ipc::saranwrap::print_string (   str  ) 

Definition at line 605 of file saranwrap.py.

def indra::ipc::saranwrap::proxied_type (   self  ) 

Definition at line 386 of file saranwrap.py.

def indra::ipc::saranwrap::pythonpath_sync (  ) 

@brief apply the current sys.path to the environment variable PYTHONPATH, so that child processes have the same paths as the caller does.

Definition at line 113 of file saranwrap.py.

def indra::ipc::saranwrap::raise_a_weird_error (  ) 

Definition at line 591 of file saranwrap.py.

def indra::ipc::saranwrap::raise_an_unpicklable_error (  ) 

Definition at line 595 of file saranwrap.py.

def indra::ipc::saranwrap::raise_standard_error (  ) 

Definition at line 601 of file saranwrap.py.

def indra::ipc::saranwrap::status (   proxy  ) 

@brief get the status from the server through a proxy
@param proxy a saranwrap.Proxy object connected to a server.

Definition at line 148 of file saranwrap.py.

Referenced by LLVOAvatar::buildCharacter(), LLWorkerClass::checkWork(), className(), connect_smtp(), LLSocket::create(), cursor_from_parcel_media(), disconnect_smtp(), LLMediaRemoteCtrl::enableMediaButtons(), handle_click_action_play(), headerCallback(), LLMail::init(), LLMutex::isLocked(), LLViewerMedia::isMediaPaused(), LLViewerMedia::isMediaPlaying(), LLVFile::isReadComplete(), LLPolyMeshSharedData::loadMesh(), LLPanelActiveSpeakers::onChangeModerationMode(), LLKeyframeStandMotion::onInitialize(), LLPanelActiveSpeakers::onModeratorMuteText(), LLPanelActiveSpeakers::onModeratorMuteVoice(), LLKeyframeStandMotion::onUpdate(), LLSDXMLParser::Impl::parse(), LLMessageSystem::poll(), LLAres::process(), LLURLRequest::process_impl(), LLSDRPCServer::process_impl(), LLIOServerSocket::process_impl(), LLIOSocketWriter::process_impl(), LLIOSocketReader::process_impl(), LLHTTPResponder::process_impl(), LLPumpIO::processChain(), LLViewerParcelMgr::processParcelProperties(), LLTransferManager::processTransferInfo(), LLTransferManager::processTransferPacket(), LLPumpIO::rebuildPollset(), LLTransferSourceAsset::responderCallback(), LLErrorThread::run(), LLIOBuffer::seek(), LLMail::send(), LLPacketRing::sendPacket(), LLAudioStreamFMOD::stopStream(), stream_out(), LLFloaterWorldMap::updateLocation(), LLMotionController::updateMotion(), LLTransferSourceChannel::updateTransfers(), LLURLRequest::useProxy(), and validate_framebuffer_object().

Here is the caller graph for this function:

def indra::ipc::saranwrap::wrap (   obj,
  dead_callback = None 
)

@brief wrap in object in another process through a saranwrap proxy
@param object The object to wrap.
@param dead_callback A callable to invoke if the process exits.

Definition at line 120 of file saranwrap.py.

def indra::ipc::saranwrap::wrap_module (   fqname,
  dead_callback = None 
)

@brief wrap a module in another process through a saranwrap proxy
@param fqname The fully qualified name of the module.
@param dead_callback A callable to invoke if the process exits.

Definition at line 134 of file saranwrap.py.


Variable Documentation

Definition at line 109 of file saranwrap.py.

Definition at line 231 of file saranwrap.py.

Definition at line 99 of file saranwrap.py.

Definition at line 98 of file saranwrap.py.


Generated on Fri May 16 09:42:29 2008 for SecondLife by  doxygen 1.5.5