diff --git a/.gitignore b/.gitignore index 1ee4523c3c..3ffcf26c13 100644 --- a/.gitignore +++ b/.gitignore @@ -166,6 +166,7 @@ ClientBin/ node_modules/ **/log-commits .mono +**/package-lock.json # RIA/Silverlight projects Generated_Code/ diff --git a/website/docs/commands/acl.md b/website/docs/commands/acl.md new file mode 100644 index 0000000000..7b46c23aac --- /dev/null +++ b/website/docs/commands/acl.md @@ -0,0 +1,126 @@ +--- +id: acl-commands +sidebar_label: ACL +title: ACL +slug: acl +--- + +### ACL CAT + +#### Syntax + +```bash + ACL CAT [category] +``` + +The command shows the available ACL categories if called without arguments. If a category name is given, the command shows all the Garnet commands in the specified category. + +#### Resp Reply + +One of the following: + +* Array reply: an array of Bulk string reply elements representing ACL categories or commands in a given category. +* Simple error reply: the command returns an error if an invalid category name is given. + +--- + +### ACL DELUSER + +#### Syntax + +```bash + ACL DELUSER username [username ...] +``` + +Delete all the specified ACL users and terminate all the connections that are authenticated with such users. Note: the special default user cannot be removed from the system, this is the default user that every new connection is authenticated with. The list of users may include usernames that do not exist, in such case no operation is performed for the non existing users. + +#### Resp Reply + +Integer reply: the number of users that were deleted. This number will not always match the number of arguments since certain users may not exist. + +--- + +### ACL LIST + +#### Syntax + +```bash + ACL LIST +``` + +The command shows the currently active ACL rules in the Garnet server. + +#### Resp Reply + +Array reply: an array of Bulk string reply elements. + +--- + +### ACL LOAD + +#### Syntax + +```bash + ACL LOAD +``` + +When Garnet is configured to use an ACL file, this command will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file. The command makes sure to have an all or nothing behavior, that is: + +* If every line in the file is valid, all the ACLs are loaded. +* If one or more line in the file is not valid, nothing is loaded, and the old ACL rules defined in the server memory continue to be used. + +#### Resp Reply + +Returns +OK on success, otherwise --ERR message if any. + +--- + +### ACL SETUSER + +#### Syntax + +```bash + ACL SETUSER username [rule [rule ...]] +``` + +Create an ACL user with the specified rules or modify the rules of an existing user. + +Manipulate Garnet ACL users interactively. If the username does not exist, the command creates the username without any privilege. It then reads from left to right all the rules provided as successive arguments, setting the user ACL rules as specified. If the user already exists, the provided ACL rules are simply applied in addition to the rules already set. + +#### Resp Reply + +Returns +OK on success, otherwise --ERR message if any. + +--- + +### ACL USERS + +#### Syntax + +```bash + ACL USERS +``` + +The command shows a list of all the usernames of the currently configured users in the Garnet ACL system. + +#### Resp Reply + +Array reply: list of existing ACL users. + +--- + +### ACL WHOAMI + +#### Syntax + +```bash + ACL WHOAMI +``` + +Return the username the current connection is authenticated with. New connections are authenticated with the "default" user. They can change user using AUTH. + +#### Resp Reply + +Bulk string reply: the username of the current connection. + +--- \ No newline at end of file diff --git a/website/docs/commands/api-compatibility.md b/website/docs/commands/api-compatibility.md index c5f94ab0a0..a2a8183ae4 100644 --- a/website/docs/commands/api-compatibility.md +++ b/website/docs/commands/api-compatibility.md @@ -9,29 +9,42 @@ Below is the full list of API commands and their implementation status in Garnet Note that this list is subject to change as we continue to expand our API command support with the help of our growing community. ### Command Categories -1. [BITMAP](#bitmap) -2. [CLUSTER](#cluster) -3. [CONNECTION](#connection) -4. [FUNCTIONS](#functions) -5. [GENERIC](#generic) -6. [GEO](#geo) -7. [HASH](#hash) -8. [HYPERLOGLOG](#hyperloglog) -9. [KEYS](#keys) -10. [LIST](#list) -11. [PUB/SUB](#pubsub) -12. [SCRIPTING](#scripting) -13. [SERVER](#server) -14. [SET](#set) -15. [SORTED SET](#sorted-set) -16. [STREAM](#stream) -17. [STRING](#string) -18. [TRANSACTIONS](#transactions) +1. [ACL](#acl) +2. [BITMAP](#bitmap) +3. [CLUSTER](#cluster) +4. [CONNECTION](#connection) +5. [FUNCTIONS](#functions) +6. [GENERIC](#generic) +7. [GEO](#geo) +8. [HASH](#hash) +9. [HYPERLOGLOG](#hyperloglog) +10. [KEYS](#keys) +11. [LIST](#list) +12. [PUB/SUB](#pubsub) +13. [SCRIPTING](#scripting) +14. [SERVER](#server) +15. [SET](#set) +16. [SORTED SET](#sorted-set) +17. [STREAM](#stream) +18. [STRING](#string) +10. [TRANSACTIONS](#transactions) ### Full Commands List | Category | Command | Implemented in Garnet | Notes | | ------------- | ------------- | ------------- | ------------- | +| **ACL** | [CAT](acl.md#acl-cat) | ➕ | | +| | [DELUSER](acl.md#acl-deluser) | ➕ | | +| | DRYRUN | ➖ | | +| | GENPASS | ➖ | | +| | GETUSER | ➖ | | +| | [LIST](acl.md#acl-list) | ➕ | | +| | [LOAD](acl.md#acl-load) | ➕ | | +| | LOG | ➖ | | +| | SAVE | ➖ | | +| | [SETUSER](acl.md#acl-setuser) | ➕ | | +| | [USERS](acl.md#acl-users) | ➕ | | +| | [WHOAMI](acl.md#acl-whoami) | ➕ | | | **BITMAP** | [BITCOUNT](analytics.md#bitcount) | ➕ | | | | [BITFIELD](analytics.md#bitfield) | ➕ | | | | BITFIELD_RO | ➖ | | @@ -223,7 +236,7 @@ Note that this list is subject to change as we continue to expand our API comman | | SMISMEMBER | ➖ | | | | SMOVE | ➖ | | | | [SPOP](data-structures.md#spop) | ➕ | | -| | SRANDMEMBER | ➖ | | +| | [SRANDMEMBER](data-structures.md#srandmember) | ➕ | | | | [SREM](data-structures.md#srem) | ➕ | | | | [SSCAN](data-structures.md#sscan) | ➕ | | | | SUNION | ➖ | | @@ -297,7 +310,7 @@ Note that this list is subject to change as we continue to expand our API comman | | [SET](raw-string.md#set) | ➕ | | | | [SET ... NX](raw-string.md#set) | ➕ | | | | [SETEX](raw-string.md#setex) | ➕ | | -| | [SETNX](raw-string.md#setnx) | ➕ | | +| | SETNX | ➖ | | | | SETRANGE | ➕ | | | | [STRLEN](raw-string.md#strlen) | ➕ | | | | SUBSTR | ➖ | | diff --git a/website/docs/commands/data-structures.md b/website/docs/commands/data-structures.md index 033fb6c468..7e15159f2f 100644 --- a/website/docs/commands/data-structures.md +++ b/website/docs/commands/data-structures.md @@ -464,6 +464,23 @@ Returns if **member** is a member of the set stored at **key**. --- +### SRANDMEMBER + +#### Syntax + +```bash + SRANDMEMBER key [count] +``` + +When called with just the **key** argument, return a random element from the set value stored at **key**. + +If the provided **count** argument is positive, return an array of **distinct elements**. The array's length is either **count** or the set's cardinality (SCARD), whichever is lower. + +If called with a negative **count**, the behavior changes and the command is allowed to return the **same element multiple times**. In this case, the number of returned elements is the absolute value of the specified **count**. + +--- + + ### SREM #### Syntax diff --git a/website/docs/commands/raw-string.md b/website/docs/commands/raw-string.md index 9020644f77..56cac8e890 100644 --- a/website/docs/commands/raw-string.md +++ b/website/docs/commands/raw-string.md @@ -231,25 +231,6 @@ Simple string reply: OK. --- -### SETNX - -#### Syntax - -```bash - SETNX key value -``` - -Set **key** to hold value if **key** does not exist. When **key** already holds a value, no operation is performed. - -#### Resp Reply - -One of the following: - -* Integer reply: 0 if the key was not set. -* Integer reply: 1 if the key was set. - ---- - ### STRLEN #### Syntax diff --git a/website/sidebars.js b/website/sidebars.js index a211513df7..03f4f9796d 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -20,7 +20,7 @@ const sidebars = { {type: 'category', label: 'Welcome', collapsed: false, items: ["welcome/intro", "welcome/news", "welcome/features", "welcome/releases", "welcome/compatibility", "welcome/roadmap", "welcome/faq", "welcome/about-us"]}, {type: 'category', label: 'Getting Started', items: ["getting-started/build", "getting-started/configuration", "getting-started/security"]}, {type: 'category', label: 'Benchmarking', items: ["benchmarking/overview", "benchmarking/results-resp-bench", "benchmarking/resp-bench"]}, - {type: 'category', label: 'Commands', items: ["commands/overview", "commands/api-compatibility", "commands/raw-string", "commands/generic-commands", "commands/analytics-commands", "commands/data-structures", "commands/server-commands", "commands/checkpoint-commands", "commands/transactions-commands", "commands/cluster"]}, + {type: 'category', label: 'Commands', items: ["commands/overview", "commands/api-compatibility", "commands/raw-string", "commands/generic-commands", "commands/analytics-commands", "commands/data-structures", "commands/server-commands", "commands/checkpoint-commands", "commands/transactions-commands", "commands/cluster", "commands/acl-commands"]}, {type: 'category', label: 'Server Extensions', items: ["extensions/transactions", "extensions/raw-strings", "extensions/objects"]}, {type: 'category', label: 'Cluster Mode', items: ["cluster/overview", "cluster/replication", "cluster/key-migration"]}, {type: 'category', label: 'Developer Guide', items: ["dev/onboarding", "dev/code-structure", "dev/configuration", "dev/network", "dev/processing", "dev/garnet-api",