Package cobra
[hide private]
[frames] | no frames]

Package cobra

source code

Cobra RMI Framework

Cobra is a remote method invocation interface that is very "pythony". It is MUCH like its inspiration pyro, but slimmer and safer for things like threading and object de-registration. Essentially, cobra allows you to call methods from and get/set attributes on objects that exist on a remote system.

Submodules [hide private]

Classes [hide private]
  CobraException
Base for Cobra exceptions
  CobraClosedException
Raised when a connection is unexpectedly closed.
  CobraRetryException
Raised when the retrymax (if present) for a proxy object is exceeded.
  CobraPickleException
Raised when pickling fails.
  CobraAuthException
Raised when specified auth data is rejected
  CobraErrorException
Raised when we receive a COBRA_ERROR message and the current options dont support serializing exception objects.
  CobraMethod
  CobraSocket
  SocketBuilder
  CobraClientSocket
  CobraDaemon
  CobraRequestHandler
  CobraConnectionHandler
  CobraProxy
A proxy object for remote objects shared with Cobra
Functions [hide private]
 
connectSocket(host, port, timeout=None)
Make the long names go away....
source code
 
getCallerInfo()
This function may be used from *inside* a method being called by a remote caller.
source code
 
getLocalInfo()
This function returns the local host,port combination being used in the socket servicing the current request
source code
 
getUserInfo()
Get the cobra authenticated username of the current user ( or None if no user was authenticated )
source code
 
setCallerInfo(callerinfo)
This is necissary because of crazy python method call name munging for thread attributes ;)
source code
 
setUserInfo(authuser) source code
 
setLocalInfo(localinfo) source code
 
newobj(f) source code
 
newobjwith(f) source code
 
pickledumps(o) source code
 
isCobraUri(uri) source code
 
chopCobraUri(uri) source code
 
addSocketBuilder(host, port, builder)
Register a global socket builder which should be used when constructing sockets to the given host/port.
source code
 
getSocketBuilder(host, port)
Retrieve the registered socket builder for the given host/port.
source code
 
initSocketBuilder(host, port)
Retrieve or initialize a socket builder for the host/port.
source code
 
startCobraServer(host="", port=COBRA_PORT) source code
 
runCobraServer(host='', port=COBRA_PORT) source code
 
shareObject(obj, name=None, doref=False)
If shareObject is called before startCobraServer or startCobraSslServer, it will call startCobraServer
source code
 
unshareObject(name) source code
 
swapCobraObject(uri, newname)
Parse out the object name from a given cobra URI and return a newly constructed URI for the shared object <newname> on the same server.
source code
 
requireMsgpack() source code
Variables [hide private]
  daemon = None
hash(x)
  verbose = False
  version = "Cobra2"
  COBRA_PORT = 5656
  COBRASSL_PORT = 5653
  cobra_retrymax = None
hash(x)
  socket_builders = {}
  COBRA_HELLO = 0
  COBRA_CALL = 1
  COBRA_GETATTR = 2
  COBRA_SETATTR = 3
  COBRA_ERROR = 4
  COBRA_GOODBYE = 5
  COBRA_AUTH = 6
  COBRA_NEWOBJ = 7
  SFLAG_MSGPACK = 0x0001
Function Details [hide private]

getCallerInfo()

source code 

This function may be used from *inside* a method being called by a remote caller. It will return a tuple of host,port for the other side of the connection... use wisely ;)