MCPcopy Create free account
hub / github.com/F-Stack/f-stack / createSharedObjects

Function createSharedObjects

app/redis-6.2.6/src/server.c:2483–2636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2481/* =========================== Server initialization ======================== */
2482
2483void createSharedObjects(void) {
2484 int j;
2485
2486 /* Shared command responses */
2487 shared.crlf = createObject(OBJ_STRING,sdsnew("\r\n"));
2488 shared.ok = createObject(OBJ_STRING,sdsnew("+OK\r\n"));
2489 shared.emptybulk = createObject(OBJ_STRING,sdsnew("$0\r\n\r\n"));
2490 shared.czero = createObject(OBJ_STRING,sdsnew(":0\r\n"));
2491 shared.cone = createObject(OBJ_STRING,sdsnew(":1\r\n"));
2492 shared.emptyarray = createObject(OBJ_STRING,sdsnew("*0\r\n"));
2493 shared.pong = createObject(OBJ_STRING,sdsnew("+PONG\r\n"));
2494 shared.queued = createObject(OBJ_STRING,sdsnew("+QUEUED\r\n"));
2495 shared.emptyscan = createObject(OBJ_STRING,sdsnew("*2\r\n$1\r\n0\r\n*0\r\n"));
2496 shared.space = createObject(OBJ_STRING,sdsnew(" "));
2497 shared.colon = createObject(OBJ_STRING,sdsnew(":"));
2498 shared.plus = createObject(OBJ_STRING,sdsnew("+"));
2499
2500 /* Shared command error responses */
2501 shared.wrongtypeerr = createObject(OBJ_STRING,sdsnew(
2502 "-WRONGTYPE Operation against a key holding the wrong kind of value\r\n"));
2503 shared.err = createObject(OBJ_STRING,sdsnew("-ERR\r\n"));
2504 shared.nokeyerr = createObject(OBJ_STRING,sdsnew(
2505 "-ERR no such key\r\n"));
2506 shared.syntaxerr = createObject(OBJ_STRING,sdsnew(
2507 "-ERR syntax error\r\n"));
2508 shared.sameobjecterr = createObject(OBJ_STRING,sdsnew(
2509 "-ERR source and destination objects are the same\r\n"));
2510 shared.outofrangeerr = createObject(OBJ_STRING,sdsnew(
2511 "-ERR index out of range\r\n"));
2512 shared.noscripterr = createObject(OBJ_STRING,sdsnew(
2513 "-NOSCRIPT No matching script. Please use EVAL.\r\n"));
2514 shared.loadingerr = createObject(OBJ_STRING,sdsnew(
2515 "-LOADING Redis is loading the dataset in memory\r\n"));
2516 shared.slowscripterr = createObject(OBJ_STRING,sdsnew(
2517 "-BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.\r\n"));
2518 shared.masterdownerr = createObject(OBJ_STRING,sdsnew(
2519 "-MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.\r\n"));
2520 shared.bgsaveerr = createObject(OBJ_STRING,sdsnew(
2521 "-MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.\r\n"));
2522 shared.roslaveerr = createObject(OBJ_STRING,sdsnew(
2523 "-READONLY You can't write against a read only replica.\r\n"));
2524 shared.noautherr = createObject(OBJ_STRING,sdsnew(
2525 "-NOAUTH Authentication required.\r\n"));
2526 shared.oomerr = createObject(OBJ_STRING,sdsnew(
2527 "-OOM command not allowed when used memory > 'maxmemory'.\r\n"));
2528 shared.execaborterr = createObject(OBJ_STRING,sdsnew(
2529 "-EXECABORT Transaction discarded because of previous errors.\r\n"));
2530 shared.noreplicaserr = createObject(OBJ_STRING,sdsnew(
2531 "-NOREPLICAS Not enough good replicas to write.\r\n"));
2532 shared.busykeyerr = createObject(OBJ_STRING,sdsnew(
2533 "-BUSYKEY Target key name already exists.\r\n"));
2534
2535 /* The shared NULL depends on the protocol version. */
2536 shared.null[0] = NULL;
2537 shared.null[1] = NULL;
2538 shared.null[2] = createObject(OBJ_STRING,sdsnew("$-1\r\n"));
2539 shared.null[3] = createObject(OBJ_STRING,sdsnew("_\r\n"));
2540

Callers 2

initServerFunction · 0.85
redis_check_rdb_mainFunction · 0.85

Calls 7

createObjectFunction · 0.85
sdsnewFunction · 0.85
ll2stringFunction · 0.85
sdscatprintfFunction · 0.85
sdsemptyFunction · 0.85
makeObjectSharedFunction · 0.85
createStringObjectFunction · 0.70

Tested by

no test coverage detected