Skip to content

Commit

Permalink
Proto file rework for more efficient serialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
KerstinKeller committed Oct 23, 2024
1 parent e54d371 commit 3e071f2
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ecal/core_pb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ========================= eCAL LICENSE =================================
#
# Copyright (C) 2016 - 2019 Continental Corporation
# Copyright (C) 2016 - 2024 Continental Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,7 @@ project(core_pb)
find_package(Protobuf REQUIRED)

set(ProtoFiles
${CMAKE_CURRENT_SOURCE_DIR}/src/ecal/core/pb/common.proto
${CMAKE_CURRENT_SOURCE_DIR}/src/ecal/core/pb/ecal.proto
${CMAKE_CURRENT_SOURCE_DIR}/src/ecal/core/pb/host.proto
${CMAKE_CURRENT_SOURCE_DIR}/src/ecal/core/pb/layer.proto
Expand Down
30 changes: 30 additions & 0 deletions ecal/core_pb/src/ecal/core/pb/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================= eCAL LICENSE =================================
*/

syntax = "proto3";

package eCAL.pb;

message RegistrationID // topic content
{
int64 entity_id = 1; // entity (pub / sub / client / server / process) id
int32 process_id = 2; // process id which produced the sample
string host_name = 3; // host which produced the sample
}

64 changes: 62 additions & 2 deletions ecal/core_pb/src/ecal/core/pb/ecal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,25 @@ enum eCmdType // command type
bct_unreg_process = 14; // unregister process
bct_unreg_service = 15; // unregister service
bct_unreg_client = 16; // unregister client

// The following are registration v2 (eCAL6) commands
bct_reg_process_v2 = 20; // register process
bct_unreg_process_v2 = 21; // unregister process

bct_reg_publisher_v2 = 22; // register publisher
bct_unreg_publisher_v2 = 23; // unregister publisher

bct_reg_subscriber_v2 = 24; // register subscriber
bct_unreg_subscriber_v2 = 25; // unregister subscriber

bct_reg_service_v2 = 26; // register service
bct_unreg_service_v2 = 27; // unregister service

bct_reg_client_v2 = 28; // register client
bct_unreg_client_v2 = 29; // unregister client
}

// TODO Original Sample, should not be used (use instead ContentSample or RegistrationSample)
message Sample // a sample is a topic, it's descriptions and it's content
{
eCmdType cmd_type = 1; // sample command type
Expand All @@ -71,7 +88,50 @@ message Sample // a sample is a topic, it's desc
bytes padding = 8; // padding to artificially increase the size of the message. This is a workaround for TCP topics, to get the actual user-payload 8-byte-aligned. REMOVE ME IN ECAL6
}

message SampleList
// TODO Also deprecated, should not be used anymore
message RegistrationSampleList
{
repeated RegistrationSample samples = 1; // list of Samples used currently by SHM registration
}


message ContentSample // a sample is a topic, it's descriptions and it's content
{
repeated Sample samples = 1; // list of Samples used currently by SHM registration
eCmdType cmd_type = 1; // sample command type
Content content = 6; // topic content
bytes padding = 8; // padding to artificially increase the size of the message. This is a workaround for TCP topics, to get the actual user-payload 8-byte-aligned. REMOVE ME IN ECAL6
}

message RegistrationSample
{
eCmdType cmd_type = 1; // sample command type
Host host = 2; // host information
Process process = 3; // process information
Service service = 4; // service information
Client client = 7; // client information
Topic topic = 5; // topic information
Content content = 6; // topic content
bytes padding = 8; // padding to artificially increase the size of the message. This is a workaround for TCP topics, to get the actual user-payload 8-byte-aligned. REMOVE ME IN ECAL6

ProcessRegistration process_registration = 32;
ProcessUnRegistration process_unregistration = 33;

PublisherRegistration publisher_registration = 34;
PublisherUnregistration publisher_unregistration = 35;

SubscriberRegistration subscriber_registration = 36;
SubscriberUnregistration subscriber_unregistration = 37;

ServiceRegistration service_registration = 38;
ServiceUnregistration service_unregistration = 39;

ClientRegistration client_registration = 40;
ClientUnregistration client_unregistration = 41;

bytes padding_v2 = 125;
}

message RegistrationSampleList
{
repeated RegistrationSample samples = 1; // list of Samples used currently by SHM registration
}
43 changes: 42 additions & 1 deletion ecal/core_pb/src/ecal/core/pb/process.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ syntax = "proto3";

package eCAL.pb;

import "ecal/core/pb/common.proto";

enum eProcessSeverity // process severity
{
proc_sev_unknown = 0; // condition unknown
Expand Down Expand Up @@ -54,7 +56,7 @@ enum eTSyncState // time synchronisatio
tsync_replay = 2; // replay time sync mode
}

message Process // process
message Process // process (eCAL 5 Protocoll)
{
// Reserved fields in enums are not supported in protobuf 3.0
// reserved 7 to 11;
Expand All @@ -75,3 +77,42 @@ message Process // process
string component_init_info = 16; // like comp_init_state as human readable string (pub|sub|srv|mon|log|time|proc)
string ecal_runtime_version = 17; // loaded / runtime eCAL version of a component
}

// Information that will not change
message StaticProcessRegistrationInfo
{
string hgname = 18; // host group name
string pname = 4; // process name
string uname = 5; // unit name
string pparam = 6; // process parameter

string ecal_runtime_version = 17; // loaded / runtime eCAL version of a component
}

// Information that might change
message DynamicProcessRegistrationInfo
{
int32 clock = 1; // registration clock
ProcessState state = 12; // process state info
eTSyncState timesync_state = 13; // time synchronization state
string timesync_module_name = 14; // time synchronization module name
// @TODO maybe static info (depends if we allow to reinit)
int32 component_init_state = 15; // eCAL component initialization state (eCAL::Initialize(..))
string component_init_info = 16; // like comp_init_state as human readable string (pub|sub|srv|mon|log|time|proc)
}


message ProcessRegistration // process (eCAL6 Protocoll)
{
// Reserved fields in enums are not supported in protobuf 3.0
// reserved 7 to 11;
RegistrationID registration_id = 1;

StaticProcessInfo static_info = 2;
DynamicProcessInfo dynamic_info = 3;
}

message ProcessUnRegistration // process (eCAL6 Protocoll)
{
RegistrationID registration_id = 1;
}
63 changes: 63 additions & 0 deletions ecal/core_pb/src/ecal/core/pb/topic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,66 @@ message Topic // eCAL topic

map<string, string> attr = 27; // generic topic description
}


message PubSubStaticInfo
{
DataTypeInformation tdatatype = 1; // topic datatype information (encoding & type & description)
map<string, string> attr = 2; // generic topic description

RegistrationID process = 3;

string host_group_name = 4; // <- should be made available via process? or is this something that we want per publisher for the future?
string uname = 5; // unit name <- we don't need to send this per Subscriber'

}

message TopicStatistics
{
int32 heartbeat = 1; // registration clock (heart beat)
int64 data_clock = 20; // data clock (send / receive action)
float data_freq = 21; // data frequency (send / receive samples per second) [mHz]
int32 connections_loc = 16; // number of local connected entities
int32 connections_ext = 17; // number of external connected entities
int32 message_drops = 18; // dropped messages
int32 tsize = 13; // topic size
}

message PublisherConnectionInformation
{
repeated TLayer tlayer = 1; // active topic transport layers and it's specific parameter
}

message PublisherRegistration
{
RegistrationID registration_id = 1;
string topic_name = 2;

bytes topic_info = 3; // Fixed Publisher Info
bytes statistics = 4; // Publisher Statistics - TopicStatistics
bytes connection_parameters = 5; // Connection Parameters for Subscribers who want to connect
}

message PublisherUnregistration
{
RegistrationID registration_id = 1;
}


message SubscriberRegistration
{
// Reserved fields in enums are not supported in protobuf 3.0
// reserved 7 to 11;
RegistrationID registration_id = 1;
string topic_name = 2;

bytes topic_info = 3; // StaticProcessInfo
bytes statistics = 4; // DynamicProcessInfo
}

message SubscriberUnregistration
{
// Reserved fields in enums are not supported in protobuf 3.0
// reserved 7 to 11;
RegistrationID registration_id = 1;
}

0 comments on commit 3e071f2

Please sign in to comment.