Skip to content

Commit

Permalink
Move to bindings module.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpfs committed Jun 19, 2024
1 parent f6a05e5 commit c77b2a8
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include!(concat!(env!("OUT_DIR"), "/common.rs"));

use super::{decode_uuid, encode_uuid, Error, ProtoBinding, Result};
use crate::{
protocol::{decode_uuid, encode_uuid, Error, ProtoBinding, Result},
sdk::{
commit::{CommitHash, CommitProof, CommitState},
events::{CheckedPatch, EventRecord},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include!(concat!(env!("OUT_DIR"), "/diff.rs"));

use super::{Error, ProtoBinding, Result};
use crate::{
protocol::{Error, ProtoBinding, Result},
sdk::{
commit::{CommitHash, CommitProof},
events::EventRecord,
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions crates/net/src/protocol/bindings/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
mod common;
mod diff;
mod files;
#[cfg(feature = "listen")]
mod notifications;
mod patch;
#[cfg(feature = "pairing")]
mod relay;
mod scan;
mod sync;

pub use diff::{DiffRequest, DiffResponse};
#[cfg(feature = "listen")]
pub use notifications::ChangeNotification;
pub use patch::{PatchRequest, PatchResponse};
#[cfg(feature = "pairing")]
pub(crate) use relay::{
pairing_message, PairingConfirm, PairingMessage, PairingReady,
PairingRequest, RelayHeader, RelayPacket, RelayPayload,
};
pub use scan::{ScanRequest, ScanResponse};
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include!(concat!(env!("OUT_DIR"), "/patch.rs"));

use super::{Error, ProtoBinding, Result};
use crate::{
protocol::{Error, ProtoBinding, Result},
sdk::{
commit::{CommitHash, CommitProof},
events::{CheckedPatch, EventRecord},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
include!(concat!(env!("OUT_DIR"), "/scan.rs"));

use super::{Error, ProtoBinding, Result};
use crate::{sdk::commit::CommitProof, sync::EventLogType};
use crate::{
protocol::{Error, ProtoBinding, Result},
sdk::commit::CommitProof,
sync::EventLogType,
};

/// Request commit proofs from an event log.
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
include!(concat!(env!("OUT_DIR"), "/sync.rs"));

use super::{decode_uuid, encode_uuid, Error, ProtoBinding, Result};
use crate::sdk::{
commit::Comparison,
events::{Diff, EventRecord, Patch},
};
use crate::sync::{
ChangeSet, MaybeDiff, MergeOutcome, Origin, SyncCompare, SyncDiff,
SyncPacket, SyncStatus, UpdateSet,
use crate::{
protocol::{decode_uuid, encode_uuid, Error, ProtoBinding, Result},
sdk::{
commit::Comparison,
events::{Diff, EventRecord, Patch},
},
sync::{
ChangeSet, MaybeDiff, MergeOutcome, Origin, SyncCompare, SyncDiff,
SyncPacket, SyncStatus, UpdateSet,
},
};
use indexmap::{IndexMap, IndexSet};
use std::collections::HashMap;
Expand Down
25 changes: 4 additions & 21 deletions crates/net/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,14 @@
//
// A 64-bit machine is assumed as we cast between `u64` and `usize`
// for convenience, the code may panic on 32-bit machines.
mod common;
mod diff;

mod bindings;
mod error;
mod files;
#[cfg(feature = "listen")]
mod notifications;
mod patch;
#[cfg(feature = "pairing")]
mod relay;
mod scan;
mod sync;

pub use diff::{DiffRequest, DiffResponse};

pub use bindings::*;
pub use error::Error;
#[cfg(feature = "listen")]
pub use notifications::ChangeNotification;
pub use patch::{PatchRequest, PatchResponse};
#[cfg(feature = "pairing")]
pub(crate) use relay::{
pairing_message, PairingConfirm, PairingMessage, PairingReady,
PairingRequest, RelayHeader, RelayPacket, RelayPayload,
};

use prost::{bytes::Buf, Message};
pub use scan::{ScanRequest, ScanResponse};

/// Result type for the wire protocol.
pub type Result<T> = std::result::Result<T, Error>;
Expand Down
1 change: 0 additions & 1 deletion crates/sdk/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub use self::log::{
EventRecord, FolderEventLog, FolderReducer, MemoryData, MemoryEventLog,
MemoryFolderLog, MemoryLog,
};
use crate::vault::VaultId;

#[cfg(feature = "device")]
pub use self::log::{DeviceEventLog, DeviceReducer};
Expand Down

0 comments on commit c77b2a8

Please sign in to comment.