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
34503ff6
Commit
34503ff6
authored
7 years ago
by
Michael Davis
Browse files
Options
Downloads
Patches
Plain Diff
Creates a XrdSsi service
parent
4e233d93
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/Makefile
+6
-1
6 additions, 1 deletion
frontend/Makefile
frontend/test_client.cpp
+47
-21
47 additions, 21 deletions
frontend/test_client.cpp
with
53 additions
and
22 deletions
frontend/Makefile
+
6
−
1
View file @
34503ff6
CPPFLAGS
=
-I
/usr/include/xrootd
-fPIC
-std
=
c++11
LDFLAGS
=
-lXrdSsi-4
-lXrdSsiLib
LINK.o
=
$(
LINK.cc
)
all
:
frontend_ssi.so
all
:
test_client frontend_ssi.so
test_client
:
test_client.o
test_client.o
:
test_client.cpp TestSsiService.h
frontend_ssi.so
:
frontend_ssi.o
$(
LINK.cc
)
-shared
$^
$(
LOADLIBES
)
$(
LDLIBS
)
-o
$@
...
...
This diff is collapsed.
Click to expand it.
frontend/test_client.cpp
+
47
−
21
View file @
34503ff6
#include
<
iostream>
#include
<
unistd.h>
// for sleep
#include
<google/protobuf/util/json_util.h>
// for Json output
#include
"test.pb.h"
#include
"TestSsiService.h"
int
main
(
int
argc
,
char
*
argv
[])
{
using
namespace
std
;
// Obtain a Service Provider
// Verify that the version of the library that we linked against is compatible with the version of
// the headers we compiled against.
const
std
::
string
host
=
"localhost"
;
const
int
port
=
10400
;
GOOGLE_PROTOBUF_VERIFY_VERSION
;
try
{
TestSsiService
test_ssi_service
(
host
,
port
);
}
catch
(
std
::
exception
&
e
)
{
std
::
cerr
<<
"TestSsiService() failed with error: "
<<
e
.
what
()
<<
std
::
endl
;
eos
::
wfe
::
Request
request
;
return
1
;
}
request
.
set_message_text
(
"Archive some file"
);
// Initiate a Request
// Output message in Json format
#if 0
// Requests are always executed in the context of a service. They need to correspond to what the service allows.
google
::
protobuf
::
util
::
JsonPrintOptions
options
;
options
.
add_whitespace
=
true
;
options
.
always_print_primitive_fields
=
true
;
string
jsonNotification
;
google
::
protobuf
::
util
::
MessageToJsonString
(
request
,
&
jsonNotification
,
options
);
cout
<<
"Sending message:"
<<
endl
<<
jsonNotification
;
XrdSsiRequest *theRequest; // Used for demonstration purposes
//
Optional: Delete all global objects allocated by libprotobuf
//
Create a request object (upcast from your implementation)
google
::
protobuf
::
ShutdownProtobufLibrary
();
int reqDLen = 1024;
char reqData[reqDLen];
return
0
;
}
theRequest = new MyRequest(reqData, reqDLen, 5);
// Transfer ownership of the request to the service object
servP->ProcessRequest(*theRequest, theResource);
// MyRequest object handles deletion of the data buffer, we shall never mention this pointer again...
theRequest = NULL;
// Note: it is safe to delete the XrdSsiResource object after ProcessRequest() returns.
#endif
// Wait for the response callback
std
::
cout
<<
"Request sent, going to sleep..."
<<
std
::
endl
;
int
wait_secs
=
40
;
while
(
--
wait_secs
)
{
std
::
cerr
<<
"."
;
sleep
(
1
);
}
std
::
cout
<<
"All done, exiting."
<<
std
::
endl
;
}
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