]> git.saurik.com Git - redis.git/blobdiff - src/redis.h
command table refactoring to make it simpler adding new flags
[redis.git] / src / redis.h
index e9a31b8c3889f3a3c74fdc1bfd5aed4799c40807..2e59533a011304bb87103ac059f14903d761aba8 100644 (file)
 /* Hash table parameters */
 #define REDIS_HT_MINFILL        10      /* Minimal hash table fill 10% */
 
-/* Command flags:
- *   REDIS_CMD_DENYOOM:
- *     Commands marked with this flag will return an error when 'maxmemory' is
- *     set and the server is using more than 'maxmemory' bytes of memory.
- *     In short: commands with this flag are denied on low memory conditions.
- *   REDIS_CMD_FORCE_REPLICATION:
- *     Force replication even if dirty is 0. */
-#define REDIS_CMD_DENYOOM 4
-#define REDIS_CMD_FORCE_REPLICATION 8
+/* Command flags. Please check the command table defined in the redis.c file
+ * for more information about the meaning of every flag. */
+#define REDIS_CMD_WRITE 1                   /* "w" flag */
+#define REDIS_CMD_READONLY 2                /* "r" flag */
+#define REDIS_CMD_DENYOOM 4                 /* "m" flag */
+#define REDIS_CMD_FORCE_REPLICATION 8       /* "f" flag */
+#define REDIS_CMD_ADMIN 16                  /* "a" flag */
+#define REDIS_CMD_PUBSUB 32                 /* "p" flag */
 
 /* Object types */
 #define REDIS_STRING 0
@@ -635,7 +634,8 @@ struct redisCommand {
     char *name;
     redisCommandProc *proc;
     int arity;
-    int flags;
+    char *sflags; /* Flags as string represenation, one char per flag. */
+    int flags;    /* The actual flags, obtained from the 'sflags' field. */
     /* Use a function to determine keys arguments in a command line.
      * Used for Redis Cluster redirect. */
     redisGetKeysProc *getkeys_proc;