コード例 #1
0
static const char const * vbucket_state_name(vbucket_state_t s) {
    static const char const * vbucket_states[] = {
        [vbucket_state_active] = "active",
        [vbucket_state_replica] = "replica",
        [vbucket_state_pending] = "pending",
        [vbucket_state_dead] = "dead"
    };
    if (is_valid_vbucket_state_t(s)) {
        return vbucket_states[s];
    } else {
        return "Illegal vbucket state";
    }
}
コード例 #2
0
ファイル: packet_debug.c プロジェクト: ingenthr/libcouchbase
static const char *get_vbucket_state(uint32_t s)
{
    vbucket_state_t state = ntohl(s);
    if (!is_valid_vbucket_state_t(state)) {
        return "Illegal state";
    }
    switch (state) {
    case vbucket_state_active: return "active";
    case vbucket_state_replica: return "replica";
    case vbucket_state_pending: return "pending";
    case vbucket_state_dead: return "dead";
    default:
        abort();
    }
}