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
8 changes: 4 additions & 4 deletions fuzzy_log_client/src/fuzzy_log/log_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(())
Expand All @@ -756,7 +756,7 @@ where V: Storeable {
data: &V,
inhabits: &mut [order],
deps: &mut [OrderIndex],
async: bool,
is_async: bool,
) -> (Uuid, Result<OrderIndex, TryWaitRes>) {
if inhabits.len() == 0 {
return (Uuid::nil(), Err(TryWaitRes::NothingReady))
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion fuzzy_log_client/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
6 changes: 3 additions & 3 deletions fuzzy_log_server/src/tcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion fuzzy_log_server/src/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 8 additions & 15 deletions fuzzylog.h
Original file line number Diff line number Diff line change
@@ -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 <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct DAG DAG;

Expand All @@ -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.
*/
Expand All @@ -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 `<ip-addr>:<port>`. Currently only ipv4 is
* supported.
*
* members:
* num_ips: the number of IP addresses in each array
* head_ips: an array of `"<ip-addr>:<port>"` describing the heads of the
Expand All @@ -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`
Expand All @@ -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.
Expand All @@ -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.
Expand Down
21 changes: 9 additions & 12 deletions fuzzylog_async_ext.h
Original file line number Diff line number Diff line change
@@ -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 <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <fuzzylog.h>

typedef struct {
Expand All @@ -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`
Expand All @@ -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.
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down