Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ env_logger = "0.10.0"
tracing-subscriber = { version = "0.3.17", features = ["fmt", "env-filter"] }
itertools = "0.11.0"
autosurgeon = "0.8.0"
bolero = { version = "0.10.0", features = ["arbitrary"] }
arbitrary = { version = "1.3.1", features = ["derive"] }
bolero-generator = { version = "0.10.0", features = ["arbitrary"] }
rand = "0.8.5"
8 changes: 6 additions & 2 deletions examples/distributed_bakery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ async fn main() {
}

// The initial document.
let doc_handle = repo_handle.new_document();
let doc_handle = repo_handle.new_document().await;
doc_handle.with_doc_mut(|doc| {
let mut tx = doc.transaction();
reconcile(&mut tx, &bakery).unwrap();
Expand All @@ -426,7 +426,11 @@ async fn main() {
}
assert!(doc_id.is_some());
// Get the document.
repo_handle.request_document(doc_id.unwrap()).await.unwrap()
repo_handle
.request_document(doc_id.unwrap())
.await
.unwrap()
.expect("document not found")
};

// Shutdown signals for background tasks.
Expand Down
12 changes: 9 additions & 3 deletions examples/tcp-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async fn request_doc(State(state): State<Arc<AppState>>, Json(document_id): Json

#[debug_handler]
async fn new_doc(State(state): State<Arc<AppState>>) -> Json<DocumentId> {
let doc_handle = state.repo_handle.new_document();
let doc_handle = state.repo_handle.new_document().await;
let our_id = state.repo_handle.get_repo_id();
doc_handle.with_doc_mut(|doc| {
let mut tx = doc.transaction();
Expand All @@ -59,7 +59,12 @@ async fn get_doc(
State(state): State<Arc<AppState>>,
Path(doc_id): Path<DocumentId>,
) -> (StatusCode, Json<serde_json::Value>) {
let doc_handle = state.repo_handle.request_document(doc_id).await.unwrap();
let doc_handle = state
.repo_handle
.request_document(doc_id)
.await
.unwrap()
.expect("document not found");
let value = doc_handle.with_doc(|doc| serde_json::to_value(AutoSerde::from(doc)).unwrap());
(StatusCode::OK, Json(value))
}
Expand Down Expand Up @@ -224,7 +229,8 @@ async fn main() {
let doc = repo_handle_clone
.request_document(doc_id.clone())
.await
.unwrap();
.unwrap()
.expect("document not found");
doc.with_doc(|doc| {
let val = doc
.get(automerge::ROOT, "repo_id")
Expand Down
Loading