Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
f907f2bd
Commit
f907f2bd
authored
9 years ago
by
Daniele Kruse
Browse files
Options
Downloads
Patches
Plain Diff
Adding EOS NS
parent
d93d5fe1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
remotens/EosNS.cpp
+32
-11
32 additions, 11 deletions
remotens/EosNS.cpp
remotens/EosNS.hpp
+3
-15
3 additions, 15 deletions
remotens/EosNS.hpp
xroot_plugins/XrdProFilesystem.cpp
+6
-4
6 additions, 4 deletions
xroot_plugins/XrdProFilesystem.cpp
with
41 additions
and
30 deletions
remotens/EosNS.cpp
+
32
−
11
View file @
f907f2bd
...
...
@@ -27,13 +27,16 @@
#include
"common/Utils.hpp"
#include
"remotens/EosNS.hpp"
#include
"XrdCl/XrdClFileSystem.hh"
#include
"XrdCl/XrdClFile.hh"
#include
<cryptopp/base64.h>
#include
<cryptopp/osrng.h>
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
EosNS
::
EosNS
(
const
std
::
string
&
XrootServerURL
)
:
m_
fs
(
XrdCl
::
URL
(
XrootServerURL
)
)
{
cta
::
EosNS
::
EosNS
(
const
std
::
string
&
XrootServerURL
)
:
m_
xrootServer
URL
(
XrootServerURL
)
{
}
//------------------------------------------------------------------------------
...
...
@@ -45,9 +48,10 @@ cta::EosNS::~EosNS() throw() {
//------------------------------------------------------------------------------
// statFile
//------------------------------------------------------------------------------
std
::
unique_ptr
<
cta
::
RemoteFileStatus
>
cta
::
EosNS
::
statFile
(
const
RemotePath
&
path
)
{
std
::
unique_ptr
<
cta
::
RemoteFileStatus
>
cta
::
EosNS
::
statFile
(
const
RemotePath
&
path
)
const
{
XrdCl
::
FileSystem
fs
{
XrdCl
::
URL
(
m_xrootServerURL
)};
XrdCl
::
StatInfo
*
stat_res
=
NULL
;
XrdCl
::
XRootDStatus
s
=
m_
fs
.
Stat
(
path
.
getAfterScheme
(),
stat_res
,
0
);
XrdCl
::
XRootDStatus
s
=
fs
.
Stat
(
path
.
getAfterScheme
(),
stat_res
,
0
);
if
(
!
s
.
IsOK
())
{
delete
stat_res
;
return
std
::
unique_ptr
<
RemoteFileStatus
>
();
...
...
@@ -62,6 +66,11 @@ std::unique_ptr<cta::RemoteFileStatus> cta::EosNS::statFile(const RemotePath &pa
// rename
//------------------------------------------------------------------------------
void
cta
::
EosNS
::
rename
(
const
RemotePath
&
remoteFile
,
const
RemotePath
&
newRemoteFile
)
{
XrdCl
::
FileSystem
fs
{
XrdCl
::
URL
(
m_xrootServerURL
)};
XrdCl
::
XRootDStatus
s
=
fs
.
Mv
(
remoteFile
.
getAfterScheme
(),
newRemoteFile
.
getAfterScheme
());
if
(
!
s
.
IsOK
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
"Error renaming "
)
+
remoteFile
.
getAfterScheme
()
+
" to "
+
newRemoteFile
.
getAfterScheme
()
+
" Reason: "
+
s
.
GetErrorMessage
());
}
}
//------------------------------------------------------------------------------
...
...
@@ -77,12 +86,24 @@ std::string cta::EosNS::getFilename(const RemotePath &remoteFile) const {
// createEntry
//------------------------------------------------------------------------------
void
cta
::
EosNS
::
createEntry
(
const
RemotePath
&
path
,
const
RemoteFileStatus
&
status
)
{
}
//------------------------------------------------------------------------------
// sendCommand
//------------------------------------------------------------------------------
int
cta
::
EosNS
::
sendCommand
(
const
std
::
string
&
cmd
)
const
{
std
::
string
cmdPath
=
"root://localhost:1094//"
;
return
0
;
XrdCl
::
File
newFile
;
XrdCl
::
Access
::
Mode
mode
;
if
(
status
.
mode
&
S_IRUSR
)
mode
|=
XrdCl
::
Access
::
Mode
::
UR
;
if
(
status
.
mode
&
S_IWUSR
)
mode
|=
XrdCl
::
Access
::
Mode
::
UW
;
if
(
status
.
mode
&
S_IXUSR
)
mode
|=
XrdCl
::
Access
::
Mode
::
UX
;
if
(
status
.
mode
&
S_IRGRP
)
mode
|=
XrdCl
::
Access
::
Mode
::
GR
;
if
(
status
.
mode
&
S_IWGRP
)
mode
|=
XrdCl
::
Access
::
Mode
::
GW
;
if
(
status
.
mode
&
S_IXGRP
)
mode
|=
XrdCl
::
Access
::
Mode
::
GX
;
if
(
status
.
mode
&
S_IROTH
)
mode
|=
XrdCl
::
Access
::
Mode
::
OR
;
if
(
status
.
mode
&
S_IWOTH
)
mode
|=
XrdCl
::
Access
::
Mode
::
OW
;
if
(
status
.
mode
&
S_IXOTH
)
mode
|=
XrdCl
::
Access
::
Mode
::
OX
;
std
::
string
eosPath
(
std
::
string
(
"root://"
)
+
m_xrootServerURL
+
"/"
+
path
.
getAfterScheme
());
XrdCl
::
XRootDStatus
s
=
newFile
.
Open
(
eosPath
,
XrdCl
::
OpenFlags
::
Flags
::
Delete
,
mode
);
if
(
!
s
.
IsOK
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
"Error creating EOS file/dir "
)
+
eosPath
+
" Reason: "
+
s
.
GetErrorMessage
());
}
s
=
newFile
.
Close
();
if
(
!
s
.
IsOK
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
"Error closing EOS file/dir "
)
+
eosPath
+
" Reason: "
+
s
.
GetErrorMessage
());
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
remotens/EosNS.hpp
+
3
−
15
View file @
f907f2bd
...
...
@@ -21,8 +21,6 @@
#include
"common/RemoteFileStatus.hpp"
#include
"remotens/RemoteNS.hpp"
#include
"XrdCl/XrdClFileSystem.hh"
#include
<map>
namespace
cta
{
...
...
@@ -51,7 +49,7 @@ public:
* @return The status of the file or directory or NULL if the file or
* directory does not exist.
*/
std
::
unique_ptr
<
RemoteFileStatus
>
statFile
(
const
RemotePath
&
path
);
std
::
unique_ptr
<
RemoteFileStatus
>
statFile
(
const
RemotePath
&
path
)
const
;
/**
* Renames the specified remote file to the specified new name.
...
...
@@ -80,19 +78,9 @@ public:
private:
/**
* The xroot server of EOS
*/
XrdCl
::
FileSystem
m_fs
;
/**
* Sends the command and waits for the reply
*
* @param argc The number of command-line arguments.
* @param argv The command-line arguments.
* @return the return code
* The xroot server URL
*/
int
sendCommand
(
const
std
::
string
&
cmd
)
const
;
std
::
string
m_xrootServerURL
;
};
// class EosNS
}
// namespace cta
This diff is collapsed.
Click to expand it.
xroot_plugins/XrdProFilesystem.cpp
+
6
−
4
View file @
f907f2bd
...
...
@@ -40,6 +40,7 @@
#include
"XrdVersion.hh"
#include
"objectstore/BackendVFS.hpp"
#include
"objectstore/RootEntry.hpp"
#include
"remotens/EosNS.hpp"
#include
<memory>
#include
<iostream>
...
...
@@ -98,17 +99,18 @@ public:
}
g_OStoreDB
(
g_backend
,
g_backendPopulator
.
getAgent
());
cta
::
MockRemoteNS
g_remotens
;
cta
::
EosNS
g_eosNs
(
"localhost:1094"
);
cta
::
CastorNameServer
g_castorNs
;
extern
"C"
{
XrdSfsFileSystem
*
XrdSfsGetFileSystem
(
XrdSfsFileSystem
*
native_fs
,
XrdSysLogger
*
lp
,
const
char
*
configfn
)
{
g_
remoten
s
.
createEntry
(
cta
::
RemotePath
(
"mock://file1"
),
cta
::
RemoteFileStatus
(
cta
::
UserIdentity
(
getuid
(),
getgid
()),
0777
,
12345
));
g_
eosN
s
.
createEntry
(
cta
::
RemotePath
(
"mock://file1"
),
cta
::
RemoteFileStatus
(
cta
::
UserIdentity
(
getuid
(),
getgid
()),
0777
,
12345
));
return
new
XrdProFilesystem
(
new
cta
::
CastorNameServer
()
,
&
g_castorNs
,
&
g_OStoreDB
,
&
g_
remoten
s
);
&
g_
eosN
s
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment