X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/2c2b20853724d86eaa6c51308f11645cc576dc1c..fa5af017d95dfd56b92ebe14064f995b19e4907f:/src/redis.h diff --git a/src/redis.h b/src/redis.h index 53507c88..431eeb14 100644 --- a/src/redis.h +++ b/src/redis.h @@ -39,7 +39,8 @@ /* Static server configuration */ #define REDIS_SERVERPORT 6379 /* TCP port */ -#define REDIS_MAXIDLETIME (60*5) /* default client timeout */ +#define REDIS_MAXIDLETIME 0 /* default client timeout: infinite */ +#define REDIS_MAX_QUERYBUF_LEN (1024*1024*1024) /* 1GB max query buffer. */ #define REDIS_IOBUF_LEN (1024*16) #define REDIS_LOADBUF_LEN 1024 #define REDIS_DEFAULT_DBNUM 16 @@ -95,11 +96,6 @@ #define REDIS_ENCODING_INTSET 6 /* Encoded as intset */ #define REDIS_ENCODING_SKIPLIST 7 /* Encoded as skiplist */ -/* Object types only used for dumping to disk */ -#define REDIS_EXPIRETIME 253 -#define REDIS_SELECTDB 254 -#define REDIS_EOF 255 - /* 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: @@ -216,6 +212,15 @@ /* Scripting */ #define REDIS_LUA_TIME_LIMIT 5000 /* milliseconds */ +/* Units */ +#define UNIT_SECONDS 0 +#define UNIT_MILLISECONDS 1 + +/* SHUTDOWN flags */ +#define REDIS_SHUTDOWN_SAVE 1 /* Force SAVE on SHUTDOWN even if no save + points are configured. */ +#define REDIS_SHUTDOWN_NOSAVE 2 /* Don't SAVE on SHUTDOWN. */ + /* We can print the stacktrace, so our assert is defined this way: */ #define redisAssertWithInfo(_c,_o,_e) ((_e)?(void)0 : (_redisAssertWithInfo(_c,_o,#_e,__FILE__,__LINE__),_exit(1))) #define redisAssert(_e) ((_e)?(void)0 : (_redisAssert(#_e,__FILE__,__LINE__),_exit(1))) @@ -289,7 +294,7 @@ typedef struct redisClient { sds querybuf; int argc; robj **argv; - struct redisCommand *cmd; + struct redisCommand *cmd, *lastcmd; int reqtype; int multibulklen; /* number of multi bulk arguments left to read */ long bulklen; /* length of bulk argument in multi bulk request */ @@ -522,6 +527,7 @@ struct redisServer { long long stat_keyspace_misses; /* number of failed lookups of keys */ size_t stat_peak_memory; /* max used memory record */ long long stat_fork_time; /* time needed to perform latets fork() */ + long long stat_rejected_conn; /* clients rejected because of maxclients */ list *slowlog; long long slowlog_entry_id; long long slowlog_log_slower_than; @@ -529,6 +535,7 @@ struct redisServer { /* Configuration */ int verbosity; int maxidletime; + size_t client_max_querybuf_len; int dbnum; int daemonize; int appendonly; @@ -539,7 +546,7 @@ struct redisServer { off_t auto_aofrewrite_base_size;/* AOF size on latest startup or rewrite. */ off_t appendonly_current_size; /* AOF current size. */ int aofrewrite_scheduled; /* Rewrite once BGSAVE terminates. */ - int shutdown_asap; + int shutdown_asap; /* SHUTDOWN needed */ int activerehashing; char *requirepass; /* Persistence */ @@ -616,13 +623,22 @@ struct redisServer { /* Scripting */ lua_State *lua; /* The Lua interpreter. We use just one for all clients */ redisClient *lua_client; /* The "fake client" to query Redis from Lua */ + redisClient *lua_caller; /* The client running EVAL right now, or NULL */ dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */ long long lua_time_limit; long long lua_time_start; + int lua_write_dirty; /* True if a write command was called during the + execution of the current script. */ int lua_random_dirty; /* True if a random command was called during the - exection of the current script. */ + execution of the current script. */ int lua_timedout; /* True if we reached the time limit for script execution. */ + int lua_kill; /* Kill the script if true. */ + /* Assert & bug reportign */ + char *assert_failed; + char *assert_file; + int assert_line; + int bug_report_start; /* True if bug report header already logged. */ }; typedef struct pubsubPattern { @@ -757,6 +773,8 @@ void addReplyMultiBulkLen(redisClient *c, long length); void *dupClientReplyValue(void *o); void getClientsMaxBuffers(unsigned long *longest_output_list, unsigned long *biggest_input_buffer); +sds getClientInfoString(redisClient *client); +sds getAllClientsInfoString(void); void rewriteClientCommandVector(redisClient *c, int argc, ...); void rewriteClientCommandArgument(redisClient *c, int i, robj *newval); @@ -812,6 +830,7 @@ robj *tryObjectEncoding(robj *o); robj *getDecodedObject(robj *o); size_t stringObjectLen(robj *o); robj *createStringObjectFromLongLong(long long value); +robj *createStringObjectFromLongDouble(long double value); robj *createListObject(void); robj *createZiplistObject(void); robj *createSetObject(void); @@ -824,6 +843,8 @@ int checkType(redisClient *c, robj *o, int type); int getLongLongFromObjectOrReply(redisClient *c, robj *o, long long *target, const char *msg); int getDoubleFromObjectOrReply(redisClient *c, robj *o, double *target, const char *msg); int getLongLongFromObject(robj *o, long long *target); +int getLongDoubleFromObject(robj *o, long double *target); +int getLongDoubleFromObjectOrReply(redisClient *c, robj *o, long double *target, const char *msg); char *strEncoding(int encoding); int compareStringObjects(robj *a, robj *b); int equalStringObjects(robj *a, robj *b); @@ -941,8 +962,8 @@ void resetServerSaveParams(); int removeExpire(redisDb *db, robj *key); void propagateExpire(redisDb *db, robj *key); int expireIfNeeded(redisDb *db, robj *key); -time_t getExpire(redisDb *db, robj *key); -void setExpire(redisDb *db, robj *key, time_t when); +long long getExpire(redisDb *db, robj *key); +void setExpire(redisDb *db, robj *key, long long when); robj *lookupKey(redisDb *db, robj *key); robj *lookupKeyRead(redisDb *db, robj *key); robj *lookupKeyWrite(redisDb *db, robj *key); @@ -993,6 +1014,7 @@ void echoCommand(redisClient *c); void setCommand(redisClient *c); void setnxCommand(redisClient *c); void setexCommand(redisClient *c); +void psetexCommand(redisClient *c); void getCommand(redisClient *c); void delCommand(redisClient *c); void existsCommand(redisClient *c); @@ -1004,6 +1026,7 @@ void incrCommand(redisClient *c); void decrCommand(redisClient *c); void incrbyCommand(redisClient *c); void decrbyCommand(redisClient *c); +void incrbyfloatCommand(redisClient *c); void selectCommand(redisClient *c); void randomkeyCommand(redisClient *c); void keysCommand(redisClient *c); @@ -1053,8 +1076,11 @@ void mgetCommand(redisClient *c); void monitorCommand(redisClient *c); void expireCommand(redisClient *c); void expireatCommand(redisClient *c); +void pexpireCommand(redisClient *c); +void pexpireatCommand(redisClient *c); void getsetCommand(redisClient *c); void ttlCommand(redisClient *c); +void pttlCommand(redisClient *c); void persistCommand(redisClient *c); void slaveofCommand(redisClient *c); void debugCommand(redisClient *c); @@ -1097,6 +1123,7 @@ void hgetallCommand(redisClient *c); void hexistsCommand(redisClient *c); void configCommand(redisClient *c); void hincrbyCommand(redisClient *c); +void hincrbyfloatCommand(redisClient *c); void subscribeCommand(redisClient *c); void unsubscribeCommand(redisClient *c); void psubscribeCommand(redisClient *c); @@ -1126,5 +1153,6 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated)); void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line); void _redisAssert(char *estr, char *file, int line); void _redisPanic(char *msg, char *file, int line); +void bugReportStart(void); #endif