returns 0 more work may or may not be needed (see non-zero cursor), * and 1 if time is up and more work is needed. */
| 967 | /* returns 0 more work may or may not be needed (see non-zero cursor), |
| 968 | * and 1 if time is up and more work is needed. */ |
| 969 | int defragLaterItem(sds key, robj *ob, unsigned long *cursor, long long endtime) { |
| 970 | if (ob) { |
| 971 | if (ob->type == OBJ_LIST) { |
| 972 | return scanLaterList(ob, cursor, endtime, &g_pserver->stat_active_defrag_hits); |
| 973 | } else if (ob->type == OBJ_SET) { |
| 974 | g_pserver->stat_active_defrag_hits += scanLaterSet(ob, cursor); |
| 975 | } else if (ob->type == OBJ_ZSET) { |
| 976 | g_pserver->stat_active_defrag_hits += scanLaterZset(ob, cursor); |
| 977 | } else if (ob->type == OBJ_HASH) { |
| 978 | g_pserver->stat_active_defrag_hits += scanLaterHash(ob, cursor); |
| 979 | } else if (ob->type == OBJ_STREAM) { |
| 980 | return scanLaterStreamListpacks(ob, cursor, endtime, &g_pserver->stat_active_defrag_hits); |
| 981 | } else if (ob->type == OBJ_MODULE) { |
| 982 | redisObjectStack oT; |
| 983 | initStaticStringObject(oT, key); |
| 984 | return moduleLateDefrag(&oT, ob, cursor, endtime, &g_pserver->stat_active_defrag_hits); |
| 985 | } else { |
| 986 | *cursor = 0; /* object type may have changed since we schedule it for later */ |
| 987 | } |
| 988 | } else { |
| 989 | *cursor = 0; /* object may have been deleted already */ |
| 990 | } |
| 991 | return 0; |
| 992 | } |
| 993 | |
| 994 | /* static variables serving defragLaterStep to continue scanning a key from were we stopped last time. */ |
| 995 | static sds defrag_later_current_key = NULL; |
no test coverage detected