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

Function RM_LoadDouble

src/module.cpp:4907–4922  ·  view source on GitHub ↗

In the context of the rdb_save method of a module data type, loads back the * double value saved by RedisModule_SaveDouble(). */

Source from the content-addressed store, hash-verified

4905/* In the context of the rdb_save method of a module data type, loads back the
4906 * double value saved by RedisModule_SaveDouble(). */
4907double RM_LoadDouble(RedisModuleIO *io) {
4908 int retval;
4909 if (io->error) return 0;
4910 if (io->ver == 2) {
4911 uint64_t opcode = rdbLoadLen(io->prio,NULL);
4912 if (opcode != RDB_MODULE_OPCODE_DOUBLE) goto loaderr;
4913 }
4914 double value;
4915 retval = rdbLoadBinaryDoubleValue(io->prio, &value);
4916 if (retval == -1) goto loaderr;
4917 return value;
4918
4919loaderr:
4920 moduleRDBLoadError(io);
4921 return 0;
4922}
4923
4924/* In the context of the rdb_save method of a module data type, saves a float
4925 * value to the RDB file. The float can be a valid number, a NaN or infinity.

Callers

nothing calls this directly

Calls 3

rdbLoadLenFunction · 0.85
rdbLoadBinaryDoubleValueFunction · 0.85
moduleRDBLoadErrorFunction · 0.85

Tested by

no test coverage detected