diff --git a/fuzzy_log_client/src/fuzzy_log/log_handle.rs b/fuzzy_log_client/src/fuzzy_log/log_handle.rs index cc1b5d4..eaf459e 100644 --- a/fuzzy_log_client/src/fuzzy_log/log_handle.rs +++ b/fuzzy_log_client/src/fuzzy_log/log_handle.rs @@ -711,7 +711,7 @@ where V: Storeable { data: &V, inhabits: &mut [order], depends_on: &mut [order], - async: bool, + is_async: bool, ) -> (Uuid, Result<(), TryWaitRes>) { //TODO get rid of gratuitous copies assert!(inhabits.len() > 0); @@ -743,7 +743,7 @@ where V: Storeable { trace!("multi append"); self.async_no_remote_multiappend(&*inhabits, data, &[]) }; - let res = if !async { + let res = if !is_async { self.wait_for_a_specific_append(id).map(|_| ()) } else { Ok(()) @@ -756,7 +756,7 @@ where V: Storeable { data: &V, inhabits: &mut [order], deps: &mut [OrderIndex], - async: bool, + is_async: bool, ) -> (Uuid, Result) { if inhabits.len() == 0 { return (Uuid::nil(), Err(TryWaitRes::NothingReady)) @@ -773,7 +773,7 @@ where V: Storeable { self.async_no_remote_multiappend(inhabits, data, deps) }; let mut loc = Err(TryWaitRes::NothingReady); - if !async { + if !is_async { loc = self.wait_for_a_specific_append(id).map(|v| v[0]); } (id, loc) diff --git a/fuzzy_log_client/src/store.rs b/fuzzy_log_client/src/store.rs index 9100b21..4e779af 100644 --- a/fuzzy_log_client/src/store.rs +++ b/fuzzy_log_client/src/store.rs @@ -1349,7 +1349,7 @@ impl WriteState { } fn layout(&self) -> EntryLayout { - let mut layout = unsafe { mem::uninitialized() }; + let mut layout = unsafe { mem::MaybeUninit::uninit().assume_init() }; self.with_packet(|p| { layout = bytes_as_entry(p).layout(); }); diff --git a/fuzzy_log_server/src/tcp/mod.rs b/fuzzy_log_server/src/tcp/mod.rs index 49f1d5c..d4a145f 100644 --- a/fuzzy_log_server/src/tcp/mod.rs +++ b/fuzzy_log_server/src/tcp/mod.rs @@ -333,14 +333,14 @@ pub fn run_with_replication( #[cfg(feature = "print_stats")] loop { use std::sync::mpsc::RecvTimeoutError; - let msg = recv_from_workers.recv_timeout(Duration::from_secs(10)); + let msg = recv_from_workers.recv_timeout(std::time::Duration::from_secs(10)); match msg { Ok(ToLog::New(buffer, storage, st)) => { - assert!(!is_replica); + // assert!(!is_replica); log.handle_op(buffer, storage, st) }, Ok(ToLog::Replication(tr, st)) => { - assert!(is_replica); + // assert!(is_replica); log.handle_replication(tr, st) }, Ok(ToLog::Recovery(r, st)) => log.handle_recovery(r, st), diff --git a/fuzzy_log_server/src/trie.rs b/fuzzy_log_server/src/trie.rs index dcc96b9..66d90d7 100644 --- a/fuzzy_log_server/src/trie.rs +++ b/fuzzy_log_server/src/trie.rs @@ -414,7 +414,8 @@ impl Trie pub fn new() -> Self { unsafe { //FIXME gratuitously unsafe - let mut t = Trie { root: Box::new(mem::zeroed()) }; + let root = Box::new(mem::MaybeUninit::zeroed().assume_init()); + let mut t = Trie { root }; ::std::ptr::write(&mut t.root.alloc, AllocPtr::new()); //t.next_entry = 1; t diff --git a/fuzzylog.h b/fuzzylog.h index 77531cd..36bce98 100644 --- a/fuzzylog.h +++ b/fuzzylog.h @@ -1,13 +1,14 @@ #ifndef FuzzyLog_C_bindings_h #define FuzzyLog_C_bindings_h -/* Generated with cbindgen:0.6.3 */ +/* Generated with cbindgen:0.6.8 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ +#include +#include #include #include -#include typedef struct DAG DAG; @@ -19,15 +20,13 @@ typedef SnapBody *SnapId; typedef DAG *FLPtr; -/* +/** * A `ColorSpec` describes the layout of a color. - * * members: * local_chain: the local chain for this color * num_remote_chains: The number of remote chains which make up the color * retmote_chains: an array of size `numchains` consisting of the chains for a * color. - * * NOTE `local_chain` _may_ be included in `remote_chains` as well, * though it is not necessary to do so. */ @@ -37,14 +36,13 @@ typedef struct { uint64_t *remote_chains; } ColorSpec; -/* +/** * The specification for a static FuzzyLog server configuration. * Since we're using chain-replication, in a replicated setup the client * needs to know of both the head and tail of each replication chain. In an * non-replicated setup tail_ips should be NULL. Each element of an ip * array should be in the form `:`. Currently only ipv4 is * supported. - * * members: * num_ips: the number of IP addresses in each array * head_ips: an array of `":"` describing the heads of the @@ -61,15 +59,12 @@ typedef struct { void delete_snap_id(SnapId snap); -/* +/** * Append a node to the FuzzyLog - * * args: * handle: the client handle which will perform the append - * * data: the data to be contained in the new node * data_size: the number of bytes in `data` - * * colors: the colors the new node should inhabit. Note that only * `local_color` will be read from these colors. * num_colors: the number of colors in `colors` @@ -82,9 +77,8 @@ int32_t fuzzylog_append(FLPtr handle, void fuzzylog_close(FLPtr handle); -/* +/** * Sync a local view with the FuzzyLog. - * * args: * handle: the client handle which will perform the sync * callback: a callback which will be called on every new event. @@ -99,10 +93,9 @@ SnapId fuzzylog_sync(FLPtr handle, void fuzzylog_trim(FLPtr handle, SnapId snap); -/* +/** * Start a new FuzzyLog client instance, and connect it so the supplied * server(s). - * * args: * servers: a `ServerSpec` describing the servers to connect to. * color: a `ColorSpec` for the color this client reads. diff --git a/fuzzylog_async_ext.h b/fuzzylog_async_ext.h index 6c9182e..94f09a3 100644 --- a/fuzzylog_async_ext.h +++ b/fuzzylog_async_ext.h @@ -1,13 +1,14 @@ #ifndef FuzzyLog_C_async_ext_h #define FuzzyLog_C_async_ext_h -/* Generated with cbindgen:0.6.3 */ +/* Generated with cbindgen:0.6.8 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ +#include +#include #include #include -#include #include typedef struct { @@ -22,18 +23,15 @@ typedef struct { uintptr_t inhabits_len; } FuzzyLogEvent; -/* +/** * Asynchronously append a node to the FuzzyLog. * Unlike `fuzzylog_append` this function does not wait for the append to * be ack'd by the server, but rather return immediately with a WriteId * which can be used to wait for the ack at a latter point in time. - * * args: * handle: the client handle which will perform the append - * * data: the data to be contained in the new node * data_size: the number of bytes in `data` - * * colors: the colors the new node should inhabit. Note that only * `local_color` will be read from these colors. * num_colors: the number of colors in `colors` @@ -46,9 +44,8 @@ WriteId fuzzylog_async_append(FLPtr handle, bool fuzzylog_event_inhabits_chain(FuzzyLogEvent event, uint64_t chain); -/* +/** * Sync a local view with the FuzzyLog. - * * args: * handle: the client handle which will perform the sync * callback: a callback which will be called on every new event. @@ -61,23 +58,23 @@ SnapId fuzzylog_sync_events(FLPtr handle, void (*callback)(void*, FuzzyLogEvent), void *callback_state); -/* +/** * Check if any append written by this client has been ack'd by the server * return WriteId{0} if no such append exists. */ WriteId fuzzylog_try_wait_for_any_append(FLPtr handle); -/* +/** * Wait for a specific append sent by this client to be ack'd by the server. */ void fuzzylog_wait_for_a_specific_append(FLPtr handle, WriteId write_id); -/* +/** * Wait for all outstanding appends to be ack'd by the server. */ void fuzzylog_wait_for_all_appends(FLPtr handle); -/* +/** * Wait for any append sent by this client to be ack'd by the server. */ WriteId fuzzylog_wait_for_any_append(FLPtr handle); diff --git a/src/lib.rs b/src/lib.rs index e8516d8..6d5815b 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -301,7 +301,7 @@ pub mod c_binidings { num_colors: usize, ) -> i32 { assert!( - !data.is_null() || data_size == 0 + !data.is_null() || data_size == 0, "args: data = {:?}, data_size = {} is not valid\nEither data = NULL or data_size > 0" ); assert!(!colors.is_null()); @@ -343,7 +343,7 @@ pub mod c_binidings { num_colors: usize, ) -> WriteId { assert!( - !data.is_null() || data_size == 0 + !data.is_null() || data_size == 0, "args: data = {:?}, data_size = {} is not valid\nEither data = NULL or data_size > 0" ); assert!(!colors.is_null());