#include "utils.hpp" #include "config.hpp" #include "ORExpand.hpp" #include "sort.hpp" #include "storage.hpp" #include "client.hpp" #define PROFILE_STORAGE StgClient *clients; static struct { uint32_t max_users; uint32_t my_storage_node_id; // A local storage buffer, used when we need to do non-in-place // sorts of the messages that have arrived MsgBuffer stg_buf; // The destination vector for ORExpand std::vector dest; } storage_state; // route_init will call this function; no one else should call it // explicitly. The parameter is the number of messages that can fit in // the storage-side MsgBuffer. Returns true on success, false on // failure. bool storage_init(uint32_t max_users, uint32_t msg_buf_size) { storage_state.max_users = max_users; storage_state.stg_buf.alloc(msg_buf_size); storage_state.dest.resize(msg_buf_size); uint32_t my_storage_node_id = 0; uint32_t my_stg_pos = 0; for (nodenum_t i=0; i> DEST_UID_BITS]; if (dest_node != my_node_num) { char hexbuf[2*msg_size + 1]; for (uint32_t j=0;j(g_teems_config.nthreads, storage_buf.buf, msg_size, storage_buf.inserted, storage_buf.bufsize, storage_state.stg_buf.buf); #ifdef PROFILE_STORAGE printf_with_rtclock_diff(start_sort, "end oblivious sort (%u)\n", storage_buf.inserted); #endif /* for (uint32_t i=0;i 0) { dests[0] = oselect_uint32_t(uid * m_priv_in, 0xffffffff, uid == uid_mask); } uint32_t prev_uid = uid; for (uint32_t i=1; i(storage_state.stg_buf.buf, dests, msg_size, stg_size, g_teems_config.nthreads); #ifdef PROFILE_STORAGE printf_with_rtclock_diff(start_expand, "end ORExpand (%u)\n", stg_size); #endif /* for (uint32_t i=0;i