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//
55
56// DelFile() returns true if this is the last deletion, false otherwise
57//
59
60// GetFile() returns true if we actually found the file
61//
63
64// UnkFile() updates the unqueried vector and returns 1 upon success, 0 o/w.
65//
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//
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);
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;
104
107unsigned int Bounced[STMax];
109unsigned int Tick;
110unsigned int Tock;
111unsigned int BClock;
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
Definition XrdCmsTypes.hh:39
unsigned long long SMask_t
Definition XrdCmsTypes.hh:33
Definition XrdCmsCache.hh:45
void Recycle(XrdCmsKeyItem *theList)
void Dispatch(XrdCmsSelect &Sel, XrdCmsKeyItem *cinfo, short roQ, short rwQ)
int DLTime
Definition XrdCmsCache.hh:113
void Bounce(SMask_t smask, int SNum)
SMask_t getBVec(unsigned int todA, unsigned int &todB)
int GetFile(XrdCmsSelect &Sel, SMask_t mask)
SMask_t okVec
Definition XrdCmsCache.hh:108
int DelFile(XrdCmsSelect &Sel, SMask_t mask)
XrdCmsCache()
Definition XrdCmsCache.hh:83
XrdSysMutex myMutex
Definition XrdCmsCache.hh:105
unsigned int End
Definition XrdCmsCache.hh:102
int AddFile(XrdCmsSelect &Sel, SMask_t mask)
int QDelay
Definition XrdCmsCache.hh:114
int isDFS
Definition XrdCmsCache.hh:118
struct XrdCmsCache::@74 Bhistory[XrdCmsKeyItem::TickRate]
unsigned int BClock
Definition XrdCmsCache.hh:111
friend class XrdCmsCacheJob
Definition XrdCmsCache.hh:47
XrdCmsPList_Anchor Paths
Definition XrdCmsCache.hh:49
int Bmiss
Definition XrdCmsCache.hh:116
unsigned int Tick
Definition XrdCmsCache.hh:109
unsigned int Bounced[STMax]
Definition XrdCmsCache.hh:107
int UnkFile(XrdCmsSelect &Sel, SMask_t mask)
SMask_t Vec
Definition XrdCmsCache.hh:100
int nilTMO
Definition XrdCmsCache.hh:112
void Drop(SMask_t mask, int SNum, int xHi)
int Bhits
Definition XrdCmsCache.hh:115
int vecHi
Definition XrdCmsCache.hh:117
void Add2Q(XrdCmsRRQInfo *Info, XrdCmsKeyItem *cp, int selOpts)
~XrdCmsCache()
Definition XrdCmsCache.hh:90
unsigned int Tock
Definition XrdCmsCache.hh:110
int WT4File(XrdCmsSelect &Sel, SMask_t mask)
int Init(int fxHold, int fxDelay, int fxQuery, int seFS, int nxHold)
static const int min_nxTime
Definition XrdCmsCache.hh:81
unsigned int Start
Definition XrdCmsCache.hh:101
void * TickTock()
XrdCmsNash CTable
Definition XrdCmsCache.hh:106
Definition XrdCmsKey.hh:126
static const unsigned int TickRate
Definition XrdCmsKey.hh:150
Definition XrdCmsNash.hh:36
Definition XrdCmsPList.hh:96
Definition XrdCmsRRQ.hh:47
Definition XrdCmsSelect.hh:44
Definition XrdSysPthread.hh:165
Definition YProtocol.hh:78
XrdCmsCache Cache