Skip to content

Commit

Permalink
Remove reducers re-export.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpfs committed Feb 4, 2025
1 parent 8c0fac7 commit 258e58a
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 43 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions crates/backend/src/compact.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
//! Compact folders.
use crate::{
reducers::FolderReducer, BackendEventLog, Error, FolderEventLog, Result,
};
use crate::{BackendEventLog, Error, FolderEventLog, Result};
use sos_core::events::{
patch::{FolderDiff, Patch},
EventLog, EventRecord,
};
use sos_database::db::open_memory;
use sos_filesystem::FolderEventLog as FsFolderEventLog;
use sos_reducers::FolderReducer;
use tempfile::NamedTempFile;

/// Compact a folder event log.
Expand Down
5 changes: 2 additions & 3 deletions crates/backend/src/folder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Folder combines an access point with an event log.
use crate::{
reducers::FolderReducer, AccessPoint, Error, FolderEventLog, Result,
};
use crate::{AccessPoint, Error, FolderEventLog, Result};
use sos_core::{
commit::{CommitHash, CommitState},
crypto::AccessKey,
Expand All @@ -17,6 +15,7 @@ use sos_database::{
VaultDatabaseWriter,
};
use sos_filesystem::VaultFileWriter;
use sos_reducers::FolderReducer;
use sos_vault::{
secret::{Secret, SecretId, SecretMeta, SecretRow},
AccessPoint as VaultAccessPoint, EncryptedEntry, SecretAccess, Vault,
Expand Down
17 changes: 8 additions & 9 deletions crates/backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@ mod server_origins;
mod system_messages;
mod vault_writer;

pub use error::{Error, StorageError};
use sos_core::{AccountId, PublicIdentity};
pub use sos_database as database;
use sos_database::db::{
AccountEntity, AccountRecord, FolderEntity, FolderRecord,
};
pub use sos_filesystem::write_exclusive;
pub use sos_reducers as reducers;

pub use access_point::BackendAccessPoint as AccessPoint;
pub use error::{Error, StorageError};
pub use event_log::{
BackendAccountEventLog as AccountEventLog,
BackendDeviceEventLog as DeviceEventLog, BackendEventLog,
Expand All @@ -35,6 +27,8 @@ pub use folder::Folder;
#[cfg(feature = "preferences")]
pub use preferences::BackendPreferences as Preferences;
pub use server_origins::ServerOrigins;
pub use sos_database as database;
pub use sos_filesystem::write_exclusive;
use sos_vault::Summary;
#[cfg(feature = "system-messages")]
pub use system_messages::SystemMessages;
Expand All @@ -46,6 +40,11 @@ pub use event_log::BackendFileEventLog as FileEventLog;
/// Result type for the library.
pub(crate) type Result<T> = std::result::Result<T, Error>;

use sos_core::{AccountId, PublicIdentity};
use sos_database::db::{
AccountEntity, AccountRecord, FolderEntity, FolderRecord,
};

/// Target backend.
#[derive(Clone)]
pub enum BackendTarget {
Expand Down
1 change: 1 addition & 0 deletions crates/sos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sos-password.workspace = true
sos-protocol = { workspace = true, features = ["full"] }
sos-net = { workspace = true, features = ["full"] }
sos-migrate.workspace = true
sos-reducers.workspace = true
sos-sdk = { workspace = true, features = ["full"] }
sos-preferences.workspace = true
sos-security-report.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/sos/src/commands/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use crate::{
};
use clap::Subcommand;
use sos_account::Account;
use sos_backend::{reducers::FolderReducer, FolderEventLog};
use sos_backend::FolderEventLog;
use sos_core::VaultId;
use sos_reducers::FolderReducer;
use sos_sdk::{
constants::EVENT_LOG_EXT,
crypto::{AccessKey, Cipher, KeyDerivation},
Expand Down
7 changes: 3 additions & 4 deletions crates/storage/client/src/filesystem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use futures::{pin_mut, StreamExt};
use indexmap::IndexSet;
use parking_lot::Mutex;
use sos_backend::{
reducers::FolderReducer, write_exclusive, Folder, StorageError,
compact::compact_folder, write_exclusive, AccountEventLog,
DeviceEventLog, Folder, FolderEventLog, StorageError,
};
use sos_backend::{AccountEventLog, DeviceEventLog, FolderEventLog};
use sos_core::{
commit::{CommitHash, CommitState},
SecretId, VaultId,
Expand All @@ -28,6 +28,7 @@ use sos_core::{
};
use sos_login::{FolderKeys, Identity};
use sos_password::diceware::generate_passphrase;
use sos_reducers::{DeviceReducer, FolderReducer};
use sos_vault::{
secret::{Secret, SecretMeta, SecretRow},
BuilderCredentials, ChangePassword, FolderRef, Header, SecretAccess,
Expand All @@ -52,8 +53,6 @@ use sos_core::{
events::DeviceEvent,
};

use sos_backend::{compact::compact_folder, reducers::DeviceReducer};

#[cfg(feature = "files")]
use {sos_backend::FileEventLog, sos_core::events::FileEvent};

Expand Down
2 changes: 2 additions & 0 deletions crates/storage/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ audit = ["sos-audit", "sos-backend/audit"]
files = [
"sos-external-files",
"sos-backend/files",
"sos-reducers/files",
"sos-sync/files",
]

Expand All @@ -22,6 +23,7 @@ sos-backend.workspace = true
sos-database.workspace = true
sos-filesystem.workspace = true
sos-protocol.workspace = true
sos-reducers.workspace = true
sos-signer.workspace = true
sos-sync.workspace = true
sos-vault.workspace = true
Expand Down
13 changes: 7 additions & 6 deletions crates/storage/server/src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
use crate::{Error, Result, ServerAccountStorage};
use async_trait::async_trait;
use indexmap::IndexSet;
use sos_backend::reducers::{DeviceReducer, FolderReducer};
use sos_backend::VaultWriter;
use sos_backend::{
AccountEventLog, DeviceEventLog, FileEventLog, FolderEventLog,
};
use sos_core::events::{
patch::FolderPatch, AccountEvent, EventLog, EventRecord, WriteEvent,
VaultWriter,
};
use sos_core::{
decode,
device::{DevicePublicKey, TrustedDevice},
encode, AccountId, Paths, VaultId,
encode,
events::{
patch::FolderPatch, AccountEvent, EventLog, EventRecord, WriteEvent,
},
AccountId, Paths, VaultId,
};
use sos_database::async_sqlite::Client;
use sos_database::db::{
AccountEntity, AccountRow, FolderEntity, FolderRecord, FolderRow,
};
use sos_reducers::{DeviceReducer, FolderReducer};
use sos_sync::{CreateSet, ForceMerge, MergeOutcome, UpdateSet};
use sos_vault::{EncryptedEntry, Summary, Vault};
use sos_vfs as vfs;
Expand Down
7 changes: 3 additions & 4 deletions crates/storage/server/src/database/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ use crate::{database::ServerDatabaseStorage, ServerAccountStorage};
use crate::{Error, Result};
use async_trait::async_trait;
use indexmap::IndexSet;
use sos_backend::reducers::DeviceReducer;
use sos_backend::VaultWriter;
use sos_backend::{
reducers::FolderReducer, AccountEventLog, DeviceEventLog, FileEventLog,
FolderEventLog,
AccountEventLog, DeviceEventLog, FileEventLog, FolderEventLog,
VaultWriter,
};
use sos_core::{
events::{
Expand All @@ -21,6 +19,7 @@ use sos_core::{
use sos_database::db::{
AccountEntity, FolderEntity, FolderRecord, FolderRow,
};
use sos_reducers::{DeviceReducer, FolderReducer};
use sos_sync::{
ForceMerge, Merge, MergeOutcome, StorageEventLogs, SyncStorage,
TrackedChanges,
Expand Down
17 changes: 10 additions & 7 deletions crates/storage/server/src/filesystem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@
use crate::{Error, Result, ServerAccountStorage};
use async_trait::async_trait;
use indexmap::IndexSet;
use sos_backend::reducers::DeviceReducer;
use sos_backend::reducers::FolderReducer;
use sos_backend::VaultWriter;
use sos_backend::{
AccountEventLog, DeviceEventLog, FileEventLog, FolderEventLog,
VaultWriter,
};
use sos_core::events::{patch::FolderPatch, AccountEvent, EventLog};
use sos_core::{
constants::VAULT_EXT,
decode,
device::{DevicePublicKey, TrustedDevice},
encode, AccountId, Paths, VaultId,
encode,
events::{patch::FolderPatch, AccountEvent, EventLog},
AccountId, Paths, VaultId,
};
use sos_reducers::{DeviceReducer, FolderReducer};
use sos_sync::{CreateSet, ForceMerge, MergeOutcome, UpdateSet};
use sos_vault::{EncryptedEntry, Header, Summary, Vault};
use sos_vfs as vfs;
use std::collections::HashSet;
use std::{collections::HashMap, path::PathBuf, sync::Arc};
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
sync::Arc,
};
use tokio::sync::RwLock;

#[cfg(feature = "audit")]
Expand Down
7 changes: 3 additions & 4 deletions crates/storage/server/src/filesystem/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ use crate::{filesystem::ServerFileStorage, ServerAccountStorage};
use crate::{Error, Result};
use async_trait::async_trait;
use indexmap::IndexSet;
use sos_backend::reducers::DeviceReducer;
use sos_backend::VaultWriter;
use sos_backend::{
reducers::FolderReducer, AccountEventLog, DeviceEventLog, FileEventLog,
FolderEventLog,
AccountEventLog, DeviceEventLog, FileEventLog, FolderEventLog,
VaultWriter,
};
use sos_core::{
encode,
Expand All @@ -19,6 +17,7 @@ use sos_core::{
},
VaultId,
};
use sos_reducers::{DeviceReducer, FolderReducer};
use sos_sync::{
ForceMerge, Merge, MergeOutcome, StorageEventLogs, SyncStorage,
TrackedChanges,
Expand Down
2 changes: 2 additions & 0 deletions crates/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ rustdoc-args = ["--cfg", "docsrs"]
full = ["files"]
files = [
"sos-backend/files",
"sos-reducers/files",
]

[dependencies]
sos-core.workspace = true
sos-backend.workspace = true
sos-reducers.workspace = true
sos-vault.workspace = true

thiserror.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/sync/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub trait StorageEventLogs: Send + Sync + 'static {
async fn canonical_files(
&self,
) -> Result<IndexSet<ExternalFile>, Self::Error> {
use sos_backend::reducers::FileReducer;
use sos_reducers::FileReducer;
let files = self.file_log().await?;
let event_log = files.read().await;

Expand Down
1 change: 1 addition & 0 deletions tests/unit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ sos-migrate = { workspace = true, features = ["full"] }
sos-net = { workspace = true, features = ["full"] }
sos-protocol = { workspace = true, features = ["full"] }
sos-recovery.workspace = true
sos-reducers.workspace = true
sos-preferences.workspace = true
sos-search.workspace = true
sos-signer.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/src/tests/sdk/reducer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use anyhow::Result;
use secrecy::ExposeSecret;
use sos_backend::reducers::FolderReducer;
use sos_backend::FolderEventLog;
use sos_core::{
crypto::PrivateKey, decode, events::EventLog, SecretId, VaultCommit,
VaultEntry,
};
use sos_reducers::FolderReducer;
use sos_test_utils::mock;
use sos_vault::{
secret::{Secret, SecretMeta},
Expand Down

0 comments on commit 258e58a

Please sign in to comment.