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
02451a96
Commit
02451a96
authored
7 years ago
by
Michael Davis
Browse files
Options
Downloads
Patches
Plain Diff
[cta_frontend] Sends cta_admin protocol buffer to CTA Frontend endpoint
parent
01e76257
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
cmdline/CMakeLists.txt
+2
-2
2 additions, 2 deletions
cmdline/CMakeLists.txt
cmdline/CtaAdminCmd.cpp
+52
-1
52 additions, 1 deletion
cmdline/CtaAdminCmd.cpp
xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp
+4
-0
4 additions, 0 deletions
xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp
with
58 additions
and
3 deletions
cmdline/CMakeLists.txt
+
2
−
2
View file @
02451a96
...
...
@@ -33,7 +33,7 @@ include_directories (${CMAKE_SOURCE_DIR}/tapeserver/)
#
# Get some extra debug messages on stdout
#
add_definitions(-DXRDSSI_DEBUG)
add_definitions
(
-DXRDSSI_DEBUG
)
find_package
(
xrootd REQUIRED
)
find_package
(
Protobuf3 REQUIRED
)
...
...
@@ -48,7 +48,7 @@ install(TARGETS eoscta_stub DESTINATION usr/bin)
# cta_admin is a drop-in replacement for "cta <admin_command>"
#
add_executable
(
cta_admin CtaAdminCmd.cpp CtaAdminCmdParse.cpp
)
add_executable
(
cta_admin CtaAdminCmd.cpp CtaAdminCmdParse.cpp
Configuration.cpp
)
target_link_libraries
(
cta_admin XrdCtaMessages XrdSsi-4 XrdSsiLib
)
install
(
TARGETS cta_admin DESTINATION usr/bin
)
This diff is collapsed.
Click to expand it.
cmdline/CtaAdminCmd.cpp
+
52
−
1
View file @
02451a96
...
...
@@ -20,11 +20,31 @@
#include
<sstream>
#include
<iostream>
#include
"cmdline/Configuration.hpp"
#include
"CtaAdminCmd.hpp"
#include
"XrdSsiPbDebug.hpp"
// Define XRootD SSI Alert message callback
namespace
XrdSsiPb
{
/*!
* Alert callback.
*
* Defines how Alert messages should be logged
*/
template
<
>
void
RequestCallback
<
cta
::
xrd
::
Alert
>::
operator
()(
const
cta
::
xrd
::
Alert
&
alert
)
{
std
::
cout
<<
"AlertCallback():"
<<
std
::
endl
;
OutputJsonString
(
std
::
cout
,
&
alert
);
}
}
// namespace XrdSsiPb
namespace
cta
{
namespace
admin
{
...
...
@@ -94,8 +114,36 @@ void CtaAdminCmd::send() const
throwUsage
(
ex
.
what
());
}
// Send the Protocol Buffer
#ifdef XRDSSI_DEBUG
XrdSsiPb
::
OutputJsonString
(
std
::
cout
,
&
m_request
.
admincmd
());
#endif
// Get socket address of CTA Frontend endpoint
cta
::
cmdline
::
Configuration
cliConf
(
"/etc/cta/cta-cli.conf"
);
std
::
string
endpoint
=
cliConf
.
getFrontendHostAndPort
();
// Obtain a Service Provider
std
::
string
resource
(
"/ctafrontend"
);
XrdSsiPbServiceType
cta_service
(
endpoint
,
resource
);
// Send the Request to the Service and get a Response
cta
::
xrd
::
Response
response
=
cta_service
.
Send
(
m_request
);
// Handle responses
switch
(
response
.
type
())
{
using
namespace
cta
::
xrd
;
case
Response
::
RSP_SUCCESS
:
std
::
cout
<<
response
.
message_txt
()
<<
std
::
endl
;
break
;
case
Response
::
RSP_ERR_PROTOBUF
:
throw
XrdSsiPb
::
PbException
(
response
.
message_txt
());
case
Response
::
RSP_ERR_CTA
:
throw
std
::
runtime_error
(
response
.
message_txt
());
default:
throw
XrdSsiPb
::
PbException
(
"Invalid response type."
);
}
}
...
...
@@ -228,6 +276,9 @@ int main(int argc, const char **argv)
// Send the protocol buffer
cmd
.
send
();
// Delete all global objects allocated by libprotobuf
google
::
protobuf
::
ShutdownProtobufLibrary
();
return
0
;
}
catch
(
XrdSsiPb
::
PbException
&
ex
)
{
std
::
cerr
<<
"Error in Google Protocol Buffers: "
<<
ex
.
what
()
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
xroot_ssi_pb/XrdSsiPbServiceClientSide.hpp
+
4
−
0
View file @
02451a96
...
...
@@ -18,6 +18,10 @@
#pragma once
#ifdef XRDSSI_DEBUG
#include
<iostream>
#endif
#include
<XrdSsi/XrdSsiProvider.hh>
#include
<XrdSsi/XrdSsiService.hh>
#include
"XrdSsiPbException.hpp"
...
...
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