Skip to content

Commit

Permalink
merged with master
Browse files Browse the repository at this point in the history
  • Loading branch information
psrvere committed Nov 13, 2024
2 parents ad5da76 + 5d20e1e commit 1d14cfb
Show file tree
Hide file tree
Showing 105 changed files with 6,676 additions and 2,597 deletions.
123 changes: 0 additions & 123 deletions docs/src/content/docs/commands/BF.INFO.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/content/docs/commands/BITFIELD.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The BITFIELD command in DiceDB allows for direct bitwise manipulation within a b
- INCRBY: Increments the value at a specific offset by a given amount, useful for counters.
- OVERFLOW: Defines the overflow behavior (WRAP, SAT, FAIL) for INCRBY, determining how to handle values that exceed the bitfield’s limits.
#### Overflow Options:
### Overflow Options:
- WRAP: Cycles values back to zero on overflow (default behavior).
- SAT: Saturates to the maximum or minimum value for the bit width.
- FAIL: Prevents overflow by causing INCRBY to fail if it would exceed the limits.
Expand Down
5 changes: 4 additions & 1 deletion docs/src/content/docs/commands/BITOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ BITOP operation destkey key [key ...]

## Return Value

The command returns the size of the string stored in the destination key, which is equal to the size of the longest input string.
| Condition | Return Value |
|--------------|-------------|
| Integer | The command returns an integer value representing the length of the resulting string. |
| Error | An error is returned if the command fails. |

## Behaviour

Expand Down
8 changes: 3 additions & 5 deletions docs/src/content/docs/commands/BITPOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ OK
(integer) -1
```

### Error Cases

#### Non-String Key
### Non-String Key

Attempting to use `BITPOS` on a key that holds a non-string value:

Expand All @@ -95,7 +93,7 @@ Attempting to use `BITPOS` on a key that holds a non-string value:
(error) WRONGTYPE Operation against a key holding the wrong kind of value
```

#### Invalid Bit Value
### Invalid Bit Value

Using a bit value other than 0 or 1:

Expand All @@ -106,7 +104,7 @@ OK
(error) ERR bit is not an integer or out of range
```

#### Invalid Range
### Invalid Range

Using non-integer values for the `start` or `end` parameters:

Expand Down
5 changes: 4 additions & 1 deletion docs/src/content/docs/commands/COMMAND COUNT.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ This command does not accept any parameters.

## Return values

- **Integer**: The command returns an integer representing the total number of commands available in the DiceDB server.
| Condition | Return Value |
|-----------|--------------|
| Command is successful | Integer |
| Error | An error is returned if the command fails. |

## Behavior

Expand Down
18 changes: 10 additions & 8 deletions docs/src/content/docs/commands/COMMAND GETKEYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ COMMAND GETKEYS command arg [arg ...]

## Parameters

- **`command`**: The DiceDB command from which the keys will be extracted (e.g., MSET, DEL, etc.).
- **`arg [arg ...]`**: The arguments for the command, which may include keys, values, or other command parameters.
| Parameter | Description | Type | Required |
|-----------|-----------------------------------------------------------------------------|--------|----------|
| `command` | The command for which keys need to be extracted. | String | Yes |
| `arg` | Arguments for the specified command. | String | Yes |


## Return values

- **Array**: Returns an array of keys found in the provided command and its arguments.
- For example, if the command is `MSET key1 value1 key2 value2`, the return value will be:
```bash
1) "key1"
2) "key2"
```
| Condition | Return Value |
|-----------|--------------|
| Command is successful | Array of keys |
| Error | An error is returned if the command fails. |


## Behavior

Expand Down
5 changes: 4 additions & 1 deletion docs/src/content/docs/commands/COMMAND HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ This command does not accept any parameters.

## Return values

Returns an array of help text entries. Each entry describes a subcommand, its syntax, and its purpose.
| Condition | Return Value |
|-----------|--------------|
| Command is successful | Help text detailing the available subcommands for the `COMMAND` command. |
| Error | An error is returned if the command fails. |

## Behavior

Expand Down
49 changes: 30 additions & 19 deletions docs/src/content/docs/commands/COMMAND INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,19 @@ COMMAND INFO command-name [command-name ...]

## Parameters

- **`command-name`**: One or more command names for which the information is requested. You can pass multiple command names to retrieve their details.
| Parameter | Description | Type | Required |
|----------------|-------------|--------|----------|
| `command-name` | The name of the command for which information is requested. | String | No |

## Behavior

The `COMMAND INFO` command retrieves detailed information about one or more specified commands in the DiceDB server. The command operates as follows:

1. **Input Arguments**: The command takes a variable number of arguments, where each argument is expected to be the name of a command for which information is requested.
2. **Default Behavior**: If no command names are provided, the command will return default information about all available commands.
3. **Command Metadata Retrieval**: The command iterates over the predefined command metadata (`DiceCmds`) and stores the metadata in a map for quick lookup.
4. **Command Name Lookup**: For each provided command name, the command checks if it exists in the metadata map:
- If the command exists, its metadata is appended to the result list.
- If the command name is incorrect or not supported `nil` is appended in its place to indicate the absence of valid information.
5. **Result Encoding**: Finally, the result list, which contains the metadata for the valid command names and `nil` for any invalid ones, is encoded and returned as the output.

### Note:

1. If a valid command name is specified, its corresponding metadata is returned.
2. If a command name is incorrect or not supported, `nil` is returned in its place.

## Return Values

Returns an array of arrays, where each sub-array contains the following information for the specified commands:
| Condition | Return Value |
|-----------|--------------|
| Command is successful | Array containing detailed information about the specified commands. |
| Error | An error is returned if the command fails. |

The detailed information for each command includes the following fields:

- **Command Name**: The name of the command.
- **Arity**: An integer representing the number of arguments the command expects.
Expand Down Expand Up @@ -67,9 +58,23 @@ The structure of the returned data is as follows:
]
```

## Behavior

The `COMMAND INFO` command retrieves detailed information about one or more specified commands in the DiceDB server. The command operates as follows:

1. **Input Arguments**: The command takes a variable number of arguments, where each argument is expected to be the name of a command for which information is requested.
2. **Default Behavior**: If no command names are provided, the command will return default information about all available commands.
3. **Command Metadata Retrieval**: The command iterates over the predefined command metadata (`DiceCmds`) and stores the metadata in a map for quick lookup.
4. **Command Name Lookup**: For each provided command name, the command checks if it exists in the metadata map:
- If the command exists, its metadata is appended to the result list.
- If the command name is incorrect or not supported `nil` is appended in its place to indicate the absence of valid information.
5. **Result Encoding**: Finally, the result list, which contains the metadata for the valid command names and `nil` for any invalid ones, is encoded and returned as the output.

## Errors

No error is raised, as this command supports a variable number of arguments.
1. `Arity Error`
- Error Message: `(error) ERR wrong number of arguments for 'command|info' command`
- Occurs when an incorrect number of arguments is provided to the `COMMAND INFO` command.

## Example Usage

Expand Down Expand Up @@ -111,3 +116,9 @@ An error is thrown when the command name passed to the `COMMAND INFO` command is
127.0.0.1:7379> COMMAND INFO UNKNOWNCOMMAND
1) (nil)
```


### Note:

1. If a valid command name is specified, its corresponding metadata is returned.
2. If a command name is incorrect or not supported, `nil` is returned in its place.
7 changes: 4 additions & 3 deletions docs/src/content/docs/commands/COMMAND LIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: COMMAND LIST
description: Documentation for the DiceDB command COMMAND LIST.
---

## Introduction

The `COMMAND LIST` command retrieves a list of all commands supported by the DiceDB server. This allows users to discover available commands for various operations, making it easier to understand the capabilities of the database.

## Syntax
Expand All @@ -19,7 +17,10 @@ This command does not accept any parameters.

## Return values

The command returns an array of strings, where each string represents a command name available in the DiceDB server. If no commands are available (which is unlikely), an empty array is returned.
| Condition | Return Value |
|-----------|--------------|
| Command is successful | Array containing the names of all commands supported by the DiceDB server. |
| Error | An error is returned if the command fails. |

## Behavior

Expand Down
29 changes: 17 additions & 12 deletions docs/src/content/docs/commands/COMMAND.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ COMMAND

This command does not accept any parameters.

## Behavior

When no subcommand is provided, this command functions as the default implementation of the `COMMAND INFO` command in the absence of a specified command name. It iterates through the list of registered commands and subcommands, returning an array containing detailed metadata for each command.

## Return values

Returns an array, where each element is a nested array containing the following details for each command
| Condition | Return Value |
|-----------|--------------|
| Command is successful | Array containing detailed information about all commands supported by the DiceDB server. |
| Error | An error is returned if the command fails. |

- **Command Name**: The name of the command.
- **Arity**: An integer representing the number of arguments the command expects.
Expand All @@ -49,6 +49,11 @@ Returns an array, where each element is a nested array containing the following
.
```

## Behavior

When no subcommand is provided, this command functions as the default implementation of the `COMMAND INFO` command in the absence of a specified command name. It iterates through the list of registered commands and subcommands, returning an array containing detailed metadata for each command.


## Errors

No error is thrown in the default implementation of the `COMMAND` command when no subcommand is provided.
Expand Down Expand Up @@ -96,23 +101,23 @@ COMMAND <subcommand>
### Parameters

- **subcommand**: Optional. Available subcommands include:
- `COUNT` : Returns the total number of commands in the DiceDB server.
- `GETKEYS` : Returns the keys from the provided command and arguments.
- `LIST` : Returns the list of all the commands in the DiceDB server.
- `INFO` : Returns details about the specified commands.
- `HELP` : Displays the help section for `COMMAND`, providing information about each available subcommand.
- [`COUNT`](/commands/command-count) : Returns the total number of commands in the DiceDB server.
- [`GETKEYS`](/commands/command-getkeys) : Returns the keys from the provided command and arguments.
- [`LIST`](/commands/command-list): Returns the list of all the commands in the DiceDB server.
- [`INFO`](/commands/command-info): Returns details about the specified commands.
- [`HELP`](/commands/command-help) : Displays the help section for `COMMAND`, providing information about each available subcommand.

**For more details on each subcommand, please refer to their respective documentation pages.**

### Errors
## Errors

1. `Unknown subcommand`
- Error Message: ` (error) ERR unknown subcommand 'sucommand-name'. Try COMMAND HELP.`
- This error may occur if the subcommand is misspelled or not recognized by the DiceDB server.

### Example Usage
## Example Usage

#### Invalid usage
### Invalid usage

An error is thrown when an incorrect or unsupported subcommand name is provided.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/commands/COPY.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ When the `COPY` command is executed, DiceDB will:
4. Copy the value from the source key to the destination key.
5. Return `1` if the copy operation was successful.

## Error Handling
## Errors

The `COPY` command can raise the following errors:

Expand Down
Loading

0 comments on commit 1d14cfb

Please sign in to comment.