示例#1
0
int lcb_dispatch_response(lcb_server_t *c, packet_info *info)
{
    switch (info->res.response.opcode) {
    case PROTOCOL_BINARY_CMD_FLUSH:
        flush_response_handler(c, info);
        break;
    case PROTOCOL_BINARY_CMD_GETQ:
    case PROTOCOL_BINARY_CMD_GATQ:
    case PROTOCOL_BINARY_CMD_GET:
    case PROTOCOL_BINARY_CMD_GAT:
    case CMD_GET_LOCKED:
        getq_response_handler(c, info);
        break;
    case CMD_GET_REPLICA:
        get_replica_response_handler(c, info);
        break;

    case CMD_UNLOCK_KEY:
        unlock_response_handler(c, info);
        break;

    case PROTOCOL_BINARY_CMD_DELETE:
        delete_response_handler(c, info);
        break;

    case PROTOCOL_BINARY_CMD_ADD:
    case PROTOCOL_BINARY_CMD_REPLACE:
    case PROTOCOL_BINARY_CMD_SET:
    case PROTOCOL_BINARY_CMD_APPEND:
    case PROTOCOL_BINARY_CMD_PREPEND:
        store_response_handler(c, info);
        break;

    case PROTOCOL_BINARY_CMD_INCREMENT:
    case PROTOCOL_BINARY_CMD_DECREMENT:
        arithmetic_response_handler(c, info);
        break;

    case PROTOCOL_BINARY_CMD_TOUCH:
        touch_response_handler(c, info);
        break;
    case PROTOCOL_BINARY_CMD_STAT:
        stat_response_handler(c, info);
        break;
    case PROTOCOL_BINARY_CMD_VERSION:
        version_response_handler(c, info);
        break;
    case PROTOCOL_BINARY_CMD_VERBOSITY:
        verbosity_response_handler(c, info);
        break;
    case CMD_OBSERVE:
        observe_response_handler(c, info);
        break;
    case PROTOCOL_BINARY_CMD_NOOP:
        /* Ignore */
        break;
    case PROTOCOL_BINARY_CMD_HELLO:
    fprintf(stderr,"inside handler for hello");  
        break;
    case PROTOCOL_BINARY_CMD_COMPACTDB:
    fprintf(stderr,"inside handler for compactDB");  
        break;

    case CMD_GET_CLUSTER_CONFIG:
        config_handler(c, info);
        break;

    default:
        return -1;
    }

    return 0;
}
示例#2
0
int lcb_dispatch_response(lcb_server_t *c,
                          struct lcb_command_data_st *ct,
                          protocol_binary_response_header *header)
{
    switch (header->response.opcode) {
    case PROTOCOL_BINARY_CMD_FLUSH:
        flush_response_handler(c, ct, (void *)header);
        break;
    case PROTOCOL_BINARY_CMD_GETQ:
    case PROTOCOL_BINARY_CMD_GATQ:
    case PROTOCOL_BINARY_CMD_GET:
    case PROTOCOL_BINARY_CMD_GAT:
    case CMD_GET_LOCKED:
        getq_response_handler(c, ct, (void *)header);
        break;
    case CMD_GET_REPLICA:
        get_replica_response_handler(c, ct, (void *)header);
        break;

    case CMD_UNLOCK_KEY:
        unlock_response_handler(c, ct, (void *)header);
        break;

    case PROTOCOL_BINARY_CMD_DELETE:
        delete_response_handler(c, ct, (void *)header);
        break;

    case PROTOCOL_BINARY_CMD_ADD:
    case PROTOCOL_BINARY_CMD_REPLACE:
    case PROTOCOL_BINARY_CMD_SET:
    case PROTOCOL_BINARY_CMD_APPEND:
    case PROTOCOL_BINARY_CMD_PREPEND:
        store_response_handler(c, ct, (void *)header);
        break;

    case PROTOCOL_BINARY_CMD_INCREMENT:
    case PROTOCOL_BINARY_CMD_DECREMENT:
        arithmetic_response_handler(c, ct, (void *)header);
        break;

    case PROTOCOL_BINARY_CMD_SASL_LIST_MECHS:
        sasl_list_mech_response_handler(c, ct, (void*)header);
        break;
    case PROTOCOL_BINARY_CMD_SASL_AUTH:
        sasl_auth_response_handler(c, ct, (void *)header);
        break;
    case PROTOCOL_BINARY_CMD_SASL_STEP:
        sasl_step_response_handler(c, ct, (void *)header);
        break;
    case PROTOCOL_BINARY_CMD_TOUCH:
        touch_response_handler(c, ct, (void *)header);
        break;
    case PROTOCOL_BINARY_CMD_STAT:
        stat_response_handler(c, ct, (void *)header);
        break;
    case PROTOCOL_BINARY_CMD_VERSION:
        version_response_handler(c, ct, (void *)header);
        break;
    case PROTOCOL_BINARY_CMD_VERBOSITY:
        verbosity_response_handler(c, ct, (void *)header);
        break;
    case CMD_OBSERVE:
        observe_response_handler(c, ct, (void *)header);
        break;
    case PROTOCOL_BINARY_CMD_NOOP:
        /* Ignore */
        break;
    default:
        return -1;
    }

    return 0;
}