Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
feat! add version field to request messages
Lars Wirzenius committed 2 years ago
commit 1e0c9ed755b7de25c17f11cebf88c056681c7295
parent 601abc94d32ad67ee17576256769f2efb7c4efb5
1 file changed +8 -0
modified src/msg.rs
@@ -33,6 +33,10 @@ use radicle::{

use crate::event::{is_patch_update, push_branch, BrokerEvent};

+
// This gets put into every [`Request`] message so the adapter can
+
// detect its getting a message it knows how to handle.
+
const PROTOCOL_VERSION: usize = 1;
+

/// The type of a run identifier. For maximum generality, this is a
/// string rather than an integer.
///
@@ -226,6 +230,7 @@ impl<'a> RequestBuilder<'a> {
        };

        let common = EventCommonFields {
+
            version: PROTOCOL_VERSION,
            event_type,
            repository: Repository {
                id: *rid,
@@ -363,6 +368,9 @@ pub enum EventType {
/// Common fields in all variations of a [`Request`] message.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EventCommonFields {
+
    /// Version of the request message.
+
    pub version: usize,
+

    /// The type of the event.
    pub event_type: EventType,