Commit 6c5b0f0e authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

cta-dcache: add cancel retrieve request operation

parent dab03c2b
......@@ -190,6 +190,37 @@ Status CtaRpcImpl::Retrieve(::grpc::ServerContext* context, const ::cta::dcache:
return Status::OK;
}
Status CtaRpcImpl::CancelRetrieve(::grpc::ServerContext* context, const ::cta::dcache::rpc::CancelRetrieveRequest* request, ::google::protobuf::Empty* response) {
cta::log::LogContext lc(*m_log);
cta::log::ScopedParamContainer sp(lc);
sp.add("remoteHost", context->peer());
lc.log(cta::log::DEBUG, "CancelRetrieve request");
sp.add("request", "cancel");
auto instance = request->instance().name();
// Unpack message
cta::common::dataStructures::CancelRetrieveRequest cancelRequest;
cancelRequest.requester.name = request->cli().user().username();
cancelRequest.requester.group = request->cli().user().groupname();
cancelRequest.archiveFileID = request->fid();
cancelRequest.retrieveRequestId = request->reqid();
sp.add("instance", instance);
sp.add("username", request->cli().user().username());
sp.add("groupname", request->cli().user().groupname());
sp.add("fileID", request->fid());
sp.add("schedulerJobID", request->reqid());
m_scheduler->abortRetrieve(instance, cancelRequest, lc);
lc.log(cta::log::INFO, "retrieve request canceled.");
return Status::OK;
}
void CtaRpcImpl::run(const std::string server_address) {
ServerBuilder builder;
......
......@@ -48,6 +48,7 @@ public:
Status Archive(::grpc::ServerContext* context, const ::cta::dcache::rpc::ArchiveRequest* request, ::cta::dcache::rpc::ArchiveResponse* response);
Status Retrieve(::grpc::ServerContext* context, const ::cta::dcache::rpc::RetrieveRequest* request, ::cta::dcache::rpc::RetrieveResponse* response);
Status Delete(::grpc::ServerContext* context, const ::cta::dcache::rpc::DeleteRequest* request, ::google::protobuf::Empty* response);
Status CancelRetrieve(::grpc::ServerContext* context, const ::cta::dcache::rpc::CancelRetrieveRequest* request, ::google::protobuf::Empty* response);
};
#endif //CTA_FRONTENDGRPCSVC_H
......@@ -52,7 +52,7 @@ message ArchiveRequest {
}
/*
* ARCHIVE request.
* RETRIEVE request.
*/
message RetrieveRequest {
cta.common.Service instance = 1; // client instance ID
......@@ -62,6 +62,9 @@ message RetrieveRequest {
uint64 archiveId = 5; // tape system unique file ID
}
/*
* DELETE request.
*/
message DeleteRequest {
cta.common.Service instance = 1; // client instance ID
cta.eos.Client cli = 2; // requester information
......@@ -69,11 +72,22 @@ message DeleteRequest {
uint64 archiveId = 4; // tape system unique file ID
}
/*
* CANCEL RETRIEVE request.
*/
message CancelRetrieveRequest {
cta.common.Service instance = 1; // client instance ID
cta.eos.Client cli = 2; // requester information
uint64 fid = 3; // tape system unique file ID
string reqId = 4; // tape request scheduler ID, used to cancel the request
}
service CtaRpc {
rpc Version (google.protobuf.Empty) returns (cta.admin.Version) {}
rpc Archive (ArchiveRequest) returns (ArchiveResponse) {}
rpc Retrieve (RetrieveRequest) returns (RetrieveResponse) {}
rpc Delete (DeleteRequest) returns (google.protobuf.Empty) {}
rpc CancelRetrieve (CancelRetrieveRequest) returns (google.protobuf.Empty) {}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment