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

Function createSharedObjects

src/server.cpp:3070–3232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3068/* =========================== Server initialization ======================== */
3069
3070void createSharedObjects(void) {
3071 int j;
3072
3073 /* Shared command responses */
3074 shared.crlf = makeObjectShared(createObject(OBJ_STRING,sdsnew("\r\n")));
3075 shared.ok = makeObjectShared(createObject(OBJ_STRING,sdsnew("+OK\r\n")));
3076 shared.emptybulk = makeObjectShared(createObject(OBJ_STRING,sdsnew("$0\r\n\r\n")));
3077 shared.czero = makeObjectShared(createObject(OBJ_STRING,sdsnew(":0\r\n")));
3078 shared.cone = makeObjectShared(createObject(OBJ_STRING,sdsnew(":1\r\n")));
3079 shared.emptyarray = makeObjectShared(createObject(OBJ_STRING,sdsnew("*0\r\n")));
3080 shared.pong = makeObjectShared(createObject(OBJ_STRING,sdsnew("+PONG\r\n")));
3081 shared.queued = makeObjectShared(createObject(OBJ_STRING,sdsnew("+QUEUED\r\n")));
3082 shared.emptyscan = makeObjectShared(createObject(OBJ_STRING,sdsnew("*2\r\n$1\r\n0\r\n*0\r\n")));
3083 shared.space = makeObjectShared(createObject(OBJ_STRING,sdsnew(" ")));
3084 shared.colon = makeObjectShared(createObject(OBJ_STRING,sdsnew(":")));
3085 shared.plus = makeObjectShared(createObject(OBJ_STRING,sdsnew("+")));
3086 shared.nullbulk = makeObjectShared(createObject(OBJ_STRING,sdsnew("$0\r\n\r\n")));
3087
3088 /* Shared command error responses */
3089 shared.wrongtypeerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3090 "-WRONGTYPE Operation against a key holding the wrong kind of value\r\n")));
3091 shared.err = makeObjectShared(createObject(OBJ_STRING,sdsnew("-ERR\r\n")));
3092 shared.nokeyerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3093 "-ERR no such key\r\n")));
3094 shared.syntaxerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3095 "-ERR syntax error\r\n")));
3096 shared.sameobjecterr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3097 "-ERR source and destination objects are the same\r\n")));
3098 shared.outofrangeerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3099 "-ERR index out of range\r\n")));
3100 shared.noscripterr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3101 "-NOSCRIPT No matching script. Please use EVAL.\r\n")));
3102 shared.loadingerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3103 "-LOADING KeyDB is loading the dataset in memory\r\n")));
3104 shared.slowscripterr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3105 "-BUSY KeyDB is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.\r\n")));
3106 shared.masterdownerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3107 "-MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.\r\n")));
3108 shared.bgsaveerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3109 "-MISCONF KeyDB 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 KeyDB logs for details about the RDB error.\r\n")));
3110 shared.roslaveerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3111 "-READONLY You can't write against a read only replica.\r\n")));
3112 shared.noautherr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3113 "-NOAUTH Authentication required.\r\n")));
3114 shared.oomerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3115 "-OOM command not allowed when used memory > 'maxmemory'.\r\n")));
3116 shared.execaborterr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3117 "-EXECABORT Transaction discarded because of previous errors.\r\n")));
3118 shared.noreplicaserr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3119 "-NOREPLICAS Not enough good replicas to write.\r\n")));
3120 shared.busykeyerr = makeObjectShared(createObject(OBJ_STRING,sdsnew(
3121 "-BUSYKEY Target key name already exists.\r\n")));
3122
3123
3124 /* The shared NULL depends on the protocol version. */
3125 shared.null[0] = NULL;
3126 shared.null[1] = NULL;
3127 shared.null[2] = makeObjectShared(createObject(OBJ_STRING,sdsnew("$-1\r\n")));

Callers 2

initServerFunction · 0.85
redis_check_rdb_mainFunction · 0.85

Calls 7

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

Tested by

no test coverage detected