-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use the new XrdPosixCache interface to query cache file info
- Loading branch information
Showing
6 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Author: Wei Yang (SLAC National Accelerator Laboratory / Stanford University, 2019) | ||
*/ | ||
|
||
using namespace std; | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include <string> | ||
#include <errno.h> | ||
#include <iostream> | ||
#include <fcntl.h> | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
#include <unistd.h> | ||
#include "XrdVersion.hh" | ||
#include "XrdOuc/XrdOucCacheCM.hh" | ||
#include "XrdPosix/XrdPosixCache.hh" | ||
|
||
//______________________________________________________________________________ | ||
|
||
|
||
XrdPosixCache *myCache; | ||
|
||
extern "C" { | ||
XrdOucCacheCMInit_t XrdOucCacheCMInit(XrdPosixCache &Cache, | ||
XrdSysLogger *Logger, | ||
const char *Config, | ||
const char *Parms, | ||
XrdOucEnv *envP) | ||
{ | ||
myCache = &Cache; | ||
} | ||
}; | ||
XrdVERSIONINFO(XrdOucCacheCMInit,CacheCM-4-RUCIO); | ||
|
||
int cachedFileIsComplete(std::string url, std::string *localfile) | ||
{ | ||
int rc; | ||
char pfn[1024]; | ||
char *myurl = strdup(url.c_str()); | ||
rc = myCache->CacheQuery(myurl, 0); | ||
myCache->CachePath(myurl, pfn, 1024); | ||
free(myurl); | ||
*localfile = pfn; | ||
return rc; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* | ||
* Author: Wei Yang (SLAC National Accelerator Laboratory / Stanford University, 2019) | ||
*/ | ||
|
||
int cachedFileIsComplete(std::string url, std::string *localpath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters