Loading...
Searching...
No Matches
XrdThrottle.hh
Go to the documentation of this file.
#ifndef __XRDTHROTTLE_H_
#define __XRDTHROTTLE_H_
#include <memory>
#include <string>
#include "XrdVersion.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdSfs/XrdSfsInterface.hh"
#include "XrdThrottle/XrdThrottleTrace.hh"
#include "XrdThrottle/XrdThrottleManager.hh"
class XrdSysLogger;
class XrdOucStream;
namespace XrdThrottle {
#if __cplusplus >= 201103L
typedef std::unique_ptr<XrdSfsFile> unique_sfs_ptr;
#else
typedef std::auto_ptr<XrdSfsFile> unique_sfs_ptr;
#endif
class FileSystem;
class File final : public XrdSfsFile {
friend class FileSystem;
public:
virtual int
open(const char *fileName,
XrdSfsFileOpenMode openMode,
mode_t createMode,
const XrdSecEntity *client,
const char *opaque = 0) override;
virtual int
close() override;
virtual int
checkpoint(cpAct act, struct iov *range=0, int n=0) override;
using XrdSfsFile::fctl;
virtual int
fctl(const int cmd,
const char *args,
XrdOucErrInfo &out_error) override;
virtual const char *
FName() override;
virtual int
getMmap(void **Addr, off_t &Size) override;
virtual XrdSfsXferSize
pgRead(XrdSfsFileOffset offset,
char *buffer,
XrdSfsXferSize rdlen,
uint32_t *csvec,
uint64_t opts=0) override;
virtual XrdSfsXferSize
pgRead(XrdSfsAio *aioparm, uint64_t opts=0) override;
virtual XrdSfsXferSize
pgWrite(XrdSfsFileOffset offset,
char *buffer,
XrdSfsXferSize rdlen,
uint32_t *csvec,
uint64_t opts=0) override;
virtual XrdSfsXferSize
pgWrite(XrdSfsAio *aioparm, uint64_t opts=0) override;
virtual int
read(XrdSfsFileOffset fileOffset, // Preread only
XrdSfsXferSize amount) override;
virtual XrdSfsXferSize
read(XrdSfsFileOffset fileOffset,
char *buffer,
XrdSfsXferSize buffer_size) override;
virtual int
read(XrdSfsAio *aioparm) override;
virtual XrdSfsXferSize
write(XrdSfsFileOffset fileOffset,
const char *buffer,
XrdSfsXferSize buffer_size) override;
virtual int
write(XrdSfsAio *aioparm) override;
virtual int
sync() override;
virtual int
sync(XrdSfsAio *aiop) override;
virtual int
stat(struct stat *buf) override;
virtual int
truncate(XrdSfsFileOffset fileOffset) override;
virtual int
getCXinfo(char cxtype[4], int &cxrsz) override;
virtual int
SendData(XrdSfsDio *sfDio,
XrdSfsFileOffset offset,
XrdSfsXferSize size) override;
private:
File(const char *, unique_sfs_ptr, XrdThrottleManager &, XrdSysError &);
virtual
~File();
bool m_is_open{false};
unique_sfs_ptr m_sfs;
int m_uid; // A unique identifier for this user; has no meaning except for the fairshare.
std::string m_loadshed;
std::string m_connection_id; // Identity for the connection; may or may authenticated
std::string m_user;
XrdThrottleManager &m_throttle;
XrdSysError &m_eroute;
};
class FileSystem final : public XrdSfsFileSystem
{
friend XrdSfsFileSystem * XrdSfsGetFileSystem_Internal(XrdSfsFileSystem *, XrdSysLogger *, const char *, XrdOucEnv *);
public:
virtual XrdSfsDirectory *
newDir(char *user=0, int monid=0) override;
virtual XrdSfsFile *
newFile(char *user=0, int monid=0) override;
virtual int
chksum( csFunc Func,
const char *csName,
const char *path,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client = 0,
const char *opaque = 0) override;
virtual int
chmod(const char *Name,
XrdSfsMode Mode,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *opaque = 0) override;
virtual void
Connect(const XrdSecEntity *client = 0) override;
virtual void
Disc(const XrdSecEntity *client = 0) override;
virtual void
EnvInfo(XrdOucEnv *envP) override;
virtual int
exists(const char *fileName,
XrdSfsFileExistence &exists_flag,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *opaque = 0) override;
virtual int
FAttr( XrdSfsFACtl *faReq,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client = 0) override;
virtual int
fsctl(const int cmd,
const char *args,
XrdOucErrInfo &out_error,
const XrdSecEntity *client) override;
virtual int
getChkPSize() override;
virtual int
getStats(char *buff, int blen) override;
virtual const char *
getVersion() override;
virtual int
gpFile( gpfFunc &gpAct,
XrdSfsGPFile &gpReq,
XrdOucErrInfo &eInfo,
const XrdSecEntity *client = 0) override;
virtual int
mkdir(const char *dirName,
XrdSfsMode Mode,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *opaque = 0) override;
virtual int
prepare( XrdSfsPrep &pargs,
XrdOucErrInfo &out_error,
const XrdSecEntity *client = 0) override;
virtual int
rem(const char *path,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *info = 0) override;
virtual int
remdir(const char *dirName,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *info = 0) override;
virtual int
rename(const char *oldFileName,
const char *newFileName,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *infoO = 0,
const char *infoN = 0) override;
virtual int
stat(const char *Name,
struct stat *buf,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *opaque = 0) override;
virtual int
stat(const char *Name,
mode_t &mode,
XrdOucErrInfo &out_error,
const XrdSecEntity *client,
const char *opaque = 0) override;
virtual int
truncate(const char *Name,
XrdSfsFileOffset fileOffset,
XrdOucErrInfo &out_error,
const XrdSecEntity *client = 0,
const char *opaque = 0) override;
private:
static void
Initialize( FileSystem *&fs,
XrdSfsFileSystem *native_fs,
XrdSysLogger *lp,
const char *config_file,
XrdOucEnv *envP);
int
Configure(XrdSysError &, XrdSfsFileSystem *native_fs, XrdOucEnv *envP);
FileSystem();
virtual
~FileSystem();
static FileSystem *m_instance;
XrdSysError m_eroute;
XrdOucTrace m_trace;
std::string m_config_file;
XrdSfsFileSystem *m_sfs_ptr;
bool m_initialized;
XrdThrottleManager m_throttle;
XrdVersionInfo *myVersion;
};
}
#endif
prepare
static void prepare()
Definition XrdClDefaultEnv.cc:58
write
#define write(a, b, c)
Definition XrdPosix.hh:115
mkdir
#define mkdir(a, b)
Definition XrdPosix.hh:74
open
#define open
Definition XrdPosix.hh:76
stat
#define stat(a, b)
Definition XrdPosix.hh:101
rename
#define rename(a, b)
Definition XrdPosix.hh:92
truncate
#define truncate(a, b)
Definition XrdPosix.hh:111
read
#define read(a, b, c)
Definition XrdPosix.hh:82
Mode
int Mode
Definition XrdSecgsiProxy.cc:94
File
XrdOucString File
Definition XrdSecpwdSrvAdmin.cc:159
opts
struct myOpts opts
XrdSfsInterface.hh
XrdSfsMode
int XrdSfsMode
Definition XrdSfsInterface.hh:130
XrdSfsFileExistence
XrdSfsFileExistence
Definition XrdSfsInterface.hh:134
XrdSfsFileOpenMode
int XrdSfsFileOpenMode
Definition XrdSfsInterface.hh:129
XrdSfsFileOffset
long long XrdSfsFileOffset
Definition XrdSfsInterface.hh:128
XrdSfsXferSize
int XrdSfsXferSize
Definition XrdSfsInterface.hh:131
XrdSfsPrep
< Prepare parameters
Definition XrdSfsInterface.hh:173
XrdSysError.hh
XrdThrottleManager.hh
XrdThrottleTrace.hh
XrdOucEnv
Definition XrdOucEnv.hh:42
XrdOucErrInfo
Definition XrdOucErrInfo.hh:101
XrdOucStream
Definition XrdOucStream.hh:47
XrdOucTrace
Definition XrdOucTrace.hh:36
XrdSecEntity
Definition XrdSecEntity.hh:65
XrdSfsAio
Definition XrdSfsAio.hh:59
XrdSfsDio
Definition XrdSfsDio.hh:47
XrdSfsDirectory
Definition XrdSfsInterface.hh:244
XrdSfsFileSystem::XrdSfsFileSystem
XrdSfsFileSystem()
Constructor and Destructor.
Definition XrdSfsInterface.cc:232
XrdSfsFileSystem::csFunc
csFunc
Definition XrdSfsInterface.hh:928
XrdSfsFileSystem::gpfFunc
gpfFunc
Definition XrdSfsInterface.hh:1137
XrdSfsFile
Definition XrdSfsInterface.hh:370
XrdSfsFile::cpAct
cpAct
Definition XrdSfsInterface.hh:433
XrdSfsFile::XrdSfsFile
XrdSfsFile(const char *user=0, int MonID=0)
Definition XrdSfsInterface.hh:779
XrdSfsFile::fctl
virtual int fctl(const int cmd, const char *args, XrdOucErrInfo &eInfo)=0
XrdSfsGPFile
Definition XrdSfsGPFile.hh:37
XrdSysError
Definition XrdSysError.hh:90
XrdSysLogger
Definition XrdSysLogger.hh:53
XrdThrottleManager
Definition XrdThrottleManager.hh:54
XrdThrottle::FileSystem
Definition XrdThrottle.hh:136
XrdThrottle::FileSystem::Connect
virtual void Connect(const XrdSecEntity *client=0) override
Definition XrdThrottleFileSystem.cc:59
XrdThrottle::FileSystem::XrdSfsGetFileSystem_Internal
friend XrdSfsFileSystem * XrdSfsGetFileSystem_Internal(XrdSfsFileSystem *, XrdSysLogger *, const char *, XrdOucEnv *)
Definition XrdThrottleFileSystemConfig.cc:58
XrdThrottle::FileSystem::newFile
virtual XrdSfsFile * newFile(char *user=0, int monid=0) override
Definition XrdThrottleFileSystem.cc:20
XrdThrottle::FileSystem::gpFile
virtual int gpFile(gpfFunc &gpAct, XrdSfsGPFile &gpReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0) override
Definition XrdThrottleFileSystem.cc:123
XrdThrottle::FileSystem::rem
virtual int rem(const char *path, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *info=0) override
Definition XrdThrottleFileSystem.cc:150
XrdThrottle::FileSystem::getStats
virtual int getStats(char *buff, int blen) override
Definition XrdThrottleFileSystem.cc:110
XrdThrottle::FileSystem::EnvInfo
virtual void EnvInfo(XrdOucEnv *envP) override
Definition XrdThrottleFileSystem.cc:71
XrdThrottle::FileSystem::fsctl
virtual int fsctl(const int cmd, const char *args, XrdOucErrInfo &out_error, const XrdSecEntity *client) override
Definition XrdThrottleFileSystem.cc:95
XrdThrottle::FileSystem::Disc
virtual void Disc(const XrdSecEntity *client=0) override
Definition XrdThrottleFileSystem.cc:65
XrdThrottle::FileSystem::getVersion
virtual const char * getVersion() override
Definition XrdThrottleFileSystem.cc:117
XrdThrottle::FileSystem::exists
virtual int exists(const char *fileName, XrdSfsFileExistence &exists_flag, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0) override
Definition XrdThrottleFileSystem.cc:77
XrdThrottle::FileSystem::newDir
virtual XrdSfsDirectory * newDir(char *user=0, int monid=0) override
Definition XrdThrottleFileSystem.cc:13
XrdThrottle::FileSystem::chmod
virtual int chmod(const char *Name, XrdSfsMode Mode, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0) override
Definition XrdThrottleFileSystem.cc:49
XrdThrottle::FileSystem::remdir
virtual int remdir(const char *dirName, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *info=0) override
Definition XrdThrottleFileSystem.cc:159
XrdThrottle::FileSystem::getChkPSize
virtual int getChkPSize() override
Definition XrdThrottleFileSystem.cc:104
XrdThrottle::FileSystem::stat
virtual int stat(const char *Name, struct stat *buf, XrdOucErrInfo &out_error, const XrdSecEntity *client, const char *opaque=0) override
Definition XrdThrottleFileSystem.cc:179
XrdThrottle::FileSystem::chksum
virtual int chksum(csFunc Func, const char *csName, const char *path, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0) override
Definition XrdThrottleFileSystem.cc:38
XrdThrottle::FileSystem::FAttr
virtual int FAttr(XrdSfsFACtl *faReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0) override
Definition XrdThrottleFileSystem.cc:87
XrdThrottle::File::getCXinfo
virtual int getCXinfo(char cxtype[4], int &cxrsz) override
Definition XrdThrottleFile.cc:230
XrdThrottle::File::FileSystem
friend class FileSystem
Definition XrdThrottle.hh:30
XrdThrottle::File::FName
virtual const char * FName() override
Definition XrdThrottleFile.cc:103
XrdThrottle::File::sync
virtual int sync() override
Definition XrdThrottleFile.cc:206
XrdThrottle::File::close
virtual int close() override
Definition XrdThrottleFile.cc:78
XrdThrottle::File::pgWrite
virtual XrdSfsXferSize pgWrite(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize rdlen, uint32_t *csvec, uint64_t opts=0) override
Definition XrdThrottleFile.cc:138
XrdThrottle::File::pgRead
virtual XrdSfsXferSize pgRead(XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize rdlen, uint32_t *csvec, uint64_t opts=0) override
Definition XrdThrottleFile.cc:116
XrdThrottle::File::SendData
virtual int SendData(XrdSfsDio *sfDio, XrdSfsFileOffset offset, XrdSfsXferSize size) override
Definition XrdThrottleFile.cc:236
XrdThrottle::File::checkpoint
virtual int checkpoint(cpAct act, struct iov *range=0, int n=0) override
Definition XrdThrottleFile.cc:85
XrdThrottle::File::getMmap
virtual int getMmap(void **Addr, off_t &Size) override
Definition XrdThrottleFile.cc:109
XrdThrottle::File::fctl
virtual int fctl(const int cmd, const char *args, XrdOucErrInfo &out_error) override
Definition XrdThrottleFile.cc:89
XrdThrottle::File::stat
virtual int stat(struct stat *buf) override
Definition XrdThrottleFile.cc:218
XrdThrottle
Definition XrdThrottle.hh:18
XrdThrottle::unique_sfs_ptr
std::auto_ptr< XrdSfsFile > unique_sfs_ptr
Definition XrdThrottle.hh:23
XrdSfsFACtl
Definition XrdSfsFAttr.hh:73
iov
Definition XrdOucIOVec.hh:65