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

Function RM_LoadFloat

src/module.cpp:4945–4960  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

4943/* In the context of the rdb_save method of a module data type, loads back the
4944 * float value saved by RedisModule_SaveFloat(). */
4945float RM_LoadFloat(RedisModuleIO *io) {
4946 int retval = C_ERR;
4947 if (io->error) return 0;
4948 if (io->ver == 2) {
4949 uint64_t opcode = rdbLoadLen(io->prio,NULL);
4950 if (opcode != RDB_MODULE_OPCODE_FLOAT) goto loaderr;
4951 }
4952 float value;
4953 retval = rdbLoadBinaryFloatValue(io->prio, &value);
4954 if (retval == -1) goto loaderr;
4955 return value;
4956
4957loaderr:
4958 moduleRDBLoadError(io);
4959 return 0;
4960}
4961
4962/* In the context of the rdb_save method of a module data type, saves a long double
4963 * value to the RDB file. The double can be a valid number, a NaN or infinity.

Callers

nothing calls this directly

Calls 3

rdbLoadLenFunction · 0.85
rdbLoadBinaryFloatValueFunction · 0.85
moduleRDBLoadErrorFunction · 0.85

Tested by

no test coverage detected