#![forbid(unsafe_code)]
mod error;
pub mod proto;
mod push_tree;
pub mod session;
pub mod transport;
pub mod tree;
pub use error::{Error, ErrorCode, Result};
#[doc(hidden)]
pub use proto::{Encoding, Expected, RefOutcome, RefState, RefUpdate};
pub use push_tree::{TreePushOptions, push_tree, push_tree_over_stream, push_tree_prepared};
#[doc(hidden)]
pub use session::{
BoxFuture, Compression, DetachedMetadata, ObjectData, ObjectReader, ObjectSource, PullBody,
PullSession, PushOutcome, PushPhase, PushProgress, PushProgressFn, PushProgressSnapshot,
PushSession, PushStats, ServerInfo, SessionOptions, StreamSession, StreamSessionOptions,
};
#[doc(hidden)]
pub use transport::{Endpoint, PreparedSession, SshAddress, SshOptions, without_userinfo};
const _: fn() = || {
fn assert_send_sync<T: Send + Sync>() {}
assert_send_sync::<Error>();
assert_send_sync::<proto::Message>();
assert_send_sync::<proto::PullHello>();
assert_send_sync::<proto::PullHelloReply>();
assert_send_sync::<proto::GetReply>();
assert_send_sync::<proto::FrameReader<&[u8]>>();
assert_send_sync::<proto::ObjectBody<'static, &[u8]>>();
assert_send_sync::<proto::FrameWriter<Vec<u8>>>();
assert_send_sync::<PushSession>();
assert_send_sync::<PushProgress>();
assert_send_sync::<PushStats>();
assert_send_sync::<PushOutcome>();
assert_send_sync::<ServerInfo>();
assert_send_sync::<ObjectData>();
assert_send_sync::<DetachedMetadata>();
assert_send_sync::<Box<dyn ObjectReader>>();
assert_send_sync::<PreparedSession>();
assert_send_sync::<tree::TreeModel>();
assert_send_sync::<tree::EntryMeta>();
assert_send_sync::<tree::EntryKind>();
assert_send_sync::<tree::EntryAction>();
assert_send_sync::<tree::EntryPath>();
assert_send_sync::<StreamSession>();
assert_send_sync::<PullSession>();
assert_send_sync::<PullBody>();
assert_send_sync::<StreamSessionOptions>();
assert_send_sync::<Endpoint>();
assert_send_sync::<SshAddress>();
assert_send_sync::<SshOptions>();
};
#[allow(dead_code)]
fn stream_session_futures_are_send(
address: &SshAddress,
options: &SshOptions,
session: &StreamSession,
owned: StreamSession,
selector: &ostrya_core::RefSelector,
) {
fn assert_send<T: Send>(_: &T) {}
assert_send(&StreamSession::connect(
address,
options,
StreamSessionOptions::default(),
));
assert_send(&StreamSession::over_stream(
futures_lite::io::empty(),
futures_lite::io::sink(),
StreamSessionOptions::default(),
));
assert_send(&session.get("config", 1));
assert_send(&session.list_refs(selector, Some(selector), 1));
assert_send(&owned.finish());
}
#[allow(dead_code)]
fn pull_session_futures_are_send(
endpoint: &Endpoint,
session: &PullSession,
owned: PullSession,
selector: &ostrya_core::RefSelector,
) {
fn assert_send<T: Send>(_: &T) {}
assert_send(&PullSession::connect(
endpoint.clone(),
StreamSessionOptions::default(),
));
assert_send(&PullSession::over_stream(
futures_lite::io::empty(),
futures_lite::io::sink(),
StreamSessionOptions::default(),
));
assert_send(&session.fetch_summary());
assert_send(&session.fetch_refs(selector, Some(selector)));
assert_send(&owned.finish());
}
#[allow(dead_code)]
fn scan_future_is_send(root: &std::path::Path, options: tree::ScanOptions) {
fn assert_send<T: Send>(_: &T) {}
assert_send(&options);
assert_send(&tree::TreeModel::scan(root, options));
}
#[allow(dead_code)]
fn session_futures_are_send(
session: &PushSession,
owned: PushSession,
source: &dyn ObjectSource,
names: &[ostrya_core::ObjectName],
commits: &[ostrya_core::Checksum],
updates: &[RefUpdate],
) {
fn assert_send<T: Send>(_: &T) {}
assert_send(&session.missing(names));
assert_send(&session.send(source, names, commits, Compression::None));
assert_send(&owned.commit(updates, false));
assert_send(&session::export_stream(
futures_lite::io::sink(),
source,
names,
commits,
updates,
Compression::None,
SessionOptions::default(),
));
}
#[allow(dead_code)]
fn server_commit_future_is_send(owned: PushSession, server_commit: proto::ServerCommit) {
fn assert_send<T: Send>(_: &T) {}
assert_send(&owned.server_commit(server_commit));
}
#[allow(dead_code)]
fn connect_future_is_send(endpoint: &Endpoint, refs: &[String], prepared: PreparedSession) {
fn assert_send<T: Send>(_: &T) {}
assert_send(&PushSession::connect(
endpoint.clone(),
refs,
SessionOptions::default(),
));
assert_send(&PushSession::prepare(endpoint.clone()));
assert_send(&prepared.open(refs, SessionOptions::default()));
}
#[allow(dead_code)]
fn push_tree_futures_are_send(
endpoint: &Endpoint,
root: &std::path::Path,
prepared: PreparedSession,
) {
fn assert_send<T: Send>(_: &T) {}
assert_send(&TreePushOptions::default());
assert_send(&push_tree(
endpoint.clone(),
root,
TreePushOptions::default(),
));
assert_send(&push_tree_prepared(
prepared,
root,
TreePushOptions::default(),
));
assert_send(&push_tree_over_stream(
futures_lite::io::empty(),
futures_lite::io::sink(),
root,
TreePushOptions::default(),
));
}