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

[EOS-CTA] Updates protobuf following meeting with Andreas

* EOS->CTA is a Notification message
* CTA->EOS is a Response message (sent as Metadata)
* Optional Alert for extra log messages (sent as Alert)
parent a888e5d8
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,19 @@ message Security {
//
// Messages sent from EOS to CTA
// Alert Messages
//
message Alert {
enum Audience { EOSLOG = 0; ENDUSER = 1; }
Audience audience = 1; //< The intended audience of the error message
string message = 2; //< An empty if success, else an error message
}
//
// Messages sent from EOS to CTA Frontend
//
message Workflow {
......@@ -90,56 +102,30 @@ message Notification {
//
// Messages sent from CTA to EOS
// Messages sent from CTA Frontend to EOS
//
message Exception {
enum ErrorCode {
UNKNOWN_ERR = 0; //< Can't determine the cause of the error
SERVER_NO_RSP_ERR = 1; //< No response from server
PB_PARSE_ERR = 2; //< Protocol buffer parse error
// ... define other exception types
}
ErrorCode code = 1; //< Defines what went wrong
string message = 2; //< Additional error text
}
message Xattr {
enum Operation { NONE = 0; GET = 1; ADD = 2; SET = 3; DELETE = 4; }
uint64 fid = 1; //< file id
map<string, string> xattr = 2; //< xattribute map
Operation op = 3; //< operation to execute for this xattr map
}
message Tapereplica {
enum Status { NONE = 0; OFFTAPE = 1; ONTAPE = 2; ONTAPESAVE = 3; }
uint64 fid = 1; //< file id
Status status = 2; //< status for file id
uint64 size = 3; //< File size as recorded on tape, for cross-check
Checksum cks = 4; //< File checksum as computer while writing to tape
}
message Response {
enum ResponseType { EXCEPTION_RSP = 0; XATTR_RSP = 1; TAPEREPLICA_RSP = 2; }
ResponseType rsp_type = 1; //< Encode the type of this reply
oneof response {
Exception exception = 2; //< Something bad happened
Xattr xattr = 3; //< Payload for Xattr response type
Tapereplica tapereplica = 4; //< Payload for Tapereplica response type
enum ResponseType {
RSP_SUCCESS = 0; //< Notification was queued successfully
RSP_ERR_PROTOBUF = 1; //< Framework error caused by Google Protocol Buffers layer
RSP_ERR_XROOT = 2; //< Framework error caused by XRoot protocol layer
RSP_ERR_CTA = 3; //< Server error reported by CTA Frontend
}
ResponseType rsp_type = 1; //< Encode the type of this reply
Alert alert_msg = 2; //< Text of the reply
}
//
// Alert Messages: log messages or responses for the user
// Messages sent from the Tape Server to EOS
//
message Alert {
// What is the purpose of Audience NONE?
enum Audience { NONE = 0; EOSLOG = 1; ENDUSER = 2; }
Audience audience = 1; //< The intended audience of the error message
uint64 code = 2; //< Zero means success, non-zero means error
string message = 3; //< An empty if success, else an error message
}
//message Tapereplica {
// enum Status { NONE = 0; OFFTAPE = 1; ONTAPE = 2; ONTAPESAVE = 3; }
// uint64 fid = 1; //< file id
// Status status = 2; //< status for file id
// uint64 size = 3; //< File size as recorded on tape, for cross-check
// Checksum cks = 4; //< File checksum as computer while writing to tape
//}
......@@ -47,14 +47,13 @@ void RequestProc<eos::wfe::Notification, eos::wfe::Response, eos::wfe::Alert>::E
{
// Instantiate the scheduler
const cta::rdbms::Login catalogueLogin = cta::rdbms::Login::parseFile("/home/mdavis/cernbox/CERNHome/CTAtest/ctatest_image/etc/cta/cta_catalogue_db.conf");
const cta::rdbms::Login catalogueLogin = cta::rdbms::Login::parseFile("/etc/cta/cta_catalogue_db.conf");
const uint64_t nbConns = 10;
const uint64_t nbArchiveFileListingConns = 2;
std::unique_ptr<cta::catalogue::Catalogue> my_catalogue = cta::catalogue::CatalogueFactory::create(catalogueLogin, nbConns, nbArchiveFileListingConns);
//cta::common::Configuration ctaConf("/etc/cta/cta-frontend.conf"),
//ctaConf.getConfEntString("ObjectStore", "BackendPath", nullptr)).release());
std::string backend_str("/tmp/jobStoreXXXXXXX");
cta::common::Configuration ctaConf("/etc/cta/cta-frontend.conf");
std::string backend_str = ctaConf.getConfEntString("ObjectStore", "BackendPath", nullptr);
std::unique_ptr<cta::objectstore::Backend> backend(cta::objectstore::BackendFactory::createBackend(backend_str));
cta::objectstore::BackendPopulator backendPopulator(*backend, "Frontend");
......@@ -128,7 +127,7 @@ void RequestProc<eos::wfe::Notification, eos::wfe::Response, eos::wfe::Alert>::E
{
// Set metadata
m_metadata.set_rsp_type(eos::wfe::Response::XATTR_RSP);
m_metadata.set_rsp_type(eos::wfe::Response::RSP_SUCCESS);
// Output message in Json format (for debugging)
......@@ -156,7 +155,6 @@ void RequestProc<eos::wfe::Notification, eos::wfe::Response, eos::wfe::Alert>::E
// Set alert message
m_alert.set_audience(eos::wfe::Alert::EOSLOG);
m_alert.set_code(1);
m_alert.set_message("Something bad happened");
// Send the alert message
......@@ -180,14 +178,14 @@ void RequestProc<eos::wfe::Notification, eos::wfe::Response, eos::wfe::Alert>::
{
// Set metadata
m_metadata.set_rsp_type(eos::wfe::Response::EXCEPTION_RSP);
m_metadata.set_rsp_type(eos::wfe::Response::RSP_ERR_CTA);
switch(err_num)
{
case PB_PARSE_ERR: m_metadata.mutable_exception()->set_code(eos::wfe::Exception::PB_PARSE_ERR);
}
//switch(err_num)
//{
//case PB_PARSE_ERR: m_metadata.mutable_exception()->set_code(eos::wfe::Exception::PB_PARSE_ERR);
//}
m_metadata.mutable_exception()->set_message(err_text);
m_metadata.mutable_alert_msg()->set_message(err_text);
// Output message in Json format (for debugging)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment