eq::net::Session Class Reference

#include <session.h>

Inheritance diagram for eq::net::Session:

Inheritance graph
[legend]
Collaboration diagram for eq::net::Session:

Collaboration graph
[legend]

List of all members.


Detailed Description

A logical abstraction for multiple Node s.

A session provides unique identifiers for a number of nodes.

Definition at line 28 of file session.h.


Object Registration

base::RequestHandler _requestHandler
 Registers request packets waiting for a return value.
class Node
void registerObject (Object *object)
 Register a distributed object.
void deregisterObject (Object *object)
 Deregister a distributed object.
bool mapObject (Object *object, const uint32_t id, const uint32_t version=Object::VERSION_NONE)
 Map a distributed object.
uint32_t mapObjectNB (Object *object, const uint32_t id, const uint32_t version=Object::VERSION_NONE)
 Start mapping a distributed object.
bool mapObjectSync (const uint32_t requestID)
 Finalize the mapping of a distributed object.
void unmapObject (Object *object)
 Unmap a mapped object.
void attachObject (Object *object, const uint32_t id)
 Attach an object to an identifier.
void detachObject (Object *object)
 Detach an object.
bool send (SessionPacket &packet)
 Send a packet to the session's server node.
template<typename T>
bool send (SessionPacket &packet, const std::vector< T > &data)
void send (NodePtr node, SessionPacket &packet)
 Send a packet to a node.
void send (NodePtr node, SessionPacket &packet, const std::string &text)
void send (NodePtr node, SessionPacket &packet, const void *data, const uint64_t size)

Public Member Functions

 Session ()
 Constructs a new session.
void setName (const std::string &name)
 Set the session name.
const std::string & getName () const
uint32_t getID () const
 Returns the identifier of this session.
virtual void setLocalNode (NodePtr node)
 Set the local node.
NodePtr getLocalNode ()
CommandQueuegetCommandThreadQueue ()
NodePtr getServer ()
virtual bool dispatchCommand (Command &packet)
 Dispatches a command packet to the appropriate command queue.
virtual CommandResult invokeCommand (Command &packet)
 Dispatches a command packet to the appropriate handler method.
Identifier management
uint32_t genIDs (const uint32_t range)
 Generates a continous block of unique identifiers.
void freeIDs (const uint32_t start, const uint32_t range)
 Frees a continous block of unique identifiers.
void setIDMaster (const uint32_t start, const uint32_t range, const NodeID &master)
 Set the master node for a block of identifiers.
void unsetIDMaster (const uint32_t start, const uint32_t range)
 Delete the master node for a block of identifiers.
const NodeIDgetIDMaster (const uint32_t id)
 Returns the master node id for an identifier.

Classes

struct  IDMasterInfo
 Stores a mapping from a block of identifiers to a master node.

Constructor & Destructor Documentation

eq::net::Session::Session (  ) 

Constructs a new session.

Definition at line 28 of file session.cpp.


Member Function Documentation

void eq::net::Session::setName ( const std::string &  name  )  [inline]

Set the session name.

Definition at line 37 of file session.h.

const std::string& eq::net::Session::getName (  )  const [inline]

Returns:
the name of the session.

Definition at line 40 of file session.h.

Referenced by eq::net::Node::mapSession().

Here is the caller graph for this function:

uint32_t eq::net::Session::getID (  )  const [inline]

NodePtr eq::net::Session::getLocalNode (  )  [inline]

Returns:
the local node holding this session.

Definition at line 53 of file session.h.

Referenced by eq::net::Barrier::enter(), and eq::Config::sendEvent().

Here is the caller graph for this function:

CommandQueue* eq::net::Session::getCommandThreadQueue (  )  [inline]

NodePtr eq::net::Session::getServer (  )  [inline]

Returns:
the server hosting this session.

Reimplemented in eq::Config.

Definition at line 60 of file session.h.

Referenced by eq::net::Barrier::enter(), eq::Config::getServer(), mapObjectNB(), eq::Config::sendEvent(), and eq::net::Node::unmapSession().

Here is the caller graph for this function:

bool eq::net::Session::dispatchCommand ( Command packet  )  [virtual]

Dispatches a command packet to the appropriate command queue.

Parameters:
packet the command packet.
Returns:
the result of the operation.
See also:
Base::dispatchCommand

Reimplemented from eq::net::Base.

Definition at line 459 of file session.cpp.

References eq::net::Base::dispatchCommand(), eq::net::Command::getPacket(), and eq::net::Command::isValid().

Referenced by eq::net::Node::dispatchCommand().

Here is the call graph for this function:

Here is the caller graph for this function:

CommandResult eq::net::Session::invokeCommand ( Command packet  )  [virtual]

Dispatches a command packet to the appropriate handler method.

Parameters:
packet the command packet.
Returns:
the result of the operation.
See also:
Base::invokeCommand

Reimplemented from eq::net::Base.

Definition at line 498 of file session.cpp.

References eq::net::Base::invokeCommand(), and eq::net::Command::isValid().

Referenced by eq::net::Node::invokeCommand().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t eq::net::Session::genIDs ( const uint32_t  range  ) 

Generates a continous block of unique identifiers.

Parameters:
range the size of the block.
Returns:
the first identifier of the block, or 0 if no identifier is available.

Definition at line 126 of file session.cpp.

References _requestHandler, eq::base::IDPool::freeIDs(), eq::base::IDPool::genIDs(), eq::base::RequestHandler::registerRequest(), send(), and eq::base::RequestHandler::waitRequest().

Referenced by registerObject().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::net::Session::freeIDs ( const uint32_t  start,
const uint32_t  range 
)

Frees a continous block of unique identifiers.

Parameters:
start the first identifier in the block.
range the size of the block.

Definition at line 150 of file session.cpp.

References eq::base::IDPool::freeIDs().

Referenced by deregisterObject().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::net::Session::setIDMaster ( const uint32_t  start,
const uint32_t  range,
const NodeID master 
)

Set the master node for a block of identifiers.

This can be used to identify the node which is responsible for the object, action or information associated with an identifier. The identifiers must be unique, it is therefore advised to allocate them using genIDs().

The master node must be reachable from this node and known by the session server node.

Parameters:
start the first identifier of the block.
range the size of the block.
master the master node for the block of identifiers.

Definition at line 159 of file session.cpp.

void eq::net::Session::unsetIDMaster ( const uint32_t  start,
const uint32_t  range 
)

Delete the master node for a block of identifiers.

Parameters:
start the first identifier of the block.
range the size of the block.

const NodeID & eq::net::Session::getIDMaster ( const uint32_t  id  ) 

Returns the master node id for an identifier.

Parameters:
id the identifier.
Returns:
the master node, or Node::ZERO if no master node is set for the identifier.

Definition at line 202 of file session.cpp.

References _requestHandler, eq::base::RequestHandler::registerRequest(), send(), eq::base::SpinLock::set(), eq::base::SpinLock::unset(), and eq::base::RequestHandler::waitRequest().

Referenced by mapObjectNB().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::net::Session::registerObject ( Object object  ) 

Register a distributed object.

The assigned identifier is unique across all registered objects in the session.

Parameters:
object the object instance.

Definition at line 428 of file session.cpp.

References eq::net::Object::_id, genIDs(), eq::net::Object::getChangeType(), and mapObject().

Here is the call graph for this function:

void eq::net::Session::deregisterObject ( Object object  ) 

Deregister a distributed object.

Parameters:
object the object instance.

Definition at line 444 of file session.cpp.

References freeIDs(), and unmapObject().

Referenced by eq::Config::exit().

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::net::Session::mapObject ( Object object,
const uint32_t  id,
const uint32_t  version = Object::VERSION_NONE 
)

Map a distributed object.

The mapped object becomes a slave instance of the master version registered to the provided identifier. The version can be used to map a specific version. If this version does not exist, mapObject() will fail. If VERSION_NONE is provided, the oldest available version is mapped. If the requested version is newer than the head version, mapObject() will block until the requested version is available.

Parameters:
object the object.
id the master object identifier.
version the initial version.
Returns:
true if the object was mapped, false if the master of the object is not found or the requested version is no longer available.
See also:
registerObject

Definition at line 308 of file session.cpp.

References mapObjectNB(), and mapObjectSync().

Referenced by eq::Node::getBarrier(), eq::Pipe::getFrame(), eq::Node::getFrameData(), and registerObject().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t eq::net::Session::mapObjectNB ( Object object,
const uint32_t  id,
const uint32_t  version = Object::VERSION_NONE 
)

Start mapping a distributed object.

Definition at line 315 of file session.cpp.

References _requestHandler, eq::net::Object::getID(), getIDMaster(), getServer(), eq::net::Object::isMaster(), and eq::base::RequestHandler::registerRequest().

Referenced by eqPly::VertexBufferDist::applyInstanceData(), and mapObject().

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::net::Session::mapObjectSync ( const uint32_t  requestID  ) 

Finalize the mapping of a distributed object.

Definition at line 357 of file session.cpp.

References _requestHandler, eq::base::RequestHandler::getRequestData(), eq::net::Object::isMaster(), and eq::base::RequestHandler::waitRequest().

Referenced by eqPly::VertexBufferDist::applyInstanceData(), and mapObject().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::net::Session::unmapObject ( Object object  ) 

Unmap a mapped object.

Parameters:
object the mapped object.

Definition at line 384 of file session.cpp.

References _requestHandler, detachObject(), eq::net::Object::isMaster(), eq::base::RefPtr< T >::isValid(), eq::base::RequestHandler::registerRequest(), send(), eq::base::SpinLock::set(), eq::base::SpinLock::unset(), and eq::base::RequestHandler::waitRequest().

Referenced by deregisterObject().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::net::Session::attachObject ( Object object,
const uint32_t  id 
)

Attach an object to an identifier.

Attaching an object to an identifier enables it to receive object commands through this session. It does not establish any mapping to other object instances with the same identifier.

Parameters:
object the object.
id the object identifier.

Definition at line 228 of file session.cpp.

References _requestHandler, eq::base::RequestHandler::registerRequest(), and eq::base::RequestHandler::waitRequest().

Here is the call graph for this function:

void eq::net::Session::detachObject ( Object object  ) 

Detach an object.

Parameters:
object the attached object.

Definition at line 258 of file session.cpp.

References _requestHandler, eq::base::RequestHandler::registerRequest(), and eq::base::RequestHandler::waitRequest().

Referenced by unmapObject().

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::net::Session::send ( SessionPacket &  packet  )  [inline, protected]

Send a packet to the session's server node.

Parameters:
packet the packet.
Returns:
the success status of the transaction.

Definition at line 219 of file session.h.

Referenced by eq::Config::exit(), eq::Config::finishAllFrames(), eq::Config::freezeLoadBalancing(), genIDs(), getIDMaster(), eq::Config::startFrame(), and unmapObject().

Here is the caller graph for this function:

void eq::net::Session::send ( NodePtr  node,
SessionPacket &  packet 
) [inline, protected]

Send a packet to a node.

Parameters:
node the target node.
packet the packet.
Returns:
the success status of the transaction.

Definition at line 239 of file session.h.


Member Data Documentation

Registers request packets waiting for a return value.

Definition at line 260 of file session.h.

Referenced by attachObject(), detachObject(), eq::Config::exit(), genIDs(), getIDMaster(), mapObjectNB(), mapObjectSync(), setLocalNode(), eq::Config::startFrame(), and unmapObject().


The documentation for this class was generated from the following files:
Generated on Sat Dec 6 12:01:53 2008 for Equalizer 0.6 by  doxygen 1.5.5