Versioning (#568)

- removed getClientServerAPIVersion in server (not used)
- removed rxr side (clientversion compatibility check), removed enum as well as it is now done on the client side.
- versionAPI.h
   - GITBRANCH changed to RELEASE
   - dates for all API changed to "sem_version date". Scripts to compile servers modified for this. Empty "branch" name will end up with developer for sem_version.

- Version class with constructor taking in the long version (APILIB date). Other member functions including concise(to get sem_version for new releases and date for old releases), 
  
- bypassing initial tests, also now bypasses the client-rxr compatibility check (at rx_hostname command)

- previously, compatibility between client-det was ensuring both had the same detector API (eg. same APIJUNGFRAU)
   - Now, compatibility only checks APILIB (client side) and detector API(eg. APIJUNGFRAU) (detector side) have same major version. It only does backward compatibility test. Rest is upto user to ensure. 
   - If server is from an older release, it will compare dates like previous implementation (APIJUNGFRAU from both client and det)
 
- - previously, compatibility between client-rxr was ensuring both had the same APIRECEIVER
   - Now, compatibility only checks APILIB (client side) and APIRECEIVER (rxr side) have same major version. It only does backward compatibility test. Rest is upto user to ensure. 
   - If rxr is from an older release, it will compare dates like previous implementation (APIRECEIVER from both client and rxr)

- removed APIGUI, evalVersionVariables.sh, genVersionHeader.sh (not needed or not used)

- clientVersion, rxrversion and detectorserverversion all return strings and not integers (in hex) anymore. Depending if it has semantic versioning, it will print that or the date if it is too old.

- fixed in python (strings for versions)
- check_version function in detector server changed to "initial checks" as it only checks server-firmware compatibility and initial server checks. Client compatibilities are moved to client side.
- --version gives sem_version and date? Is date needed as well. The clientversion, detserverversion and rxrversion API gives only sem_version (no date)
- - formatting
This commit is contained in:
Dhanya Thattil
2022-11-09 11:13:09 +01:00
committed by GitHub
parent b150db0fb3
commit 05f657c106
56 changed files with 609 additions and 414 deletions

View File

@ -51,7 +51,7 @@ ClientInterface::ClientInterface(int portNumber)
make_unique<std::thread>(&ClientInterface::startTCPServer, this);
}
int64_t ClientInterface::getReceiverVersion() { return APIRECEIVER; }
std::string ClientInterface::getReceiverVersion() { return APIRECEIVER; }
/***callback functions***/
void ClientInterface::registerCallBackStartAcquisition(
@ -180,7 +180,6 @@ int ClientInterface::functionTable(){
flist[F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE]= &ClientInterface::get_real_udp_socket_buffer_size;
flist[F_SET_RECEIVER_FRAMES_PER_FILE] = &ClientInterface::set_frames_per_file;
flist[F_GET_RECEIVER_FRAMES_PER_FILE] = &ClientInterface::get_frames_per_file;
flist[F_RECEIVER_CHECK_VERSION] = &ClientInterface::check_version_compatibility;
flist[F_SET_RECEIVER_DISCARD_POLICY] = &ClientInterface::set_discard_policy;
flist[F_GET_RECEIVER_DISCARD_POLICY] = &ClientInterface::get_discard_policy;
flist[F_SET_RECEIVER_PADDING] = &ClientInterface::set_padding_enable;
@ -312,7 +311,9 @@ int ClientInterface::get_last_client_ip(Interface &socket) {
}
int ClientInterface::get_version(Interface &socket) {
return socket.sendResult(getReceiverVersion());
auto version = getReceiverVersion();
version.resize(MAX_STR_LENGTH);
return socket.sendResult(version);
}
int ClientInterface::setup_receiver(Interface &socket) {
@ -1218,33 +1219,6 @@ int ClientInterface::get_frames_per_file(Interface &socket) {
return socket.sendResult(retval);
}
int ClientInterface::check_version_compatibility(Interface &socket) {
auto arg = socket.Receive<int64_t>();
LOG(logDEBUG1) << "Checking versioning compatibility with value " << arg;
int64_t client_requiredVersion = arg;
int64_t rx_apiVersion = APIRECEIVER;
int64_t rx_version = getReceiverVersion();
if (rx_apiVersion > client_requiredVersion) {
std::ostringstream os;
os << "Incompatible versions.\n Client's receiver API Version: (0x"
<< std::hex << client_requiredVersion
<< "). Receiver API Version: (0x" << std::hex
<< ").\n Please update the client!\n";
throw RuntimeError(os.str());
} else if (client_requiredVersion > rx_version) {
std::ostringstream os;
os << "This receiver is incompatible.\n Receiver Version: (0x"
<< std::hex << rx_version << "). Client's receiver API Version: (0x"
<< std::hex << client_requiredVersion
<< ").\n Please update the receiver";
throw RuntimeError(os.str());
} else {
LOG(logINFO) << "Compatibility with Client: Successful";
}
return socket.Send(OK);
}
int ClientInterface::set_discard_policy(Interface &socket) {
auto index = socket.Receive<int>();
if (index < 0 || index > NUM_DISCARD_POLICIES) {

View File

@ -30,7 +30,7 @@ class ClientInterface : private virtual slsDetectorDefs {
public:
virtual ~ClientInterface();
ClientInterface(int portNumber = -1);
int64_t getReceiverVersion();
std::string getReceiverVersion();
//***callback functions***
/** params: file path, file name, file index, image size */
@ -128,7 +128,6 @@ class ClientInterface : private virtual slsDetectorDefs {
int get_real_udp_socket_buffer_size(ServerInterface &socket);
int set_frames_per_file(ServerInterface &socket);
int get_frames_per_file(ServerInterface &socket);
int check_version_compatibility(ServerInterface &socket);
int set_discard_policy(ServerInterface &socket);
int get_discard_policy(ServerInterface &socket);
int set_padding_enable(ServerInterface &socket);

View File

@ -71,8 +71,7 @@ Receiver::Receiver(int argc, char *argv[]) : tcpipInterface(nullptr) {
break;
case 'v':
std::cout << "SLS Receiver Version: " << GITBRANCH << " (0x"
<< std::hex << APIRECEIVER << ")" << std::endl;
std::cout << "SLS Receiver Version: " << APIRECEIVER << std::endl;
LOG(logINFOBLUE) << "Exiting [ Tid: " << gettid() << " ]";
exit(EXIT_SUCCESS);
@ -124,7 +123,7 @@ Receiver::Receiver(int tcpip_port_no) {
tcpipInterface = make_unique<ClientInterface>(tcpip_port_no);
}
int64_t Receiver::getReceiverVersion() {
std::string Receiver::getReceiverVersion() {
return tcpipInterface->getReceiverVersion();
}