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
c4dcda55
Commit
c4dcda55
authored
9 years ago
by
Eric Cano
Browse files
Options
Downloads
Plain Diff
Merge remote branch 'origin/master'
parents
b6d38593
3ffb3b2b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
remotens/CMakeLists.txt
+6
-0
6 additions, 0 deletions
remotens/CMakeLists.txt
remotens/EosNS.cpp
+88
-0
88 additions, 0 deletions
remotens/EosNS.cpp
remotens/EosNS.hpp
+98
-0
98 additions, 0 deletions
remotens/EosNS.hpp
with
192 additions
and
0 deletions
remotens/CMakeLists.txt
+
6
−
0
View file @
c4dcda55
cmake_minimum_required
(
VERSION 2.6
)
set
(
CTA_REMOTENS_SRC_FILES
EosNS.cpp
MockRemoteNS.cpp
RemoteNS.cpp
RemoteNSDispatcher.cpp
)
...
...
@@ -8,6 +9,11 @@ set (CTA_REMOTENS_SRC_FILES
add_library
(
ctaremotens SHARED
${
CTA_REMOTENS_SRC_FILES
}
)
find_package
(
xrootd REQUIRED
)
include_directories
(
${
XROOTD_INCLUDE_DIR
}
${
XROOTD_PRIVATE_INCLUDE_DIR
}
${
CMAKE_SOURCE_DIR
}
)
target_link_libraries
(
ctaremotens
${
XROOTD_XRDCL_LIB
}
ctacommon cryptopp
)
add_library
(
ctaremotenstest SHARED
MockRemoteNS.cpp
MockRemoteNSFactory.cpp
...
...
This diff is collapsed.
Click to expand it.
remotens/EosNS.cpp
0 → 100644
+
88
−
0
View file @
c4dcda55
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<map>
#include
<stdio.h>
#include
<sys/stat.h>
#include
<sys/types.h>
#include
<unistd.h>
#include
"common/exception/Exception.hpp"
#include
"common/RemotePath.hpp"
#include
"common/Utils.hpp"
#include
"remotens/EosNS.hpp"
#include
<cryptopp/base64.h>
#include
<cryptopp/osrng.h>
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
EosNS
::
EosNS
(
const
std
::
string
&
XrootServerURL
)
:
m_fs
(
XrdCl
::
URL
(
XrootServerURL
))
{
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta
::
EosNS
::~
EosNS
()
throw
()
{
}
//------------------------------------------------------------------------------
// statFile
//------------------------------------------------------------------------------
std
::
unique_ptr
<
cta
::
RemoteFileStatus
>
cta
::
EosNS
::
statFile
(
const
RemotePath
&
path
)
{
XrdCl
::
StatInfo
*
stat_res
=
NULL
;
XrdCl
::
XRootDStatus
s
=
m_fs
.
Stat
(
path
.
getAfterScheme
(),
stat_res
,
0
);
if
(
!
s
.
IsOK
())
{
delete
stat_res
;
return
std
::
unique_ptr
<
RemoteFileStatus
>
();
}
UserIdentity
owner
(
0
,
0
);
cta
::
RemoteFileStatus
*
rfs
=
new
cta
::
RemoteFileStatus
(
owner
,
stat_res
->
GetFlags
(),
stat_res
->
GetSize
());
delete
stat_res
;
return
std
::
unique_ptr
<
RemoteFileStatus
>
(
rfs
);
}
//------------------------------------------------------------------------------
// rename
//------------------------------------------------------------------------------
void
cta
::
EosNS
::
rename
(
const
RemotePath
&
remoteFile
,
const
RemotePath
&
newRemoteFile
)
{
}
//------------------------------------------------------------------------------
// getFilename
//------------------------------------------------------------------------------
std
::
string
cta
::
EosNS
::
getFilename
(
const
RemotePath
&
remoteFile
)
const
{
const
std
::
string
afterScheme
=
remoteFile
.
getAfterScheme
();
const
std
::
string
afterSchemeTrimmed
=
Utils
::
trimSlashes
(
afterScheme
);
return
Utils
::
getEnclosedName
(
afterSchemeTrimmed
);
}
//------------------------------------------------------------------------------
// 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
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
remotens/EosNS.hpp
0 → 100644
+
98
−
0
View file @
c4dcda55
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include
"common/RemoteFileStatus.hpp"
#include
"remotens/RemoteNS.hpp"
#include
"XrdCl/XrdClFileSystem.hh"
#include
<map>
namespace
cta
{
/**
* A mock proxy class for the namespace of a remote storage system.
*/
class
EosNS
:
public
RemoteNS
{
public:
/**
* Destructor.
*/
~
EosNS
()
throw
();
/**
* Constructor.
*/
EosNS
(
const
std
::
string
&
XrootServerURL
=
"localhost:1094"
);
/**
* Returns the status of the specified file or directory within the remote
* storage system or NULL if the fil eor directory does not exist.
*
* @param path The absolute path of the file or directory.
* @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
);
/**
* Renames the specified remote file to the specified new name.
*
* @param remoteFile The current path.
* @param newRemoteFile The new path.
*/
void
rename
(
const
RemotePath
&
remoteFile
,
const
RemotePath
&
newRemoteFile
);
/**
* Parses the specified remote file and returns the file name.
*
* @param path The absolute path of the file.
* @return The file name.
*/
std
::
string
getFilename
(
const
RemotePath
&
remoteFile
)
const
;
/**
* Adds a directory or file to the remote NS with the desired status
*
* @param status The desired status of the entry to be created
* @param path The absolute path of the file or directory
*/
void
createEntry
(
const
RemotePath
&
path
,
const
RemoteFileStatus
&
status
);
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
*/
int
sendCommand
(
const
std
::
string
&
cmd
)
const
;
};
// class EosNS
}
// namespace cta
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