summaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/server.h b/src/server.h
index 80e07fb9d..32b24afc4 100644
--- a/src/server.h
+++ b/src/server.h
@@ -568,13 +568,22 @@ typedef enum {
#define PROPAGATE_AOF 1
#define PROPAGATE_REPL 2
-/* Client pause types, larger types are more restrictive
- * pause types than smaller pause types. */
-typedef enum {
- CLIENT_PAUSE_OFF = 0, /* Pause no commands */
- CLIENT_PAUSE_WRITE, /* Pause write commands */
- CLIENT_PAUSE_ALL /* Pause all commands */
-} pause_type;
+/* Actions pause types */
+#define PAUSE_ACTION_CLIENT_WRITE (1<<0)
+#define PAUSE_ACTION_CLIENT_ALL (1<<1) /* must be bigger than PAUSE_ACTION_CLIENT_WRITE */
+#define PAUSE_ACTION_EXPIRE (1<<2)
+#define PAUSE_ACTION_EVICT (1<<3)
+#define PAUSE_ACTION_REPLICA (1<<4) /* pause replica traffic */
+
+/* common sets of actions to pause/unpause */
+#define PAUSE_ACTIONS_CLIENT_WRITE_SET (PAUSE_ACTION_CLIENT_WRITE|\
+ PAUSE_ACTION_EXPIRE|\
+ PAUSE_ACTION_EVICT|\
+ PAUSE_ACTION_REPLICA)
+#define PAUSE_ACTIONS_CLIENT_ALL_SET (PAUSE_ACTION_CLIENT_ALL|\
+ PAUSE_ACTION_EXPIRE|\
+ PAUSE_ACTION_EVICT|\
+ PAUSE_ACTION_REPLICA)
/* Client pause purposes. Each purpose has its own end time and pause type. */
typedef enum {
@@ -585,7 +594,7 @@ typedef enum {
} pause_purpose;
typedef struct {
- pause_type type;
+ uint32_t paused_actions; /* Bitmask of actions */
mstime_t end;
} pause_event;
@@ -1531,10 +1540,9 @@ struct redisServer {
rax *clients_timeout_table; /* Radix tree for blocked clients timeouts. */
int in_nested_call; /* If > 0, in a nested call of a call */
rax *clients_index; /* Active clients dictionary by client ID. */
- pause_type client_pause_type; /* True if clients are currently paused */
+ uint32_t paused_actions; /* Bitmask of actions that are currently paused */
list *postponed_clients; /* List of postponed clients */
- mstime_t client_pause_end_time; /* Time when we undo clients_paused */
- pause_event *client_pause_per_purpose[NUM_PAUSE_PURPOSES];
+ pause_event client_pause_per_purpose[NUM_PAUSE_PURPOSES];
char neterr[ANET_ERR_LEN]; /* Error buffer for anet.c */
dict *migrate_cached_sockets;/* MIGRATE cached sockets */
redisAtomic uint64_t next_client_id; /* Next client unique ID. Incremental. */
@@ -2528,10 +2536,11 @@ void flushSlavesOutputBuffers(void);
void disconnectSlaves(void);
void evictClients(void);
int listenToPort(connListener *fds);
-void pauseClients(pause_purpose purpose, mstime_t end, pause_type type);
-void unpauseClients(pause_purpose purpose);
-int areClientsPaused(void);
-int checkClientPauseTimeoutAndReturnIfPaused(void);
+void pauseActions(pause_purpose purpose, mstime_t end, uint32_t actions_bitmask);
+void unpauseActions(pause_purpose purpose);
+uint32_t isPausedActions(uint32_t action_bitmask);
+uint32_t isPausedActionsWithUpdate(uint32_t action_bitmask);
+void updatePausedActions(void);
void unblockPostponedClients();
void processEventsWhileBlocked(void);
void whileBlockedCron();