ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
XrdProofdSandbox Class Reference

Definition at line 30 of file XrdProofdSandbox.h.

Public Member Functions

 XrdProofdSandbox (XrdProofUI ui, bool full, bool changeown)
 Assert existence on the sandbox for the user defined by 'ui'. More...
 
const char * Dir () const
 
int GuessTag (XrdOucString &tag, int ridx=1)
 Guess session tag completing 'tag' (typically "-<pid>") by scanning the active session file or the session dir. More...
 
const char * ErrMsg () const
 
bool IsValid () const
 
int AddSession (const char *tag)
 Record entry for new proofserv session tagged 'tag' in the active sessions file (<SandBox>/.sessions). More...
 
int RemoveSession (const char *tag)
 Move record for tag from the active sessions file to the old sessions file (<SandBox>/.sessions). More...
 
int GetSessionDirs (int opt, std::list< XrdOucString * > *sdirs, XrdOucString *tag=0)
 Scan the sandbox for sessions working dirs and return their sorted (according to creation time, first is the newest) list in 'sdirs'. More...
 
int TrimSessionDirs ()
 If the static fgMaxOldLogs > 0, logs for a fgMaxOldLogs number of sessions are kept in the sandbox; working dirs for sessions in excess are removed. More...
 

Static Public Member Functions

static void SetMaxOldSessions (int mxses)
 
static void SetWorkdir (const char *wdir)
 

Private Attributes

bool fChangeOwn
 
XrdOucString fDir
 
XrdOucString fErrMsg
 
bool fValid
 
XrdProofUI fUI
 

Static Private Attributes

static int fgMaxOldSessions = 10
 
static XrdOucString fgWorkdir = ""
 
static XrdProofUI fgUI
 

#include <XrdProofdSandbox.h>

Constructor & Destructor Documentation

XrdProofdSandbox::XrdProofdSandbox ( XrdProofUI  ui,
bool  full,
bool  changeown 
)

Assert existence on the sandbox for the user defined by 'ui'.

The sandbox is created under fgWorkdir or $HOME/proof; the boolean 'full' controls the set of directories to be asserted: the sub-set {cache, packages, .creds} is always asserted; if full is true also the sub-dirs {queries, datasets} are asserted. If 'changeown' is true the sandbox ownership is set to 'ui'; this requires su-privileges. The constructor also builds the list of sessions directories in the sandbox; directories corresponding to terminated sessions are removed if the total number of session directories is larger than fgMaxOldSessions .

Definition at line 47 of file XrdProofdSandbox.cxx.

Member Function Documentation

int XrdProofdSandbox::AddSession ( const char *  tag)

Record entry for new proofserv session tagged 'tag' in the active sessions file (<SandBox>/.sessions).

The file is created if needed. Return 0 on success, -1 on error.

Definition at line 324 of file XrdProofdSandbox.cxx.

Referenced by XrdProofdProofServMgr::Create().

const char* XrdProofdSandbox::Dir ( ) const
inline
const char* XrdProofdSandbox::ErrMsg ( ) const
inline

Definition at line 52 of file XrdProofdSandbox.h.

int XrdProofdSandbox::GetSessionDirs ( int  opt,
std::list< XrdOucString * > *  sdirs,
XrdOucString *  tag = 0 
)

Scan the sandbox for sessions working dirs and return their sorted (according to creation time, first is the newest) list in 'sdirs'.

The option 'opt' may have 3 values: 0 all working dirs are kept 1 active sessions only 2 terminated sessions only 3 search entry containing 'tag' and fill tag with the full entry name; if defined, sdirs is filled Returns -1 otherwise in case of failure. In case of success returns 0 for opt < 3, 1 if found or 0 if not found for opt == 3.

Definition at line 252 of file XrdProofdSandbox.cxx.

Referenced by GuessTag(), and TrimSessionDirs().

int XrdProofdSandbox::GuessTag ( XrdOucString &  tag,
int  ridx = 1 
)

Guess session tag completing 'tag' (typically "-<pid>") by scanning the active session file or the session dir.

In case of success, tag is filled with the full tag and 0 is returned. In case of failure, -1 is returned.

Definition at line 401 of file XrdProofdSandbox.cxx.

Referenced by XrdProofdAdmin::QueryLogPaths(), and XrdProofdClient::TerminateSessions().

bool XrdProofdSandbox::IsValid ( ) const
inline

Definition at line 53 of file XrdProofdSandbox.h.

Referenced by XrdProofdClient::XrdProofdClient().

int XrdProofdSandbox::RemoveSession ( const char *  tag)

Move record for tag from the active sessions file to the old sessions file (<SandBox>/.sessions).

The active file is removed if empty after the operation. The old sessions file is created if needed. Return 0 on success, -1 on error.

Definition at line 508 of file XrdProofdSandbox.cxx.

Referenced by XrdProofdClient::TerminateSessions(), and TrimSessionDirs().

static void XrdProofdSandbox::SetMaxOldSessions ( int  mxses)
inlinestatic

Definition at line 65 of file XrdProofdSandbox.h.

Referenced by XrdProofdManager::DoDirectiveMaxOldLogs().

static void XrdProofdSandbox::SetWorkdir ( const char *  wdir)
inlinestatic

Definition at line 66 of file XrdProofdSandbox.h.

Referenced by XrdProofdManager::Config().

int XrdProofdSandbox::TrimSessionDirs ( )

If the static fgMaxOldLogs > 0, logs for a fgMaxOldLogs number of sessions are kept in the sandbox; working dirs for sessions in excess are removed.

By default logs for the last 10 sessions are kept; the limit can be changed via the static method XrdProofdClient::SetMaxOldLogs. Return 0 on success, -1 on error.

Definition at line 617 of file XrdProofdSandbox.cxx.

Referenced by XrdProofdClient::TrimSessionDirs(), and XrdProofdSandbox().

Member Data Documentation

bool XrdProofdSandbox::fChangeOwn
private

Definition at line 34 of file XrdProofdSandbox.h.

Referenced by AddSession(), RemoveSession(), and TrimSessionDirs().

XrdOucString XrdProofdSandbox::fDir
private
XrdOucString XrdProofdSandbox::fErrMsg
private

Definition at line 36 of file XrdProofdSandbox.h.

Referenced by ErrMsg(), and XrdProofdSandbox().

int XrdProofdSandbox::fgMaxOldSessions = 10
staticprivate

Definition at line 41 of file XrdProofdSandbox.h.

Referenced by SetMaxOldSessions(), and TrimSessionDirs().

XrdProofUI XrdProofdSandbox::fgUI
staticprivate

Definition at line 43 of file XrdProofdSandbox.h.

Referenced by XrdProofdSandbox().

XrdOucString XrdProofdSandbox::fgWorkdir = ""
staticprivate

Definition at line 42 of file XrdProofdSandbox.h.

Referenced by SetWorkdir(), and XrdProofdSandbox().

XrdProofUI XrdProofdSandbox::fUI
private

Definition at line 38 of file XrdProofdSandbox.h.

Referenced by AddSession(), RemoveSession(), and TrimSessionDirs().

bool XrdProofdSandbox::fValid
private

Definition at line 37 of file XrdProofdSandbox.h.

Referenced by IsValid(), and XrdProofdSandbox().

Collaboration diagram for XrdProofdSandbox:
[legend]

The documentation for this class was generated from the following files: