ROOT logo
Gled » GLEDCORE » Saturn

class Saturn: public An_ID_Demangler


 Server and client. In fact Sun, Moon and Fire.
 Shines, reflects and glows.

Function Members (Methods)

public:
Saturn()
Saturn(const Saturn&)
virtual~Saturn()
Bool_tAcceptsRays() const
voidAllowMoons()
static TClass*Class()
SaturnInfo*Connect(SaturnInfo* si)
voidCreate(SaturnInfo* si)
voidDelayedShootMIR(auto_ptr<ZMIR>& mir, GTime at_time)
voidDelayedShootMIR(ZMIR* mir, GTime at_time)
virtual ZGlass*DemangleID(ID_t id)
Int_tFreeze()
Bool_tGetAllowMoons()
Mountain*GetChaItOss()
ZFireKing*GetFireKing()
ZFireQueen*GetFireQueen()
ZGod*GetGod()
ZKing*GetKing()
Int_tGetQueenLoadNum()
SaturnInfo*GetSaturnInfo()
boolGetSunAbsolute()
SaturnInfo*GetSunInfo()
ZKing*GetSunKing()
ZSunQueen*GetSunQueen()
ZHistoManager*GetZHistoManager()
static TMessage*HandleClientSideMeeConnection(TSocket* socket, ZMirEmittingEntity* mee)
static TStringHandleClientSideSaturnHandshake(TSocket*& socket)
virtual TClass*IsA() const
voidLockMIRShooters(bool wait_until_queue_empty = false)
TSocket*MakeSocketPairAndAccept(const TString& name)
voidOpenServerSocket()
Saturn&operator=(const Saturn&)
voidPostMIR(auto_ptr<ZMIR>& mir)
voidPostMIR(ZMIR* mir)
GMutex&RefIDLock()
GCondition&RefQueenLoadCnd()
voidSetQueenLoadNum(Int_t queenloadnum)
voidShine(auto_ptr<Ray>& ray, EyeInfoVector* eiv)
voidShootMIR(auto_ptr<ZMIR>& mir, bool use_own_thread = false)
voidShootMIR(ZMIR* mir, bool use_own_thread = false)
voidShootMIRResult(TBuffer& buf)
ZMIR_RR*ShootMIRWaitResult(auto_ptr<ZMIR>& mir, bool use_own_thread = false)
ZMIR_RR*ShootMIRWaitResult(ZMIR* mir, bool use_own_thread = false)
virtual voidShowMembers(TMemberInspector& insp)
voidShutdown()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
Int_tUnFreeze()
voidUnlockMIRShooters()
protected:
voidAccept(TSocket* newsocket)
voidAcceptWrapper(TSocket* newsocket)
voidarrival_of_kings(TMessage* m)
voidBroadcastBeamMIR(ZMIR& mir, Saturn::lpSaturnInfo_t& moons)
voidBroadcastMIR(ZMIR& mir, Saturn::lpSaturnInfo_t& moons)
voidCopyMoons(Saturn::lpSaturnInfo_t& list)
voidcreate_kings(const char* king, const char* whore_king)
intcreate_server_socket()
voiddelayed_mir_shooter()
voiddelayed_shoot_mir(auto_ptr<ZMIR>& mir, ZMirEmittingEntity* caller, GTime at_time)
voidEndark(ZGlass* glass)
voidEnlight(ZGlass* glass, ID_t)
voidExecDetachedMIR(auto_ptr<ZMIR>& mir)
voidExecMIR(ZMIR* mir, bool lockp = true)
voidExecMIR(auto_ptr<ZMIR>& mir, bool lockp = true)
voidfinalize_eye_connection(EyeInfo* ei)
voidfinalize_moon_connection(SaturnInfo* si)
SaturnInfo*FindRouteTo(SaturnInfo* target)
voidfix_fire_king_id(SaturnInfo* si)
voidForwardMIR(ZMIR& mir, SaturnInfo* route)
voidFreeze(ZGlass* glass)
voidgenerick_shoot_mir_result(ZMIR& mir, const Text_t* exc, TBuffer* buf)
voidhandle_mir_result(UInt_t req_handle, ZMIR* mirp)
Bool_tIsMoon(SaturnInfo* si)
Int_tManage(TSocket* sock)
voidmarkup_posted_mir(ZMIR& mir, ZMirEmittingEntity* caller = 0)
voidmir_shooter()
voidpost_mir(auto_ptr<ZMIR>& mir, ZMirEmittingEntity* caller = 0)
ZMIR_RR*query_mir_result(UInt_t req_handle)
voidray_emitter()
voidReflect(ZGlass* glass)
UInt_tregister_mir_result_request(GCondition* cond)
voidreport_mir_post_demangling_error(ZMIR& mir, TString error)
voidreport_mir_pre_demangling_error(ZMIR& mir, TString error)
voidRouteMIR(auto_ptr<ZMIR>& mir)
voidshoot_mir(auto_ptr<ZMIR>& mir, ZMirEmittingEntity* caller, bool use_own_thread = false)
voidsocket_closed(TSocket* sock)
Int_tSockSuck()
intstart_server()
intstart_shooters()
static intstart_threads(Saturn* saturn)
intstop_detached_threads()
intstop_server()
intstop_shooters()
voidUnfoldMIR(auto_ptr<ZMIR>& mir)
voidwipe_eye(EyeInfo* eye, bool notify_sunqueen_p)
voidwipe_moon(SaturnInfo* moon, bool notify_sunqueen_p)
private:
static void*tl_Delayed_MIR_Shooter(Saturn* s)
static voidtl_MIR_DetachedCleanUp(Saturn* sat)
static void*tl_MIR_DetachedExecutor(Saturn* sat)
static void*tl_MIR_Router(Saturn* sat)
static void*tl_MIR_Shooter(Saturn* s)
static void*tl_Ray_Emitter(Saturn* s)
static void*tl_SaturnAcceptor(Saturn::new_connection_ti* ss)
static void*tl_SaturnFdSucker(Saturn* s)

Data Members

public:
static const Int_ts_Gled_Protocol_Version
protected:
Bool_tbAcceptsRays
Bool_tbAllowMoonsX{g}
boolbSunAbsoluteX{g}
GMutexmBeamReqHandleMutex
Mountain*mChaItOssX{g}
GConditionmDelayedMIRShootingCnd
multimap<GTime,ZMIR*>mDelayedMIRShootingQueue
GThread*mDelayedMIRShootingThread
GMutexmEyeLocksending to eyes
list<EyeInfo*>mEyes
ZFireKing*mFireKingX{g}
ZFireQueen*mFireQueenX{g}
ZGod*mGodX{g}
GMutexmIDLockX{r} ... must allow locking to eyez
ZKing*mKingX{g}
UInt_tmLastBeamReqHandle
GMutexmMIRShooterRoutingLock
GConditionmMIRShootingCnd
list<ZMIR*>mMIRShootingQueue
GThread*mMIRShootingThread
GMutexmMasterLocksending to master
GMutexmMoonLocksending to moons
list<SaturnInfo*>mMoons
GConditionmQueenLoadCndX{r}
Int_tmQueenLoadNumX{gS}
GConditionmRayEmittingCnd
list<pair<Ray*,EyeInfoVector*> >mRayEmittingQueue
GThread*mRayEmittingThread
GMutexmRulingLockExec in kings & queens
SaturnInfo*mSaturnInfoX{g}
GSelectormSelectorfd select wrapper for sockets
TServerSocket*mServerSocket
GThread*mServerThread
GThread*mShutdownThread
SaturnInfo*mSunInfoX{g}
ZKing*mSunKingX{g}
ZSunQueen*mSunQueenX{g}
ZHistoManager*pZHistoManager

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void* tl_SaturnFdSucker(Saturn* s)
 The thread foo for doing select on all sockets (master, moons & eyes).
 Could (in principle) have several threads.
void* tl_SaturnAcceptor(Saturn::new_connection_ti* ss)
 Thread foo for acception of a new connection.
 Accept threads are always created in a detached state.
void* tl_MIR_Router(Saturn* sat)
 Thread foo for routing of a single MIR.
void* tl_MIR_DetachedExecutor(Saturn* sat)
 Thread foo for execution of a single *detached* MIR.
 MIR is set in the GThread structure.
void tl_MIR_DetachedCleanUp(Saturn* sat)
void* tl_MIR_Shooter(Saturn* s)
 Thread foo executing Saturn::mir_shooter().
void* tl_Delayed_MIR_Shooter(Saturn* s)
 Thread foo executing Saturn::dealyed_mir_shooter().
void* tl_Ray_Emitter(Saturn* s)
 Thread foo executing Saturn::ray_emitter().
Saturn()
 GOD
~Saturn()
TString HandleClientSideSaturnHandshake(TSocket*& socket)
 Handles handshake with a Saturn on a newly opened socket.
 Returns greeting TString.
TMessage* HandleClientSideMeeConnection(TSocket* socket, ZMirEmittingEntity* mee)
 Sends request for instantiation of mee via socket.
 If authentication is required it is handled via
 ZSunQueen::HandleClientSideAuthentication(). The required identity
 is deduced from the TString ZMirEmittingEntity::mLogin.
void Create(SaturnInfo* si)
 Spawns SunAbsolute and starts internal Saturn threads.

 The calling thread is given the identity of the argument SaturnInfo,
 which is also assigned to mSunInfo and mSaturnInfo members.
SaturnInfo* Connect(SaturnInfo* si)
 Connects to a higher Saturn, as specified by si->MasterName and
 si->MasterPort. Does the following:
 1) handles handshake & protocol info exchange
 2) queries first free id to establish beginning of local sun-space
 3) authenticates to sun.absolute and receives higher kings, sun.queen
    and the authorized SaturnInfo structure
 4) starts MirShooting thread and server thread
 5) issues requests for mirroring of mandatory queens

 The calling thread is given the identity of the return SaturnInfo, which
 is also assigned to mSaturnInfo member.
TSocket* MakeSocketPairAndAccept(const TString& name)
 Creates unix socket pair and runs Accept() in a special thread. The other
 socket is returned.
 Used for Eye connections.
void OpenServerSocket()
void AllowMoons()
 On start-up the moons are not allowed to connect (only Eyes).
 AllowMoons() allows moons connections from now on.
void Shutdown()
 Performs shutdown of connected objects and threads.
void LockMIRShooters(bool wait_until_queue_empty = false)
void UnlockMIRShooters()
void Enlight(ZGlass* glass, ID_t )
 Inserts glass into hash with key id.
 Sets Saturn related glass members and calls ZGlass::AdEnlightenment().
void Reflect(ZGlass* glass)
 Enlights glass with a key taken from glass->mSaturnID.
 Used for ZComet unpacking on Moons (hence Reflect).
void Freeze(ZGlass* glass)
 Stops all detached MIR threads for lens.
void Endark(ZGlass* glass)
Bool_t IsMoon(SaturnInfo* si)
void CopyMoons(Saturn::lpSaturnInfo_t& list)
Int_t Freeze()
Int_t UnFreeze()
ZHistoManager* GetZHistoManager()
Int_t SockSuck()
SaturnInfo* FindRouteTo(SaturnInfo* target)
 Finds SaturnInfo that is on-route to target.
 Checks target's masters and if self is found, sends to
 the previous master.
 Otherwise it must be sent up.
void AcceptWrapper(TSocket* newsocket)
 Exception catching wrapper for Accept().
void Accept(TSocket* newsocket)
 Accepts connection from an Eye/Moon or handles FirstFreeID query.
 Locks/Suspends all executions upon
 adding fd to Selector and sending scene to the Moon.
 Runs in a detached thread (called from tl_SaturnAcceptor) ...
 perhaps should timeout.
 Handles one connection at a time.
void finalize_moon_connection(SaturnInfo* si)
void finalize_eye_connection(EyeInfo* ei)
Int_t Manage(TSocket* sock)
UInt_t register_mir_result_request(GCondition* cond)
ZMIR_RR* query_mir_result(UInt_t req_handle)
void handle_mir_result(UInt_t req_handle, ZMIR* mirp)
void markup_posted_mir(ZMIR& mir, ZMirEmittingEntity* caller = 0)
 Writes header and caller infromation.
 If caller==0 the owner of current thread is used.
void post_mir(auto_ptr<ZMIR>& mir, ZMirEmittingEntity* caller = 0)
void shoot_mir(auto_ptr<ZMIR>& mir, ZMirEmittingEntity* caller, bool use_own_thread = false)
 The auto_ptr<ZMIR> is released and should not be used afterwards.
void delayed_shoot_mir(auto_ptr<ZMIR>& mir, ZMirEmittingEntity* caller, GTime at_time)
 The auto_ptr<ZMIR> is released and should not be used afterwards.
void mir_shooter()
 Routes MIRs from the ShootingQueue.
 Every MIR is deleted after routing.
void delayed_mir_shooter()
 Routes MIRs from the ShootingQueue.
 Every MIR is deleted after routing.
void PostMIR(auto_ptr<ZMIR>& mir)
 Routes MIR 'mir' in the current thread.
 Usually called from Operators to publish some result.
 'mir' will NOT be harmed; if it is to be re-used, do:
  mir.RewindToMIR() prior to posting it again.
void PostMIR(ZMIR* mir)
 Routes a MIR in the current thread.
 Wrapper for the variant with auto_ptr argument.
void ShootMIR(auto_ptr<ZMIR>& mir, bool use_own_thread = false)
 Accepts a MIR and shoots it into the system.
 The auto_ptr<ZMIR> is released and should not be used afterwards.
void ShootMIR(ZMIR* mir, bool use_own_thread = false)
 Accepts a MIR and shoots it into the system.
 Wrapper for the variant with auto_ptr argument.
void DelayedShootMIR(auto_ptr<ZMIR>& mir, GTime at_time)
 Accepts a MIR and shoots it into the system.
 The auto_ptr<ZMIR> is released and should not be used afterwards.
void DelayedShootMIR(ZMIR* mir, GTime at_time)
 Accepts a MIR and shoots it into the system.
 Wrapper for the variant with auto_ptr argument.
ZMIR_RR* ShootMIRWaitResult(auto_ptr<ZMIR>& mir, bool use_own_thread = false)
 Accepts a MIR, shoots it into the system and waits for ResultReport.
 The auto_ptr<ZMIR> is released and should not be used afterwards.
ZMIR_RR* ShootMIRWaitResult(ZMIR* mir, bool use_own_thread = false)
 Accepts a MIR, shoots it into the system and waits for ResultReport.
 Wrapper for the variant with auto_ptr argument.
void generick_shoot_mir_result(ZMIR& mir, const Text_t* exc, TBuffer* buf)
void ShootMIRResult(TBuffer& buf)
 Makes a result MIR and sends it to the caller Saturn.
 Should be called from a method called via a MIR (flare OR beam)
 containing a result request.
void report_mir_pre_demangling_error(ZMIR& mir, TString error)
void report_mir_post_demangling_error(ZMIR& mir, TString error)
void RouteMIR(auto_ptr<ZMIR>& mir)
 Decides what to do with a MIR ... and does it.
void UnfoldMIR(auto_ptr<ZMIR>& mir)
 Prepares MIR for execution, does checks, proper broadcasting
 and the execution itself.
 Message type should be MT_Beam or MT_Flare.
void ExecMIR(ZMIR* mir, bool lockp = true)
void ExecMIR(auto_ptr<ZMIR>& mir, bool lockp = true)
 Wrapper with auto_ptr argument.

 This is the preferred entry point but the variant taking plain
 ZMIR* is also needed for execution of MIRs in detached threads
 that can be potentially cancelled.
void ExecDetachedMIR(auto_ptr<ZMIR>& mir)
 This function spawns a thread that calls ExecMIR().
 mir is released and deleted at thread completition.
void ForwardMIR(ZMIR& mir, SaturnInfo* route)
 Forwards a MIR to Saturn given by route.
void BroadcastMIR(ZMIR& mir, Saturn::lpSaturnInfo_t& moons)
 Broadcasts MIR to reflecting Moons specified in socks.
void BroadcastBeamMIR(ZMIR& mir, Saturn::lpSaturnInfo_t& moons)
 Broadcasts MIR to reflecting Moons specified in socks.
 Specifically sets each SaturnInfo to be the recipient.
void ray_emitter()
 Emits Rays from the EmittingQueue.
 Every MIR is deleted after routing.
void Shine(auto_ptr<Ray>& ray, EyeInfoVector* eiv)
int start_threads(Saturn* saturn)
 A thread function to spawn off server thread and shooter threads.
 Needed to ensure that most signals are blocked.
 Termination policy for these threads is set to system-exit.
 This is called from Create() or Connect() which in turn is usually called
 from a CINT script -- and that thread has several system signals
 unblocked.
int create_server_socket()
int start_server()
int stop_server()
int start_shooters()
int stop_shooters()
int stop_detached_threads()
 Stop all detached threads.
void socket_closed(TSocket* sock)
void wipe_moon(SaturnInfo* moon, bool notify_sunqueen_p)
 Removes moon from list of moons and notifies the SunQueen if
 notify_sunqueen_p is true.
 Also removes the moon from all queens that are reflecting to it.
void wipe_eye(EyeInfo* eye, bool notify_sunqueen_p)
void fix_fire_king_id(SaturnInfo* si)
void create_kings(const char* king, const char* whore_king)
 Local King
void arrival_of_kings(TMessage* m)
ZGlass* DemangleID(ID_t id)
Saturn()
Bool_t AcceptsRays() const
{ return bAcceptsRays; }