예제 #1
0
/**
 * libcouchbase_mget use the GETQ command followed by a NOOP command to avoid
 * transferring not-found responses. All of the not-found callbacks are
 * generated implicit by receiving a successful get or the NOOP.
 *
 * @author Trond Norbye
 * @todo improve the error handling
 */
LIBCOUCHBASE_API
lcb_error_t lcb_get(lcb_t instance,
                    const void *command_cookie,
                    lcb_size_t num,
                    const lcb_get_cmd_t *const *items)
{
    if (num == 1) {
        return single_get(instance, command_cookie, items[0]);
    } else {
        return multi_get(instance, command_cookie, num, items);
    }
}
예제 #2
0
파일: test.c 프로젝트: fdy84/amulet
int main()
{
    gVar = (int *)malloc((sizeof(int))*CL*RTN);
    
    
    inittest();
    
    
    
    gq = Queue_new();
    
    t0 = clock();
    
    printf("Starting Test 1 ...\n");
    
    start_multi(0);
    
    wait_multi();
    
    //t2 = clock();
    
    //if ( checkresult != 0 )
    //    return -1;
    
    printf("TEST 1 , Multi In.\n");
    printf("         PUT USE : %f seconds\n", (double)(t1 - t0) / CLOCKS_PER_SEC);
    //printf("         GET USE : %f seconds\n", (double)(t2 - t0) / CLOCKS_PER_SEC);
    
    
    
    
    t0 = clock();
    
    printf("Starting Test 2 ...\n");
    
    start_multi(1);
    
    wait_multi2();
    
    //t1 = clock();
    
    if ( checkresult() != 0 )
        return -1;
    
    printf("TEST 2 , Multi Out.\n");
    //printf("         PUT USE : %f seconds\n", (double)(t1 - t0) / CLOCKS_PER_SEC);
    printf("         GET USE : %f seconds\n", (double)(t2 - t0) / CLOCKS_PER_SEC);
    
    
    
    
    
    inittest();
    
    
    
    
    gq = Queue_new();
    
    t0 = clock();
    
    printf("Starting Test 3 ...\n");
    
    start_multi(0);
    
    single_get();
    
    t2 = clock();
    
    wait_multi();
    
    if ( checkresult() != 0 )
        return -1;
    
    printf("TEST 3 , Multi In Single Out.\n");
    printf("         PUT USE : %f seconds\n", (double)(t1 - t0) / CLOCKS_PER_SEC);
    printf("         GET USE : %f seconds\n", (double)(t2 - t0) / CLOCKS_PER_SEC);
    
    
    
    
    
    
    inittest();
    
    
    
    
    gq = Queue_new();
    
    t0 = clock();
    
    printf("Starting Test 4 ...\n");
    
    single_put();
    
    t1 = clock();

    printf("TEST 4 , Single In .\n");
    printf("         PUT USE : %f seconds\n", (double)(t1 - t0) / CLOCKS_PER_SEC);
    //printf("         GET USE : %f seconds\n", (double)(t2 - t0) / CLOCKS_PER_SEC);
    
    
    
    
    t0 = clock();
    
    printf("Starting Test 5 ...\n");
    
    start_multi(2);
    
    wait_multi2();
    
    //t1 = clock();
    
    if ( checkresult() != 0 )
        return -1;
    
    printf("TEST 5 , Multi Out 2.\n");
    //printf("         PUT USE : %f seconds\n", (double)(t1 - t0) / CLOCKS_PER_SEC);
    printf("         GET USE : %f seconds\n", (double)(t2 - t0) / CLOCKS_PER_SEC);
    
    
    
    
    
    inittest();
    
    
    
    
    gq = Queue_new();
    
    t0 = clock();
    
    printf("Starting Test 6 ...\n");
    
    start_multi(0);
    start_multi(1);
    
    wait_multi();
    wait_multi2();
    
    if ( checkresult() != 0 )
        return -1;
    
    printf("TEST 6 , Multi In Multi Out.\n");
    printf("         PUT USE : %f seconds\n", (double)(t1 - t0) / CLOCKS_PER_SEC);
    printf("         GET USE : %f seconds\n", (double)(t2 - t0) / CLOCKS_PER_SEC);
    
    
    
    
    inittest();

    
    
    gq = Queue_new();
    
    t0 = clock();
    
    printf("Starting Test 7 ...\n");
    
    start_multi(0);
    start_multi(2);
    
    wait_multi();
    wait_multi2();
    
    if ( checkresult() != 0 )
        return -1;
    
    printf("TEST 7 , Multi In Multi Out 2.\n");
    printf("         PUT USE : %f seconds\n", (double)(t1 - t0) / CLOCKS_PER_SEC);
    printf("         GET USE : %f seconds\n", (double)(t2 - t0) / CLOCKS_PER_SEC);
    
    
    
    
    return 0;
}