Skip to content

Commit ba74cb5

Browse files
committed
Move EventLogType to sos-core.
1 parent f717978 commit ba74cb5

File tree

13 files changed

+47
-48
lines changed

13 files changed

+47
-48
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/core/src/events/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ pub use read::ReadEvent;
3131
pub use record::EventRecord;
3232
pub use write::WriteEvent;
3333

34+
/// Types of event logs.
35+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
36+
pub enum EventLogType {
37+
/// Identity folder event log.
38+
Identity,
39+
/// Account event log.
40+
Account,
41+
/// Device event log.
42+
Device,
43+
/// Files event log.
44+
#[cfg(feature = "files")]
45+
Files,
46+
/// Folder event log.
47+
Folder(crate::VaultId),
48+
}
49+
3450
/// Trait for events that can be written to an event log.
3551
pub trait LogEvent {
3652
/// Get the event kind for this event.

crates/net/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ sos-protocol = { workspace = true, features = ["network-client"] }
5555
sos-signer.workspace = true
5656
sos-sync.workspace = true
5757
sos-vault.workspace = true
58+
sos-vfs.workspace = true
5859

5960
sos-audit = { workspace = true, optional = true }
6061
sos-search = { workspace = true, optional = true }

crates/net/src/account/network_account.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,23 @@ use sos_core::{
1616
commit::{CommitHash, CommitState},
1717
AccountId, Origin, RemoteOrigins, SecretId, VaultId,
1818
};
19+
use sos_core::{
20+
crypto::{AccessKey, Cipher, KeyDerivation},
21+
device::{DevicePublicKey, TrustedDevice},
22+
events::{EventLog, EventLogType, EventRecord},
23+
AccountRef, Paths, PublicIdentity,
24+
};
25+
use sos_login::device::{DeviceManager, DeviceSigner};
1926
use sos_protocol::{
2027
AccountSync, DiffRequest, RemoteSync, RemoteSyncHandler, SyncClient,
2128
SyncOptions, SyncResult,
2229
};
23-
use sos_sdk::{
24-
crypto::{AccessKey, Cipher, KeyDerivation},
25-
device::{DeviceManager, DevicePublicKey, DeviceSigner, TrustedDevice},
26-
events::{EventLog, EventRecord},
27-
identity::{AccountRef, PublicIdentity},
28-
vault::{
29-
secret::{Secret, SecretMeta, SecretRow},
30-
Summary, Vault, VaultCommit, VaultFlags,
31-
},
32-
vfs, Paths,
30+
use sos_sync::{CreateSet, StorageEventLogs, UpdateSet};
31+
use sos_vault::{
32+
secret::{Secret, SecretMeta, SecretRow},
33+
Summary, Vault, VaultCommit, VaultFlags,
3334
};
34-
use sos_sync::{CreateSet, EventLogType, StorageEventLogs, UpdateSet};
35+
use sos_vfs as vfs;
3536
use std::{
3637
collections::{HashMap, HashSet},
3738
path::{Path, PathBuf},

crates/protocol/src/bindings/common.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ use crate::{decode_uuid, encode_uuid, Error, ProtoBinding, Result};
44
use rs_merkle::{algorithms::Sha256, MerkleProof};
55
use sos_core::{
66
commit::{CommitHash, CommitProof, CommitState},
7-
events::{patch::CheckedPatch, EventRecord},
7+
events::{patch::CheckedPatch, EventLogType, EventRecord},
88
SecretPath, UtcDateTime,
99
};
10-
use sos_sync::EventLogType;
1110
use time::{Duration, OffsetDateTime};
1211

1312
impl ProtoBinding for UtcDateTime {

crates/protocol/src/bindings/diff.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ include!(concat!(env!("OUT_DIR"), "/diff.rs"));
33
use crate::{Error, ProtoBinding, Result};
44
use sos_core::{
55
commit::{CommitHash, CommitProof},
6-
events::EventRecord,
6+
events::{EventLogType, EventRecord},
77
};
8-
use sos_sync::EventLogType;
98

109
/// Request commit diff from an event log.
1110
#[derive(Debug, Clone, PartialEq, Eq)]

crates/protocol/src/bindings/patch.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ include!(concat!(env!("OUT_DIR"), "/patch.rs"));
33
use crate::{Error, ProtoBinding, Result};
44
use sos_core::{
55
commit::{CommitHash, CommitProof},
6-
events::{patch::CheckedPatch, EventRecord},
6+
events::{patch::CheckedPatch, EventLogType, EventRecord},
77
};
8-
use sos_sync::EventLogType;
98

109
/// Request to patch an event log from a specific commit.
1110
///

crates/protocol/src/bindings/scan.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
include!(concat!(env!("OUT_DIR"), "/scan.rs"));
22

33
use crate::{Error, ProtoBinding, Result};
4-
use sos_core::commit::CommitProof;
5-
use sos_sync::EventLogType;
4+
use sos_core::{commit::CommitProof, events::EventLogType};
65

76
/// Request commit proofs from an event log.
87
#[derive(Debug, Clone, PartialEq, Eq)]

crates/protocol/src/sync/auto_merge.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ use sos_core::{
1212
patch::{
1313
AccountDiff, CheckedPatch, DeviceDiff, Diff, FolderDiff, Patch,
1414
},
15-
AccountEvent, DeviceEvent, EventLog, EventRecord, WriteEvent,
15+
AccountEvent, DeviceEvent, EventLog, EventLogType, EventRecord,
16+
WriteEvent,
1617
},
1718
VaultId,
1819
};
1920
use sos_sync::{
20-
EventLogType, ForceMerge, MaybeConflict, Merge, MergeOutcome,
21-
StorageEventLogs, SyncDirection, SyncStatus,
21+
ForceMerge, MaybeConflict, Merge, MergeOutcome, StorageEventLogs,
22+
SyncDirection, SyncStatus,
2223
};
2324
use std::collections::HashSet;
2425
use tracing::instrument;

crates/storage/server/src/server_helpers.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
use binary_stream::futures::{Decodable, Encodable};
33
use futures::{pin_mut, StreamExt};
44
use sos_backend::BackendEventLog;
5-
use sos_core::events::EventLog;
65
use sos_core::events::{
76
patch::{AccountDiff, CheckedPatch, DeviceDiff, FolderDiff, Patch},
8-
AccountEvent, DeviceEvent, EventRecord, WriteEvent,
7+
AccountEvent, DeviceEvent, EventLog, EventLogType, EventRecord,
8+
WriteEvent,
99
};
1010
use sos_protocol::{
1111
DiffRequest, DiffResponse, PatchRequest, PatchResponse, ScanRequest,
1212
ScanResponse,
1313
};
14-
use sos_sync::{
15-
EventLogType, MergeOutcome, StorageEventLogs, SyncPacket, SyncStorage,
16-
};
14+
use sos_sync::{MergeOutcome, StorageEventLogs, SyncPacket, SyncStorage};
1715

1816
#[cfg(feature = "files")]
1917
use sos_core::events::{patch::FileDiff, FileEvent};

crates/sync/src/types.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use sos_core::{
1212
AccountDiff, AccountPatch, DeviceDiff, DevicePatch, FolderDiff,
1313
FolderPatch,
1414
},
15-
AccountEvent, DeviceEvent, WriteEvent,
15+
AccountEvent, DeviceEvent, EventLogType, WriteEvent,
1616
},
1717
};
1818
use std::collections::HashMap;
@@ -26,22 +26,6 @@ use sos_core::{
2626
ExternalFile, ExternalFileName, SecretPath,
2727
};
2828

29-
/// Types of event logs.
30-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
31-
pub enum EventLogType {
32-
/// Identity folder event log.
33-
Identity,
34-
/// Account event log.
35-
Account,
36-
/// Device event log.
37-
Device,
38-
/// Files event log.
39-
#[cfg(feature = "files")]
40-
Files,
41-
/// Folder event log.
42-
Folder(VaultId),
43-
}
44-
4529
/// Combined sync status, diff and comparisons.
4630
#[derive(Debug, Default, Clone, PartialEq, Eq)]
4731
pub struct SyncPacket {

tests/integration/tests/auto_merge/scan_commits.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::test_utils::{mock, simulate_device, spawn, teardown};
22
use anyhow::Result;
33
use sos_account::Account;
4-
use sos_core::commit::Comparison;
4+
use sos_core::{commit::Comparison, events::EventLogType};
55
use sos_protocol::{RemoteSyncHandler, ScanRequest, SyncClient};
66
use sos_sdk::prelude::*;
7-
use sos_sync::{EventLogType, StorageEventLogs};
7+
use sos_sync::StorageEventLogs;
88

99
/// Tests scanning commit hashes on remote servers.
1010
#[tokio::test]

tests/unit/src/tests/protocol_encoding.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ use sos_core::events::{
77
};
88
use sos_core::{
99
commit::{CommitHash, CommitProof, CommitState},
10+
events::EventLogType,
1011
AccountId, Origin, SecretPath, UtcDateTime, VaultId,
1112
};
1213
use sos_protocol::{
1314
DiffRequest, DiffResponse, PatchRequest, PatchResponse, ScanRequest,
1415
ScanResponse, WireEncodeDecode,
1516
};
1617
use sos_sync::{
17-
CreateSet, EventLogType, MaybeDiff, MergeOutcome, SyncCompare, SyncDiff,
18-
SyncPacket, SyncStatus, UpdateSet,
18+
CreateSet, MaybeDiff, MergeOutcome, SyncCompare, SyncDiff, SyncPacket,
19+
SyncStatus, UpdateSet,
1920
};
2021

2122
const HASH: &str =

0 commit comments

Comments
 (0)