Skip to content

Commit

Permalink
supporting more filters for Client List and Client Kill
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <[email protected]>
  • Loading branch information
sarthakaggarwal97 committed Dec 20, 2024
1 parent a944e0e commit e518d93
Show file tree
Hide file tree
Showing 5 changed files with 585 additions and 11 deletions.
16 changes: 14 additions & 2 deletions src/commands.def
Original file line number Diff line number Diff line change
Expand Up @@ -1327,12 +1327,18 @@ struct COMMAND_ARG CLIENT_KILL_filter_new_format_Subargs[] = {
{MAKE_ARG("laddr",ARG_TYPE_STRING,-1,"LADDR",NULL,"6.2.0",CMD_ARG_OPTIONAL,0,NULL),.display_text="ip:port"},
{MAKE_ARG("skipme",ARG_TYPE_ONEOF,-1,"SKIPME",NULL,NULL,CMD_ARG_OPTIONAL,2,NULL),.subargs=CLIENT_KILL_filter_new_format_skipme_Subargs},
{MAKE_ARG("maxage",ARG_TYPE_INTEGER,-1,"MAXAGE",NULL,"8.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("name",ARG_TYPE_STRING,-1,"NAME",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("minidle",ARG_TYPE_INTEGER,-1,"MINIDLE",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("flags",ARG_TYPE_STRING,-1,"FLAGS",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("pattern",ARG_TYPE_STRING,-1,"PATTERN",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("channel",ARG_TYPE_STRING,-1,"CHANNEL",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("shardchannel",ARG_TYPE_STRING,-1,"SHARDCHANNEL",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
};

/* CLIENT KILL filter argument table */
struct COMMAND_ARG CLIENT_KILL_filter_Subargs[] = {
{MAKE_ARG("old-format",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,"2.8.12"),.display_text="ip:port"},
{MAKE_ARG("new-format",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE,7,NULL),.subargs=CLIENT_KILL_filter_new_format_Subargs},
{MAKE_ARG("new-format",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE,13,NULL),.subargs=CLIENT_KILL_filter_new_format_Subargs},
};

/* CLIENT KILL argument table */
Expand Down Expand Up @@ -1390,6 +1396,12 @@ struct COMMAND_ARG CLIENT_LIST_Args[] = {
{MAKE_ARG("laddr",ARG_TYPE_STRING,-1,"LADDR",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL),.display_text="ip:port"},
{MAKE_ARG("skipme",ARG_TYPE_ONEOF,-1,"SKIPME",NULL,"8.1.0",CMD_ARG_OPTIONAL,2,NULL),.subargs=CLIENT_LIST_skipme_Subargs},
{MAKE_ARG("maxage",ARG_TYPE_INTEGER,-1,"MAXAGE",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("name",ARG_TYPE_STRING,-1,"NAME",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("minidle",ARG_TYPE_INTEGER,-1,"MINIDLE",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("flags",ARG_TYPE_STRING,-1,"FLAGS",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("pattern",ARG_TYPE_STRING,-1,"PATTERN",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("channel",ARG_TYPE_STRING,-1,"CHANNEL",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("shardchannel",ARG_TYPE_STRING,-1,"SHARDCHANNEL",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
};

/********** CLIENT NO_EVICT ********************/
Expand Down Expand Up @@ -1672,7 +1684,7 @@ struct COMMAND_STRUCT CLIENT_Subcommands[] = {
{MAKE_CMD("import-source","Mark this client as an import source when server is in import mode.","O(1)","8.1.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_IMPORT_SOURCE_History,0,CLIENT_IMPORT_SOURCE_Tips,0,clientCommand,3,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE,ACL_CATEGORY_CONNECTION,CLIENT_IMPORT_SOURCE_Keyspecs,0,NULL,1),.args=CLIENT_IMPORT_SOURCE_Args},
{MAKE_CMD("info","Returns information about the connection.","O(1)","6.2.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_INFO_History,0,CLIENT_INFO_Tips,1,clientCommand,2,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_INFO_Keyspecs,0,NULL,0)},
{MAKE_CMD("kill","Terminates open connections.","O(N) where N is the number of client connections","2.4.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_KILL_History,7,CLIENT_KILL_Tips,0,clientCommand,-3,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_KILL_Keyspecs,0,NULL,1),.args=CLIENT_KILL_Args},
{MAKE_CMD("list","Lists open connections.","O(N) where N is the number of client connections","2.4.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_LIST_History,7,CLIENT_LIST_Tips,1,clientCommand,-2,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_LIST_Keyspecs,0,NULL,7),.args=CLIENT_LIST_Args},
{MAKE_CMD("list","Lists open connections.","O(N) where N is the number of client connections","2.4.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_LIST_History,7,CLIENT_LIST_Tips,1,clientCommand,-2,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_LIST_Keyspecs,0,NULL,13),.args=CLIENT_LIST_Args},
{MAKE_CMD("no-evict","Sets the client eviction mode of the connection.","O(1)","7.0.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_NO_EVICT_History,0,CLIENT_NO_EVICT_Tips,0,clientCommand,3,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_NO_EVICT_Keyspecs,0,NULL,1),.args=CLIENT_NO_EVICT_Args},
{MAKE_CMD("no-touch","Controls whether commands sent by the client affect the LRU/LFU of accessed keys.","O(1)","7.2.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_NO_TOUCH_History,0,CLIENT_NO_TOUCH_Tips,0,clientCommand,3,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE,ACL_CATEGORY_CONNECTION,CLIENT_NO_TOUCH_Keyspecs,0,NULL,1),.args=CLIENT_NO_TOUCH_Args},
{MAKE_CMD("pause","Suspends commands processing.","O(1)","3.0.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_PAUSE_History,1,CLIENT_PAUSE_Tips,0,clientCommand,-3,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_PAUSE_Keyspecs,0,NULL,2),.args=CLIENT_PAUSE_Args},
Expand Down
42 changes: 42 additions & 0 deletions src/commands/client-kill.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,48 @@
"type": "integer",
"optional": true,
"since": "8.0.0"
},
{
"token": "NAME",
"name": "name",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "MINIDLE",
"name": "minidle",
"type": "integer",
"optional": true,
"since": "8.1.0"
},
{
"token": "FLAGS",
"name": "flags",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "PATTERN",
"name": "pattern",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "CHANNEL",
"name": "channel",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "SHARDCHANNEL",
"name": "shardchannel",
"type": "string",
"optional": true,
"since": "8.1.0"
}
]
}
Expand Down
42 changes: 42 additions & 0 deletions src/commands/client-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,48 @@
"type": "integer",
"optional": true,
"since": "8.1.0"
},
{
"token": "NAME",
"name": "name",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "MINIDLE",
"name": "minidle",
"type": "integer",
"optional": true,
"since": "8.1.0"
},
{
"token": "FLAGS",
"name": "flags",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "PATTERN",
"name": "pattern",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "CHANNEL",
"name": "channel",
"type": "string",
"optional": true,
"since": "8.1.0"
},
{
"token": "SHARDCHANNEL",
"name": "shardchannel",
"type": "string",
"optional": true,
"since": "8.1.0"
}
]
}
Expand Down
Loading

0 comments on commit e518d93

Please sign in to comment.