示例#1
0
文件: controller.c 项目: Abioy/mpaxos
void group_info_create(group_info_t **g, txn_info_t *tinfo, roundid_t *rid) {
    *g = (group_info_t*)malloc(sizeof(group_info_t));
    group_info_t *ginfo = *g;
    mpr_hash_create(&(ginfo->ht_prom));
    mpr_hash_create(&(ginfo->ht_accd));

    ginfo->gid = rid->gid;
    ginfo->sid = rid->sid;
    ginfo->bid = rid->bid;
    ginfo->tid = tinfo->tid;
    ginfo->n_promises_yes = 0;
    ginfo->n_promises_no = 0;
    ginfo->n_accepteds_yes = 0;
    ginfo->n_accepteds_no = 0;
    ginfo->max_prop = NULL;
}
示例#2
0
文件: view.c 项目: gaohaizhao/mpaxos
void view_init() {
    apr_pool_create(&mp_view_, NULL);
    gid_nid_ht_ht_ = apr_hash_make(mp_view_);
    nid_gid_ht_ht_ = apr_hash_make(mp_view_);
    arr_nodes_ = apr_array_make(mp_view_, 10, sizeof(nodeid_t));
    ht_view_ = apr_hash_make(mp_view_);
    apr_thread_mutex_create(&mx_view_, APR_THREAD_MUTEX_UNNESTED, mp_view_);

    mpr_hash_create(&ht_node_info_);
}
示例#3
0
文件: server.c 项目: Abioy/mpaxos
void server_create(server_t **svr, poll_mgr_t *mgr) {
    *svr = (server_t*) malloc(sizeof(server_t));
    server_t *s = *svr;
    rpc_common_create(&s->comm);
    poll_job_create(&s->pjob);
    s->pjob->do_read = &handle_server_accept;
    s->pjob->holder = s;
    s->pjob->mgr = (mgr != NULL) ? mgr: mgr_;

    s->is_start = false;
    mpr_hash_create(&s->ht_conn);

    apr_thread_pool_create(&s->tp, 10, 10, s->comm->mp);
}