#include <session.h>


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 () |
| CommandQueue * | getCommandThreadQueue () |
| 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 NodeID & | getIDMaster (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. | |
| eq::net::Session::Session | ( | ) |
| void eq::net::Session::setName | ( | const std::string & | name | ) | [inline] |
| const std::string& eq::net::Session::getName | ( | ) | const [inline] |
Definition at line 40 of file session.h.
Referenced by eq::net::Node::mapSession().

| uint32_t eq::net::Session::getID | ( | ) | const [inline] |
Returns the identifier of this session.
Definition at line 47 of file session.h.
Referenced by eq::net::Node::removeSession(), eq::net::ObjectInstanceDataOStream::sendBuffer(), eq::net::ObjectDeltaDataOStream::sendBuffer(), eq::Config::sendEvent(), eq::net::ObjectInstanceDataOStream::sendFooter(), eq::net::ObjectDeltaDataOStream::sendFooter(), eq::FrameData::transmit(), and eq::net::Node::unmapSession().

| NodePtr eq::net::Session::getLocalNode | ( | ) | [inline] |
Definition at line 53 of file session.h.
Referenced by eq::net::Barrier::enter(), and eq::Config::sendEvent().

| CommandQueue* eq::net::Session::getCommandThreadQueue | ( | ) | [inline] |
Definition at line 56 of file session.h.
Referenced by eq::FrameData::attachToSession(), eq::net::UnbufferedMasterCM::notifyAttached(), eq::net::StaticSlaveCM::notifyAttached(), eq::net::FullSlaveCM::notifyAttached(), eq::net::FullMasterCM::notifyAttached(), and eq::net::DeltaMasterCM::notifyAttached().

| NodePtr eq::net::Session::getServer | ( | ) | [inline] |
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().

| bool eq::net::Session::dispatchCommand | ( | Command & | packet | ) | [virtual] |
Dispatches a command packet to the appropriate command queue.
| packet | the command packet. |
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().


| CommandResult eq::net::Session::invokeCommand | ( | Command & | packet | ) | [virtual] |
Dispatches a command packet to the appropriate handler method.
| packet | the command packet. |
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().


| uint32_t eq::net::Session::genIDs | ( | const uint32_t | range | ) |
Generates a continous block of unique identifiers.
| range | the size of the block. |
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().


| void eq::net::Session::freeIDs | ( | const uint32_t | start, | |
| const uint32_t | range | |||
| ) |
Frees a continous block of unique identifiers.
| 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().


| 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.
| 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.
| 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.
| id | 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().


| void eq::net::Session::registerObject | ( | Object * | object | ) |
Register a distributed object.
The assigned identifier is unique across all registered objects in the session.
| object | the object instance. |
Definition at line 428 of file session.cpp.
References eq::net::Object::_id, genIDs(), eq::net::Object::getChangeType(), and mapObject().

| void eq::net::Session::deregisterObject | ( | Object * | object | ) |
Deregister a distributed object.
| object | the object instance. |
Definition at line 444 of file session.cpp.
References freeIDs(), and unmapObject().
Referenced by eq::Config::exit().


| 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.
| object | the object. | |
| id | the master object identifier. | |
| version | the initial version. |
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().


| 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().


| 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().


| void eq::net::Session::unmapObject | ( | Object * | object | ) |
Unmap a mapped object.
| 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().


| 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.
| 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().

| void eq::net::Session::detachObject | ( | Object * | object | ) |
Detach an object.
| 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().


| bool eq::net::Session::send | ( | SessionPacket & | packet | ) | [inline, protected] |
Send a packet to the session's server node.
| packet | the packet. |
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().

| void eq::net::Session::send | ( | NodePtr | node, | |
| SessionPacket & | packet | |||
| ) | [inline, protected] |
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().
0.6 by
1.5.5