diff --git a/Cargo.lock b/Cargo.lock index 1099912..a1ee8b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -487,6 +487,7 @@ name = "orb-relay-messages" version = "0.0.0" dependencies = [ "prost", + "prost-types", "tonic", "tonic-build", ] diff --git a/proto/dataxchg/dataxchg.proto b/proto/dataxchg/dataxchg.proto new file mode 100644 index 0000000..38a600d --- /dev/null +++ b/proto/dataxchg/dataxchg.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +package dataxchg; + +import "google/protobuf/timestamp.proto"; + +// Indirect references to specific data sources +enum DataSource { + DATA_SOURCE_UNDEFINED = 0; + LATEST_SCAN_IMAGE = 1; + ORB_CONFIG = 2; +} + +// binary format of source data +enum DataFormat { + DATA_FORMAT_UNDEFINED = 0; + JSON = 1; + CSV = 2; + PNG = 3; + JPEG = 4; + TEXT = 5; + RAW = 6; +} + +// Reference to data source to be exchanged +message DataReference { + oneof source { + DataSource data_source = 1; + string file_path = 2; + } +} + +// Metadata for data source +message DataSourceMetadata { + DataSource source = 1; + string file_path = 2; + DataFormat format = 3; + google.protobuf.Timestamp last_modified = 4; + uint32 size = 5; +} + +// +// Data exchange messages +// + +// Request to pull metadata for a data source +message OrbRelayDataMetadataPull { DataReference reference = 1; } + +// Request to pull full data from a data source +message OrbRelayDataExchangePull { DataReference reference = 1; } + +// Provide metadata for a data source +message OrbRelayDataMetadataPush { DataSourceMetadata source_metadata = 1; } + +// Provide full data from a data source +message OrbRelayDataExchangePush { + DataSourceMetadata metadata = 1; + bytes data = 2; // bytes will be encoded in the format specified in metadata.format +} diff --git a/proto/relay.proto b/proto/relay.proto index 35676b7..221e03e 100644 --- a/proto/relay.proto +++ b/proto/relay.proto @@ -4,6 +4,7 @@ package relay; import "config/backend.proto"; import "config/orb.proto"; +import "dataxchg/dataxchg.proto"; import "self_serve/app.proto"; import "self_serve/orb.proto"; @@ -54,6 +55,7 @@ message OrbCommand { oneof command { selfserve.OrbStartSelfServeSignupCommand orb_start_self_serve_signup_command = 1; config.OrbReceiveConfigUpdate orb_receive_config_update = 2; + dataxchg.OrbRelayDataExchangePull orb_relay_data_exchange_pull = 3; } } @@ -63,6 +65,7 @@ message OrbEvent { selfserve.OrbSelfServeSessionStartedEvent orb_self_serve_session_started_event = 2; selfserve.OrbSignupStartedEvent orb_signup_started_event = 3; selfserve.OrbSignupCompletedEvent orb_signup_completed_event = 4; + dataxchg.OrbRelayDataExchangePush orb_relay_data_exchange_push = 5; } } @@ -73,6 +76,7 @@ message AppCommand { selfserve.NotifyAppSignupStartedCommand notify_app_signup_started_command = 3; selfserve.AppReceiveSignupResultCommand app_receive_signup_result_command = 4; selfserve.AppShowStartSignupButtonCommand app_show_start_signup_button_command = 5; + dataxchg.OrbRelayDataExchangePull orb_relay_data_exchange_pull = 6; } } @@ -81,17 +85,20 @@ message AppEvent { AppConnectRequestEvent app_connect_request_event = 1; selfserve.AppRequestStartSelfServeFlowEvent app_request_start_self_serve_flow_event = 2; selfserve.AppRequestStartSignupEvent app_request_start_signup_event = 3; + dataxchg.OrbRelayDataExchangePush orb_relay_data_exchange_push = 4; } } message BackendEvent { oneof event { config.OrbUpdateConfigRequest orb_update_config_request = 1; + dataxchg.OrbRelayDataExchangePull orb_relay_data_exchange_pull = 2; } } message BackendCommand { oneof command { config.OrbUpdateConfigResponse orb_update_config_response = 1; + dataxchg.OrbRelayDataExchangePush orb_relay_data_exchange_push = 2; } } diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 677c326..394a7ae 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -12,6 +12,7 @@ server = [] [dependencies] prost = "0.12.6" +prost-types = "0.12.6" tonic = "0.11.0" [build-dependencies] diff --git a/rust/build.rs b/rust/build.rs index d10aa52..8b8d44d 100644 --- a/rust/build.rs +++ b/rust/build.rs @@ -13,6 +13,7 @@ fn main() { "../proto/self_serve/orb.proto", "../proto/config/backend.proto", "../proto/config/orb.proto", + "../proto/dataxchg/dataxchg.proto", ], &["../proto"], ) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index a574b61..6de5dc3 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -12,3 +12,7 @@ pub mod selfserve { pub mod config { tonic::include_proto!("config"); } + +pub mod dataxchg { + tonic::include_proto!("dataxchg"); +}