| 7450 | *--------------------------------------------------------------------------- */ |
| 7451 | |
| 7452 | static redisReply *sendScan(unsigned long long *it) { |
| 7453 | redisReply *reply; |
| 7454 | |
| 7455 | if (config.pattern) |
| 7456 | reply = redisCommand(context, "SCAN %llu MATCH %b", |
| 7457 | *it, config.pattern, sdslen(config.pattern)); |
| 7458 | else |
| 7459 | reply = redisCommand(context,"SCAN %llu",*it); |
| 7460 | |
| 7461 | /* Handle any error conditions */ |
| 7462 | if(reply == NULL) { |
| 7463 | fprintf(stderr, "\nI/O error\n"); |
| 7464 | exit(1); |
| 7465 | } else if(reply->type == REDIS_REPLY_ERROR) { |
| 7466 | fprintf(stderr, "SCAN error: %s\n", reply->str); |
| 7467 | exit(1); |
| 7468 | } else if(reply->type != REDIS_REPLY_ARRAY) { |
| 7469 | fprintf(stderr, "Non ARRAY response from SCAN!\n"); |
| 7470 | exit(1); |
| 7471 | } else if(reply->elements != 2) { |
| 7472 | fprintf(stderr, "Invalid element count from SCAN!\n"); |
| 7473 | exit(1); |
| 7474 | } |
| 7475 | |
| 7476 | /* Validate our types are correct */ |
| 7477 | assert(reply->element[0]->type == REDIS_REPLY_STRING); |
| 7478 | assert(reply->element[1]->type == REDIS_REPLY_ARRAY); |
| 7479 | |
| 7480 | /* Update iterator */ |
| 7481 | *it = strtoull(reply->element[0]->str, NULL, 10); |
| 7482 | |
| 7483 | return reply; |
| 7484 | } |
| 7485 | |
| 7486 | static int getDbSize(void) { |
| 7487 | redisReply *reply; |
no test coverage detected