Skip to content
Snippets Groups Projects
Commit 38e4b98c authored by Michael Davis's avatar Michael Davis
Browse files

[XrdSsi] Renames XRootD + Protobuf generic classes to XrdSsiPb...

parent 01f6dbc6
Branches
Tags
No related merge requests found
......@@ -21,7 +21,7 @@ all: test_client
test_client: test_client.o test.pb.o
test_client.o: test_client.cpp test_client.h XrdSsiServiceClientSide.h TestSsiRequest.h test.pb.h
test_client.o: test_client.cpp test_client.h XrdSsiPbServiceClientSide.h XrdSsiPbRequest.h test.pb.h
test.pb.o: test.pb.cc test.pb.h
......
#ifndef __TEST_SSI_REQUEST_H
#define __TEST_SSI_REQUEST_H
#ifndef __XRD_SSI_PB_REQUEST_H
#define __XRD_SSI_PB_REQUEST_H
#include <XrdSsi/XrdSsiRequest.hh>
template <typename RequestType, typename ResponseType, typename MetadataType, typename AlertType>
class TestSsiRequest : public XrdSsiRequest
class XrdSsiPbRequest : public XrdSsiRequest
{
public:
TestSsiRequest(const std::string &buffer_str, uint16_t timeout=0) : request_buffer(buffer_str.c_str()), request_len(buffer_str.size())
XrdSsiPbRequest(const std::string &buffer_str, uint16_t timeout=0) : request_buffer(buffer_str.c_str()), request_len(buffer_str.size())
{
std::cerr << "Creating TestSsiRequest object, setting timeout=" << timeout << std::endl;
SetTimeOut(timeout);
}
virtual ~TestSsiRequest()
virtual ~XrdSsiPbRequest()
{
std::cerr << "Deleting TestSsiRequest object" << std::endl;
}
......@@ -55,7 +55,7 @@ private:
// Process the response
template<typename RequestType, typename ResponseType, typename MetadataType, typename AlertType>
bool TestSsiRequest<RequestType, ResponseType, MetadataType, AlertType>::ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRespInfo &rInfo)
bool XrdSsiPbRequest<RequestType, ResponseType, MetadataType, AlertType>::ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRespInfo &rInfo)
{
using namespace std;
......@@ -132,7 +132,7 @@ bool TestSsiRequest<RequestType, ResponseType, MetadataType, AlertType>::Process
template<typename RequestType, typename ResponseType, typename MetadataType, typename AlertType>
XrdSsiRequest::PRD_Xeq TestSsiRequest<RequestType, ResponseType, MetadataType, AlertType>::ProcessResponseData(const XrdSsiErrInfo &eInfo, char *myBuff, int myBLen, bool isLast)
XrdSsiRequest::PRD_Xeq XrdSsiPbRequest<RequestType, ResponseType, MetadataType, AlertType>::ProcessResponseData(const XrdSsiErrInfo &eInfo, char *myBuff, int myBLen, bool isLast)
{
using namespace std;
......@@ -177,7 +177,7 @@ XrdSsiRequest::PRD_Xeq TestSsiRequest<RequestType, ResponseType, MetadataType, A
template<typename RequestType, typename ResponseType, typename MetadataType, typename AlertType>
void TestSsiRequest<RequestType, ResponseType, MetadataType, AlertType>::Alert(XrdSsiRespInfoMsg &aMsg)
void XrdSsiPbRequest<RequestType, ResponseType, MetadataType, AlertType>::Alert(XrdSsiRespInfoMsg &aMsg)
{
using namespace std;
......
#ifndef __TEST_SSI_CLIENT_H
#define __TEST_SSI_CLIENT_H
#ifndef __XRD_SSI_PB_SERVICE_CLIENT_SIDE_H
#define __XRD_SSI_PB_SERVICE_CLIENT_SIDE_H
#include <XrdSsi/XrdSsiProvider.hh>
#include <XrdSsi/XrdSsiService.hh>
#include "XrdSsiException.h"
#include "TestSsiRequest.h"
#include "XrdSsiPbRequest.h"
......@@ -24,14 +24,14 @@ extern XrdSsiProvider *XrdSsiProviderClient;
// Convenience object to manage the XRootD SSI service on the client side
template <typename RequestType, typename ResponseType, typename MetadataType, typename AlertType>
class XrdSsiServiceClientSide
class XrdSsiPbServiceClientSide
{
public:
// Service object constructor for the client side
XrdSsiServiceClientSide() = delete;
XrdSsiPbServiceClientSide() = delete;
XrdSsiServiceClientSide(const std::string &hostname, unsigned int port, const std::string &resource,
XrdSsiPbServiceClientSide(const std::string &hostname, unsigned int port, const std::string &resource,
unsigned int server_timeout = default_server_timeout,
unsigned int shutdown_timeout = default_shutdown_timeout) :
resource(resource), server_tmo(server_timeout), shutdown_tmo(shutdown_timeout)
......@@ -46,7 +46,7 @@ public:
// Service object destructor for the client side
virtual ~XrdSsiServiceClientSide();
virtual ~XrdSsiPbServiceClientSide();
// Send a Request to the Service
......@@ -66,7 +66,7 @@ private:
// Destructor
template <typename RequestType, typename ResponseType, typename MetadataType, typename AlertType>
XrdSsiServiceClientSide<RequestType, ResponseType, MetadataType, AlertType>::~XrdSsiServiceClientSide()
XrdSsiPbServiceClientSide<RequestType, ResponseType, MetadataType, AlertType>::~XrdSsiPbServiceClientSide()
{
std::cerr << "Stopping XRootD SSI service...";
......@@ -106,7 +106,7 @@ XrdSsiServiceClientSide<RequestType, ResponseType, MetadataType, AlertType>::~Xr
// Send a Request to the Service
template <typename RequestType, typename ResponseType, typename MetadataType, typename AlertType>
void XrdSsiServiceClientSide<RequestType, ResponseType, MetadataType, AlertType>::send(const RequestType &request)
void XrdSsiPbServiceClientSide<RequestType, ResponseType, MetadataType, AlertType>::send(const RequestType &request)
{
// Serialize the request object
......@@ -119,7 +119,7 @@ void XrdSsiServiceClientSide<RequestType, ResponseType, MetadataType, AlertType>
// Requests are always executed in the context of a service. They need to correspond to what the service allows.
XrdSsiRequest *requestP = new TestSsiRequest<RequestType, ResponseType, MetadataType, AlertType> (request_str, server_tmo);
XrdSsiRequest *requestP = new XrdSsiPbRequest<RequestType, ResponseType, MetadataType, AlertType> (request_str, server_tmo);
// Transfer ownership of the request to the service object
// TestSsiRequest handles deletion of the request buffer, so we can allow the pointer to go out-of-scope
......
......@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
{
// Obtain a Service Provider
XrdSsiServiceType test_ssi_service(host, port, resource);
XrdSsiPbServiceType test_ssi_service(host, port, resource);
// Create a Request object
......@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
}
catch (std::exception& e)
{
std::cerr << "XrdSsiServiceClient failed with error: " << e.what() << std::endl;
std::cerr << "XrdSsiPbServiceClient failed with error: " << e.what() << std::endl;
return 1;
}
......
......@@ -6,15 +6,15 @@
#include <iostream>
#include <unistd.h> // sleep
#include "XrdSsiServiceClientSide.h" // XRootD SSI Service API
#include "test.pb.h" // Auto-generated message types from .proto file
#include "XrdSsiPbServiceClientSide.h" // XRootD SSI Service API
#include "test.pb.h" // Auto-generated message types from .proto file
// Bind the type of the XrdSsiClient to the types defined in the .proto file
typedef XrdSsiServiceClientSide<xrdssi::test::Request, // Request message type
xrdssi::test::Result, // Response message type
xrdssi::test::Metadata, // Metadata message type
xrdssi::test::Alert> // Alert message type
XrdSsiServiceType;
typedef XrdSsiPbServiceClientSide<xrdssi::test::Request, // Request message type
xrdssi::test::Result, // Response message type
xrdssi::test::Metadata, // Metadata message type
xrdssi::test::Alert> // Alert message type
XrdSsiPbServiceType;
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment