#define REDIS_RDB_ENC_INT32 2 /* 32 bit signed integer */
#define REDIS_RDB_ENC_LZF 3 /* string compressed with FASTLZ */
+/* MDB states */
+#define REDIS_MDB_OFF 0 /* MDB is off */
+#define REDIS_MDB_ON 1 /* MDB is on */
+
/* AOF states */
#define REDIS_AOF_OFF 0 /* AOF is off */
#define REDIS_AOF_ON 1 /* AOF is on */
#define REDIS_LRU_CLOCK_RESOLUTION 10 /* LRU clock resolution in seconds */
typedef struct redisObject {
unsigned type:4;
- unsigned notused:2; /* Not used */
+ unsigned archived:1;
+ unsigned notused:1; /* Not used */
unsigned encoding:4;
unsigned lru:22; /* lru time (relative to server.lruclock) */
int refcount;
} multiState;
typedef struct blockingState {
- robj **keys; /* The key we are waiting to terminate a blocking
+ dict *keys; /* The keys we are waiting to terminate a blocking
* operation such as BLPOP. Otherwise NULL. */
- int count; /* Number of blocking keys */
time_t timeout; /* Blocking operation timeout. If UNIX current time
* is >= timeout then the operation timed out. */
robj *target; /* The key that should receive the element,
time_t rdb_save_time_start; /* Current RDB save start time. */
int lastbgsave_status; /* REDIS_OK or REDIS_ERR */
int stop_writes_on_bgsave_err; /* Don't allow writes if can't BGSAVE */
+ /* MDB archival */
+ int mdb_state; /* REDIS_MDB_(ON|OFF) */
+ char *mdb_environment; /* Name of the MDB file */
+ size_t mdb_mapsize; /* Map size for use with MDB */
/* Propagation of commands in AOF / replication */
redisOpArray also_propagate; /* Additional command to propagate. */
/* Logging */
extern dictType setDictType;
extern dictType zsetDictType;
extern dictType dbDictType;
+extern dictType shaScriptObjectDictType;
extern double R_Zero, R_PosInf, R_NegInf, R_Nan;
extern dictType hashDictType;
void setKey(redisDb *db, robj *key, robj *val);
int dbExists(redisDb *db, robj *key);
robj *dbRandomKey(redisDb *db);
+int dbDeleteSoft(redisDb *db, robj *key);
int dbDelete(redisDb *db, robj *key);
long long emptyDb();
int selectDb(redisClient *c, int id);
void signalFlushedDb(int dbid);
unsigned int GetKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count);
+/* external database archival */
+void stopKeyArchive(void);
+int startKeyArchive(void);
+robj *recover(redisDb *db, robj *key);
+int archive(redisDb *db, robj *key);
+void purge(robj *key);
+
/* API to get key arguments from commands */
#define REDIS_GETKEYS_ALL 0
#define REDIS_GETKEYS_PRELOAD 1