XRootD
Loading...
Searching...
No Matches
XrdCmsCache.hh
Go to the documentation of this file.
1#ifndef __CMS_CACHE__H
2#define __CMS_CACHE__H
3/******************************************************************************/
4/* */
5/* X r d C m s C a c h e . h h */
6/* */
7/* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <cstring>
34
35#include "Xrd/XrdJob.hh"
36#include "Xrd/XrdScheduler.hh"
37#include "XrdCms/XrdCmsKey.hh"
38#include "XrdCms/XrdCmsNash.hh"
39#include "XrdCms/XrdCmsPList.hh"
42#include "XrdCms/XrdCmsTypes.hh"
43
45{
46public:
47friend class XrdCmsCacheJob;
48
50
51// AddFile() returns true if this is the first addition, false otherwise. See
52// method for detailed information on processing.
53//
54int AddFile(XrdCmsSelect &Sel, SMask_t mask);
55
56// DelFile() returns true if this is the last deletion, false otherwise
57//
58int DelFile(XrdCmsSelect &Sel, SMask_t mask);
59
60// GetFile() returns true if we actually found the file
61//
62int GetFile(XrdCmsSelect &Sel, SMask_t mask);
63
64// UnkFile() updates the unqueried vector and returns 1 upon success, 0 o/w.
65//
66int UnkFile(XrdCmsSelect &Sel, SMask_t mask);
67
68// WT4File() adds a request to the callback queue and returns a 0 if added
69// of a wait time to be returned to the client.
70//
71int WT4File(XrdCmsSelect &Sel, SMask_t mask);
72
73void Bounce(SMask_t smask, int SNum);
74
75void Drop(SMask_t mask, int SNum, int xHi);
76
77int Init(int fxHold, int fxDelay, int fxQuery, int seFS, int nxHold);
78
79void *TickTock();
80
81static const int min_nxTime = 60;
82
83 XrdCmsCache() : okVec(0), Tick(8*60*60), Tock(0), BClock(0),
84 nilTMO(0),
85 DLTime(5), QDelay(5), Bhits(0), Bmiss(0), vecHi(-1),
86 isDFS(0)
87 {memset(Bounced, 0, sizeof(Bounced));
88 memset(Bhistory, 0, sizeof(Bhistory));
89 }
90 ~XrdCmsCache() {} // Never gets deleted
91
92private:
93
94void Add2Q(XrdCmsRRQInfo *Info, XrdCmsKeyItem *cp, int selOpts);
95void Dispatch(XrdCmsSelect &Sel, XrdCmsKeyItem *cinfo,
96 short roQ, short rwQ);
97SMask_t getBVec(unsigned int todA, unsigned int &todB);
98void Recycle(XrdCmsKeyItem *theList);
99
100struct {SMask_t Vec;
101 unsigned int Start;
102 unsigned int End;
103 } Bhistory[XrdCmsKeyItem::TickRate];
104
105XrdSysMutex myMutex;
106XrdCmsNash CTable;
107unsigned int Bounced[STMax];
108SMask_t okVec;
109unsigned int Tick;
110unsigned int Tock;
111unsigned int BClock;
112 int nilTMO;
113 int DLTime;
114 int QDelay;
115 int Bhits;
116 int Bmiss;
117 int vecHi;
118 int isDFS;
119};
120
121namespace XrdCms
122{
123extern XrdCmsCache Cache;
124}
125#endif
#define STMax
unsigned long long SMask_t
void Bounce(SMask_t smask, int SNum)
int GetFile(XrdCmsSelect &Sel, SMask_t mask)
int DelFile(XrdCmsSelect &Sel, SMask_t mask)
int AddFile(XrdCmsSelect &Sel, SMask_t mask)
friend class XrdCmsCacheJob
XrdCmsPList_Anchor Paths
int UnkFile(XrdCmsSelect &Sel, SMask_t mask)
void Drop(SMask_t mask, int SNum, int xHi)
int WT4File(XrdCmsSelect &Sel, SMask_t mask)
int Init(int fxHold, int fxDelay, int fxQuery, int seFS, int nxHold)
static const int min_nxTime
void * TickTock()
static const unsigned int TickRate
Definition XrdCmsKey.hh:150
XrdCmsCache Cache