mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 08:41:21 +00:00
Move rdbLoad* to top; update comments
This commit is contained in:
41
src/rdb.h
41
src/rdb.h
@ -7,6 +7,33 @@
|
||||
/* TBD: include only necessary headers. */
|
||||
#include "redis.h"
|
||||
|
||||
/* Defines related to the dump file format. To store 32 bits lengths for short
|
||||
* keys requires a lot of space, so we check the most significant 2 bits of
|
||||
* the first byte to interpreter the length:
|
||||
*
|
||||
* 00|000000 => if the two MSB are 00 the len is the 6 bits of this byte
|
||||
* 01|000000 00000000 => 01, the len is 14 byes, 6 bits + 8 bits of next byte
|
||||
* 10|000000 [32 bit integer] => if it's 01, a full 32 bit len will follow
|
||||
* 11|000000 this means: specially encoded object will follow. The six bits
|
||||
* number specify the kind of object that follows.
|
||||
* See the REDIS_RDB_ENC_* defines.
|
||||
*
|
||||
* Lenghts up to 63 are stored using a single byte, most DB keys, and may
|
||||
* values, will fit inside. */
|
||||
#define REDIS_RDB_6BITLEN 0
|
||||
#define REDIS_RDB_14BITLEN 1
|
||||
#define REDIS_RDB_32BITLEN 2
|
||||
#define REDIS_RDB_ENCVAL 3
|
||||
#define REDIS_RDB_LENERR UINT_MAX
|
||||
|
||||
/* When a length of a string object stored on disk has the first two bits
|
||||
* set, the remaining two bits specify a special encoding for the object
|
||||
* accordingly to the following defines: */
|
||||
#define REDIS_RDB_ENC_INT8 0 /* 8 bit signed integer */
|
||||
#define REDIS_RDB_ENC_INT16 1 /* 16 bit signed integer */
|
||||
#define REDIS_RDB_ENC_INT32 2 /* 32 bit signed integer */
|
||||
#define REDIS_RDB_ENC_LZF 3 /* string compressed with FASTLZ */
|
||||
|
||||
/* Dup object types to RDB object types. Only reason is readability (are we
|
||||
* dealing with RDB types or with in-memory object types?). */
|
||||
#define REDIS_RDB_TYPE_STRING 0
|
||||
@ -32,6 +59,14 @@
|
||||
/* Test if a type is an opcode. */
|
||||
#define rdbIsOpcode(t) (t >= 253 && t <= 255)
|
||||
|
||||
int rdbSaveType(rio *rdb, unsigned char type);
|
||||
int rdbLoadType(rio *rdb);
|
||||
int rdbSaveTime(rio *rdb, time_t t);
|
||||
time_t rdbLoadTime(rio *rdb);
|
||||
int rdbSaveLen(rio *rdb, uint32_t len);
|
||||
uint32_t rdbLoadLen(rio *rdb, int *isencoded);
|
||||
int rdbSaveObjectType(rio *rdb, robj *o);
|
||||
int rdbLoadObjectType(rio *rdb);
|
||||
int rdbLoad(char *filename);
|
||||
int rdbSaveBackground(char *filename);
|
||||
void rdbRemoveTempFile(pid_t childpid);
|
||||
@ -42,12 +77,6 @@ off_t rdbSavedObjectPages(robj *o);
|
||||
robj *rdbLoadObject(int type, rio *rdb);
|
||||
void backgroundSaveDoneHandler(int exitcode, int bysignal);
|
||||
int rdbSaveKeyValuePair(rio *rdb, robj *key, robj *val, time_t expireitme, time_t now);
|
||||
int rdbLoadType(rio *rdb);
|
||||
time_t rdbLoadTime(rio *rdb);
|
||||
robj *rdbLoadStringObject(rio *rdb);
|
||||
int rdbSaveType(rio *rdb, unsigned char type);
|
||||
int rdbSaveLen(rio *rdb, uint32_t len);
|
||||
int rdbSaveObjectType(rio *rdb, robj *o);
|
||||
int rdbLoadObjectType(rio *rdb);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user