]>
git.saurik.com Git - redis.git/blob - src/rdb.h
93185fc3784842833786c509709a4ab5e69f4d13
7 /* TBD: include only necessary headers. */
10 /* Dup object types to RDB object types. Only reason is readability (are we
11 * dealing with RDB types or with in-memory object types?). */
12 #define REDIS_RDB_TYPE_STRING 0
13 #define REDIS_RDB_TYPE_LIST 1
14 #define REDIS_RDB_TYPE_SET 2
15 #define REDIS_RDB_TYPE_ZSET 3
16 #define REDIS_RDB_TYPE_HASH 4
18 /* Object types for encoded objects. */
19 #define REDIS_RDB_TYPE_HASH_ZIPMAP 9
20 #define REDIS_RDB_TYPE_LIST_ZIPLIST 10
21 #define REDIS_RDB_TYPE_SET_INTSET 11
22 #define REDIS_RDB_TYPE_ZSET_ZIPLIST 12
24 /* Test if a type is an object type. */
25 #define rdbIsObjectType(t) ((t >= 0 && t <= 4) || (t >= 9 && t <= 12))
27 /* Special RDB opcodes (saved/loaded with rdbSaveType/rdbLoadType). */
28 #define REDIS_RDB_OPCODE_EXPIRETIME 253
29 #define REDIS_RDB_OPCODE_SELECTDB 254
30 #define REDIS_RDB_OPCODE_EOF 255
32 /* Test if a type is an opcode. */
33 #define rdbIsOpcode(t) (t >= 253 && t <= 255)
35 int rdbLoad(char *filename
);
36 int rdbSaveBackground(char *filename
);
37 void rdbRemoveTempFile(pid_t childpid
);
38 int rdbSave(char *filename
);
39 int rdbSaveObject(rio
*rdb
, robj
*o
);
40 off_t
rdbSavedObjectLen(robj
*o
);
41 off_t
rdbSavedObjectPages(robj
*o
);
42 robj
*rdbLoadObject(int type
, rio
*rdb
);
43 void backgroundSaveDoneHandler(int exitcode
, int bysignal
);
44 int rdbSaveKeyValuePair(rio
*rdb
, robj
*key
, robj
*val
, time_t expireitme
, time_t now
);
45 int rdbLoadType(rio
*rdb
);
46 time_t rdbLoadTime(rio
*rdb
);
47 robj
*rdbLoadStringObject(rio
*rdb
);
48 int rdbSaveType(rio
*rdb
, unsigned char type
);
49 int rdbSaveLen(rio
*rdb
, uint32_t len
);
50 int rdbSaveObjectType(rio
*rdb
, robj
*o
);
51 int rdbLoadObjectType(rio
*rdb
);