MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / defragLaterItem

Function defragLaterItem

src/defrag.cpp:969–992  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

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. */
969int 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. */
995static sds defrag_later_current_key = NULL;

Callers 1

defragLaterStepFunction · 0.85

Calls 6

scanLaterListFunction · 0.85
scanLaterSetFunction · 0.85
scanLaterZsetFunction · 0.85
scanLaterHashFunction · 0.85
scanLaterStreamListpacksFunction · 0.85
moduleLateDefragFunction · 0.85

Tested by

no test coverage detected