Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
a44c9bc1
Commit
a44c9bc1
authored
Sep 13, 2016
by
Victor Kotlyar
Browse files
Removed unused files
parent
0958f50b
Changes
20
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/tape/Constants.hpp
View file @
a44c9bc1
...
...
@@ -32,24 +32,11 @@
namespace
castor
{
namespace
tape
{
/**
* The conservative umask to be used in the RTCOPY protocol when it makes no
* sense to send one. The RTCOPY protocol sends umask information when
* migrating files from disk to tape and when indicating that more files can
* be requested by RTCPD.
*/
const
mode_t
RTCOPYCONSERVATIVEUMASK
=
077
;
/**
* The full path of the TPCONFIG file which is installed on each tape server.
*/
const
char
*
const
TPCONFIGPATH
=
"/etc/castor/TPCONFIG"
;
/**
* The size in bytes of the VMGR error buffer.
*/
const
size_t
VMGRERRORBUFLEN
=
512
;
}
// namespace tape
}
// namespace castor
...
...
tapeserver/castor/tape/reactor/CMakeLists.txt
View file @
a44c9bc1
...
...
@@ -25,23 +25,17 @@ include_directories(${CMAKE_SOURCE_DIR}/tapeserver)
# Rules to build the reactor code that is common to both rmcd and tapeserverd
################################################################################
set
(
REACTOR_SRC_FILES
PollEventHandler.cpp
PollReactor.cpp
PollReactorImpl.cpp
ZMQPollEventHandler.cpp
ZMQReactor.cpp
)
add_library
(
ctatapereactor
${
REACTOR_SRC_FILES
}
)
target_link_libraries
(
ctatapereactor
)
add_library
(
ctatapereactorutils SHARED
DummyPollEventHandler.cpp
DummyPollReactor.cpp
DummyZMQReactor.cpp
)
install
(
TARGETS ctatapereactorutils DESTINATION usr/
${
CMAKE_INSTALL_LIBDIR
}
)
add_library
(
ctatapereactorunittests SHARED
PollReactorImplTest.cpp
ZMQReactorTest.cpp
)
install
(
TARGETS ctatapereactorunittests DESTINATION usr/
${
CMAKE_INSTALL_LIBDIR
}
)
...
...
tapeserver/castor/tape/reactor/DummyPollEventHandler.cpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include
"castor/tape/reactor/DummyPollEventHandler.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
tape
::
reactor
::
DummyPollEventHandler
::
DummyPollEventHandler
(
const
int
fd
,
const
bool
returnVal
)
throw
()
:
m_fd
(
fd
),
m_returnVal
(
returnVal
)
{
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor
::
tape
::
reactor
::
DummyPollEventHandler
::~
DummyPollEventHandler
()
throw
()
{
}
//------------------------------------------------------------------------------
// getFd
//------------------------------------------------------------------------------
int
castor
::
tape
::
reactor
::
DummyPollEventHandler
::
getFd
()
throw
()
{
return
m_fd
;
}
//------------------------------------------------------------------------------
// fillPollFd
//------------------------------------------------------------------------------
void
castor
::
tape
::
reactor
::
DummyPollEventHandler
::
fillPollFd
(
struct
pollfd
&
fd
)
throw
()
{
fd
.
fd
=
0
;
fd
.
events
=
0
;
fd
.
revents
=
0
;
}
//------------------------------------------------------------------------------
// handleEvent
//------------------------------------------------------------------------------
bool
castor
::
tape
::
reactor
::
DummyPollEventHandler
::
handleEvent
(
const
struct
pollfd
&
fd
)
{
return
m_returnVal
;
}
tapeserver/castor/tape/reactor/DummyPollEventHandler.hpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include
"castor/tape/reactor/PollEventHandler.hpp"
namespace
castor
{
namespace
tape
{
namespace
reactor
{
/**
* This is a dummy poll() event-handler that is intended to be used to write
* unit tests.
*/
class
DummyPollEventHandler
:
public
PollEventHandler
{
public:
/**
* Constructor.
*
* @param fd File descriptor to be returned by getFd().
* @param returnVal The return value of the handleEvent() method.
*/
DummyPollEventHandler
(
const
int
fd
,
const
bool
returnVal
)
throw
();
/**
* Returns the integer file descriptor of this event handler.
*/
int
getFd
()
throw
();
/**
* Sets each of the fields of the specified poll() file-descriptor to 0.
*/
void
fillPollFd
(
struct
pollfd
&
fd
)
throw
();
/**
* Does nothing.
*
* @param fd The poll file-descriptor describing the event.
* @return true if the event handler should be removed from and deleted by
* the reactor.
*/
bool
handleEvent
(
const
struct
pollfd
&
fd
)
;
/**
* Destructor.
*/
~
DummyPollEventHandler
()
throw
();
private:
/**
* File descriptor to be returned by getFd().
*/
const
int
m_fd
;
/**
* The return value of the handleEvent() method.
*/
const
bool
m_returnVal
;
};
// class DummyPollEventHandler
}
// namespace reactor
}
// namespace tape
}
// namespace castor
tapeserver/castor/tape/reactor/DummyPollReactor.cpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include
"castor/tape/reactor/DummyPollReactor.hpp"
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor
::
tape
::
reactor
::
DummyPollReactor
::~
DummyPollReactor
()
throw
()
{
clear
();
}
//------------------------------------------------------------------------------
// clear
//------------------------------------------------------------------------------
void
castor
::
tape
::
reactor
::
DummyPollReactor
::
clear
()
throw
()
{
}
//------------------------------------------------------------------------------
// registerHandler
//------------------------------------------------------------------------------
void
castor
::
tape
::
reactor
::
DummyPollReactor
::
registerHandler
(
PollEventHandler
*
const
handler
)
{
}
//------------------------------------------------------------------------------
// removeHandler
//------------------------------------------------------------------------------
void
castor
::
tape
::
reactor
::
DummyPollReactor
::
removeHandler
(
PollEventHandler
*
const
handler
)
{
}
//------------------------------------------------------------------------------
// handleEvents
//------------------------------------------------------------------------------
void
castor
::
tape
::
reactor
::
DummyPollReactor
::
handleEvents
(
const
int
timeout
)
{
}
tapeserver/castor/tape/reactor/DummyPollReactor.hpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include
"castor/tape/reactor/PollReactor.hpp"
namespace
castor
{
namespace
tape
{
namespace
reactor
{
/**
* A dummy poll() reactor.
*
* The main goal of this class is to facilitate the development of unit tests.
*/
class
DummyPollReactor
:
public
PollReactor
{
public:
/**
* Destructor.
*/
~
DummyPollReactor
()
throw
();
/**
* Removes and deletes all of the event handlers registered with the reactor.
*/
void
clear
()
throw
();
/**
* Registers the specified handler.
*
* Please note that the reactor takes ownership of the handler and will
* delete it as appropriate.
*
* @param handler The handler to be registered.
*/
void
registerHandler
(
PollEventHandler
*
const
handler
);
/**
* Removes the specified handler from the reactor. This method effectively
* does the opposite of registerHandler().
*
* @param handler The handler to be removed.
*/
void
removeHandler
(
PollEventHandler
*
const
handler
);
/**
* Handles any pending events.
*
* @param timeout Timeout in milliseconds.
*/
void
handleEvents
(
const
int
timeout
);
};
// class DummyPollReactor
}
// namespace reactor
}
// namespace tape
}
// namespace castor
tapeserver/castor/tape/reactor/PollEventHandler.cpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include
"castor/tape/reactor/PollEventHandler.hpp"
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor
::
tape
::
reactor
::
PollEventHandler
::~
PollEventHandler
()
throw
()
{
}
tapeserver/castor/tape/reactor/PollEventHandler.hpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include
"common/exception/Exception.hpp"
#include
<poll.h>
namespace
castor
{
namespace
tape
{
namespace
reactor
{
/**
* Handles the events that occur on a poll() file descriptor.
*
* This class is part of an implementation of the Reactor architecture pattern
* described in the following book:
*
* Pattern-Oriented Software Architecture Volume 2
* Patterns for Concurrent and Networked Objects
* Authors: Schmidt, Stal, Rohnert and Buschmann
* Publication date: 2000
* ISBN 0-471-60695-2
*/
class
PollEventHandler
{
public:
/**
* Returns the integer file descriptor of this event handler.
*/
virtual
int
getFd
()
throw
()
=
0
;
/**
* Fills the specified poll file-descriptor ready to be used in a call to
* poll().
*/
virtual
void
fillPollFd
(
struct
pollfd
&
fd
)
throw
()
=
0
;
/**
* Handles the specified event.
*
* @param fd The poll file-descriptor describing the event.
* @return true if the event handler should be removed from and deleted by
* the reactor.
*/
virtual
bool
handleEvent
(
const
struct
pollfd
&
fd
)
=
0
;
/**
* Destructor.
*/
virtual
~
PollEventHandler
()
throw
()
=
0
;
};
// class PollEventHandler
}
// namespace reactor
}
// namespace tape
}
// namespace castor
tapeserver/castor/tape/reactor/PollReactor.cpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include
"castor/tape/reactor/PollReactor.hpp"
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor
::
tape
::
reactor
::
PollReactor
::~
PollReactor
()
throw
()
{
}
tapeserver/castor/tape/reactor/PollReactor.hpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include
"castor/tape/reactor/PollEventHandler.hpp"
namespace
castor
{
namespace
tape
{
namespace
reactor
{
/**
* This reactor wraps the poll() system call.
*
* This class is part of an implementation of the Reactor architecture pattern
* described in the following book:
*
* Pattern-Oriented Software Architecture Volume 2
* Patterns for Concurrent and Networked Objects
* Authors: Schmidt, Stal, Rohnert and Buschmann
* Publication date: 2000
* ISBN 0-471-60695-2
*/
class
PollReactor
{
public:
/**
* Destructor.
*/
virtual
~
PollReactor
()
throw
()
=
0
;
/**
* Removes and deletes all of the event handlers registered with the reactor.
*/
virtual
void
clear
()
throw
()
=
0
;
/**
* Registers the specified handler.
*
* Please note that the reactor takes ownership of the handler and will
* delete it as appropriate.
*
* @param handler The handler to be registered. Please note that the handler
* MUST be allocated on the heap because the reactor will own the handler
* and therefore delete it as needed.
*/
virtual
void
registerHandler
(
PollEventHandler
*
const
handler
)
=
0
;
/**
* Handles any pending events.
*
* @param timeout Timeout in milliseconds.
*/
virtual
void
handleEvents
(
const
int
timeout
)
=
0
;
};
// class PollReactor
}
// namespace reactor
}
// namespace tape
}
// namespace castor
tapeserver/castor/tape/reactor/PollReactorImpl.cpp
deleted
100644 → 0
View file @
0958f50b
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include
"common/exception/BadAlloc.hpp"
#include
"castor/tape/reactor/PollReactorImpl.hpp"
#include
"common/SmartArrayPtr.hpp"
#include
"castor/utils/utils.hpp"
#include
<unistd.h>
#include
<poll.h>
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
tape
::
reactor
::
PollReactorImpl
::
PollReactorImpl
(
cta
::
log
::
Logger
&
log
)
throw
()
:
m_log
(
log
)
{
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
castor
::
tape
::
reactor
::
PollReactorImpl
::~
PollReactorImpl
()
throw
()
{
clear
();
}
//------------------------------------------------------------------------------
// clear
//------------------------------------------------------------------------------
void
castor
::
tape
::
reactor
::
PollReactorImpl
::
clear
()
throw
()
{
// Delete all event handlers
for
(
HandlerMap
::
const_iterator
itor
=
m_handlers
.
begin
();
itor
!=
m_handlers
.
end
();
itor
++
)
{
delete
itor
->
second
;
}
// Remove all event handlers
m_handlers
.
clear
();
}
//------------------------------------------------------------------------------
// registerHandler
//------------------------------------------------------------------------------