#include "utils.hpp" #include "config.hpp" #include "ORExpand.hpp" #include "sort.hpp" #include "storage.hpp" #include "client.hpp" #define PROFILE_STORAGE StgClient *clients; uint8_t *epoch_tokens; uint8_t *epoch_msgbundles; 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; bool storage_generateClientKeys(uint32_t num_clients, uint32_t my_stg_no) { uint16_t num_priv_channels = g_teems_config.m_priv_in; uint16_t msg_size = g_teems_config.msg_size; uint32_t pt_msgbundle_size = num_priv_channels * msg_size; clients = new StgClient[num_clients]; for(uint32_t i =0; i < num_clients; i++) { uint32_t mid = storage_state.my_storage_node_id + i; clients[i].my_id = mid; clients[i].priv_friends = new clientid_t[g_teems_config.m_priv_out]; // Initialize this client's private channel friends as themself for(int j =0; j > 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