Skip to content

Commit

Permalink
fixes typos across the repo (DiceDB#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
JyotinderSingh authored Sep 29, 2024
1 parent f6ef616 commit b5864c6
Show file tree
Hide file tree
Showing 140 changed files with 1,043 additions and 1,052 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ $ git push origin <your issue branch>
After this, create a PullRequest in `github <https://github.com/dicedb/docs/pulls>`_. Make sure you have linked the relevant Issue in the description with "Closes #number" or "Fixes #number".
```

- Once you receive comments on github on your changes, be sure to respond to them on github and address the concerns. If any discussions happen offline for the changes in question, make sure to capture the outcome of the discussion, so others can follow along as well.
- Once you receive comments on GitHub on your changes, be sure to respond to them on GitHub and address the concerns. If any discussions happen offline for the changes in question, make sure to capture the outcome of the discussion, so others can follow along as well.

It is possible that while your change is being reviewed, other changes were made to the master branch. Be sure to pull rebase your change on the new changes thus:

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We have multiple repositories where you can contribute. So, as per your interest

Although DiceDB is a drop-in replacement of Redis, which means almost no learning curve and switching does not require any code change, it still differs in two key aspects and they are

1. DiceDB is multi-threaded and follows [shared-nothing architecture](https://en.wikipedia.org/wiki/Shared-nothing_architecture).
1. DiceDB is multithreaded and follows [shared-nothing architecture](https://en.wikipedia.org/wiki/Shared-nothing_architecture).
2. DiceDB supports a new command called `QWATCH` that lets clients listen to a SQL query and get notified in real-time whenever something changes.

With this, you can build truly real-time applications like [Leaderboard](https://github.com/DiceDB/dice/tree/master/examples/leaderboard-go) with simple SQL query.
Expand Down Expand Up @@ -50,7 +50,7 @@ $ cd dice
$ go run main.go --enable-multithreading=true
```

**Note:** Only the following commands are optimised for multi-threaded execution: `PING, AUTH, SET, GET, GETSET, ABORT`
**Note:** Only the following commands are optimised for multithreaded execution: `PING, AUTH, SET, GET, GETSET, ABORT`

### Setting up DiceDB from source for development and contributions

Expand All @@ -68,7 +68,7 @@ $ cd dice
$ go run main.go
```

4. Install GoLangCI
1. Install GoLangCI

```
$ sudo su
Expand All @@ -79,14 +79,14 @@ $ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/ins

DiceDB provides a hot-reloading development environment, which allows you to instantly view your code changes in a live server. This functionality is supported by [Air](https://github.com/air-verse/air)

To Install Air on your system you have following options.
To Install Air on your system you have the following options.

1. If you're on go 1.22+
```sh
go install github.com/air-verse/air@latest
```

2. Install the Air binary
1. Install the Air binary
```sh
# binary will be installed at $(go env GOPATH)/bin/air
curl -sSfL https://raw.githubusercontent.com/air-verse/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
Expand Down Expand Up @@ -188,7 +188,7 @@ $ TEST_FUNC=TestSet make test-one
$ make test
```

> Work to add more tests in DiceDB is in progress and we will soon port the
> Work to add more tests in DiceDB is in progress, and we will soon port the
> test [Redis suite](https://github.com/redis/redis/tree/f60370ce28b946c1146dcea77c9c399d39601aaa) to this codebase to ensure full compatibility.
## Running Benchmark
Expand Down Expand Up @@ -231,7 +231,7 @@ $ npm run build

## The story

DiceDB started as a re-implementation of Redis in Golang and the idea was to - build a DB from scratch and understand the micro-nuances that come with its implementation. The database does not aim to replace Redis, instead, it will fit in and optimize itself for multi-core computations running on a single-threaded event loop.
DiceDB started as a re-implementation of Redis in Golang and the idea was to - build a DB from scratch and understand the micro-nuances that come with its implementation. The database does not aim to replace Redis, instead, it will fit in and optimize itself for multicore computations running on a single-threaded event loop.

## How to contribute

Expand Down
30 changes: 16 additions & 14 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"errors"
"log/slog"
"os"
"path/filepath"
Expand Down Expand Up @@ -40,7 +41,7 @@ var (
RequirePass = utils.EmptyStr

CustomConfigFilePath = utils.EmptyStr
ConfigFileLocation = utils.EmptyStr
FileLocation = utils.EmptyStr

InitConfigCmd = false
)
Expand Down Expand Up @@ -155,12 +156,12 @@ func init() {
}

// DiceConfig is the global configuration object for dice
var DiceConfig *Config = &defaultConfig
var DiceConfig = &defaultConfig

func SetupConfig() {
if InitConfigCmd {
ConfigFileLocation = getConfigPath()
createConfigFile(ConfigFileLocation)
FileLocation = getConfigPath()
createConfigFile(FileLocation)
return
}

Expand All @@ -177,8 +178,8 @@ func SetupConfig() {
}

// Check if -c flag is set
if ConfigFileLocation != utils.EmptyStr || isConfigFilePresent() {
setUpViperConfig(ConfigFileLocation)
if FileLocation != utils.EmptyStr || isConfigFilePresent() {
setUpViperConfig(FileLocation)
return
}

Expand Down Expand Up @@ -238,7 +239,7 @@ func isValidDirPath() bool {

// This function checks if both -o and -c flags are set or not
func areBothFlagsSet() bool {
return ConfigFileLocation != utils.EmptyStr && CustomConfigFilePath != utils.EmptyStr
return FileLocation != utils.EmptyStr && CustomConfigFilePath != utils.EmptyStr
}

func setUpViperConfig(configFilePath string) {
Expand All @@ -257,7 +258,8 @@ func setUpViperConfig(configFilePath string) {

viper.SetConfigType("toml")
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
var configFileNotFoundError viper.ConfigFileNotFoundError
if errors.As(err, &configFileNotFoundError) {
slog.Warn("config file not found. Using default configurations.")
return
}
Expand Down Expand Up @@ -292,25 +294,25 @@ func mergeFlagsWithConfig() {

// This function checks if the config file is present or not at ConfigFileLocation
func isConfigFilePresent() bool {
_, err := os.Stat(ConfigFileLocation)
_, err := os.Stat(FileLocation)
return err == nil
}

// This function returns the config file path based on the OS
func getConfigPath() string {
switch runtime.GOOS {
case "windows":
ConfigFileLocation = filepath.Join("C:", "ProgramData", "dice", DefaultConfigName)
FileLocation = filepath.Join("C:", "ProgramData", "dice", DefaultConfigName)
case "darwin", "linux":
ConfigFileLocation = filepath.Join(string(filepath.Separator), "etc", "dice", DefaultConfigName)
FileLocation = filepath.Join(string(filepath.Separator), "etc", "dice", DefaultConfigName)
default:
// Default to current directory if OS is unknown
ConfigFileLocation = filepath.Join(".", DefaultConfigName)
FileLocation = filepath.Join(".", DefaultConfigName)
}
return ConfigFileLocation
return FileLocation
}

// This function is only used for testing purposes
// ResetConfig resets the DiceConfig to default configurations. This function is only used for testing purposes
func ResetConfig() {
DiceConfig = &defaultConfig
}
4 changes: 2 additions & 2 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ $ git push origin <your issue branch>
After this, create a PullRequest in `github <https://github.com/dicedb/docs/pulls>`_. Make sure you have linked the relevant Issue in the description with "Closes #number" or "Fixes #number".
```

- Once you receive comments on github on your changes, be sure to respond to them on github and address the concerns. If any discussions happen offline for the changes in question, make sure to capture the outcome of the discussion, so others can follow along as well.
- Once you receive comments on GitHub on your changes, be sure to respond to them on GitHub and address the concerns. If any discussions happen offline for the changes in question, make sure to capture the outcome of the discussion, so others can follow along as well.

It is possible that while your change is being reviewed, other changes were made to the master branch. Be sure to pull rebase your change on the new changes thus:

```text
# commit your changes
$ git add <updated files>
$ git commit -m "Meaningful message for the udpate"
$ git commit -m "Meaningful message for the update"
# pull new changes
$ git checkout master
$ git merge upstream/master
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/blog/dicedb-0.0.2-release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ In DiceDB v0.0.2, we’ve significantly expanded the set of Redis-compatible com

Additionally, we’ve introduced several JSON-specific commands, including:

- `JSON.TYPE`: Returns the type of a JSON element (e.g., object, array, string).
- `JSON.TYPE`: Returns the type of JSON element (e.g., object, array, string).
- `JSON.CLEAR`: Clears the contents of a JSON object or array.
- `JSON.DEL`: Deletes a specific JSON element from a key.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/blog/dicedb-0.0.3-release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This release introduces two significant architectural improvements: the removal

### Lock-Free Store Design

The removal of locking structures in the store is one of the most impactful optimizations introduced in this release. By transitioning to a fully **lock-free design**, DiceDB reduces contention and overhead, especially in highly concurrent environments. This change is vital for scaling DiceDB in multi-core systems, as it enables more efficient parallelism and improves the overall throughput of data operations.
The removal of locking structures in the store is one of the most impactful optimizations introduced in this release. By transitioning to a fully **lock-free design**, DiceDB reduces contention and overhead, especially in highly concurrent environments. This change is vital for scaling DiceDB in multicore systems, as it enables more efficient parallelism and improves the overall throughput of data operations.

### Asynchronous Notifications for Key Changes

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/blog/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can always support the project by [starring the repository](https://github.c

## Community

We have a thriving community on [Discord](https://discord.gg/6r8uXWtXh7) and we meet every Thursday at 7:00 pm IST.
We have a thriving community on [Discord,](https://discord.gg/6r8uXWtXh7) and we meet every Thursday at 7:00 pm IST.
The agenda of the call is to discuss the latest developments, gather feedback, and share insights into DiceDB's roadmap. This is a great opportunity to ask questions, contribute ideas, and connect with other developers.

Stay updated with the latest news and announcements by keeping an eye on the blog and following [DiceDB](https://twitter.com/thedicedb) and [Arpit Bhayani](https://twitter.com/arpit_bhayani), and [Jyotinder Singh](https://twitter.com/Jyotinder_Singh/) on social handles.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/commands/AUTH.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ AUTH password
When the `AUTH` command is executed, DiceDB will perform the following steps:

1. `Check Authentication Status:` DiceDB will check if the server is configured to require authentication (i.e., if a password is set in the DiceDB configuration).
1. `Validate Password:` If authentication is required, DiceDB will then verify the provided password against the configured password.
1. `Return Response:`
2. `Validate Password:` If authentication is required, DiceDB will then verify the provided password against the configured password.
3. `Return Response:`
- If the password is valid, DiceDB will store the authenticated session for that client.
- If the password is invalid, an error message will be returned.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/commands/BFADD.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ When the `BFADD` command is executed, the specified item is added to the Bloom F
The `BFADD` command can raise errors in the following scenarios:

1. `Wrong number of arguments`: If the command is called with an incorrect number of arguments, a `ERR wrong number of arguments for 'BFADD' command` error will be raised.
1. `Non-string key or item`: If the key or item is not a string, a `WRONGTYPE Operation against a key holding the wrong kind of value` error will be raised.
2. `Non-string key or item`: If the key or item is not a string, a `WRONGTYPE Operation against a key holding the wrong kind of value` error will be raised.

## Example Usage

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/commands/BFEXISTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ When the `BFEXISTS` command is executed, it checks the Bloom Filter associated w
The `BFEXISTS` command can raise errors in the following scenarios:

1. `Key does not exist`: If the specified key does not exist in the database, the command will return `0` without raising an error.
1. `Wrong type of key`: If the key exists but is not associated with a Bloom Filter, a `WRONGTYPE` error will be raised.
1. `Incorrect number of arguments`: If the command is called with an incorrect number of arguments, a `ERR wrong number of arguments` error will be raised.
2. `Wrong type of key`: If the key exists but is not associated with a Bloom Filter, a `WRONGTYPE` error will be raised.
3. `Incorrect number of arguments`: If the command is called with an incorrect number of arguments, a `ERR wrong number of arguments` error will be raised.

## Example Usage

Expand Down
10 changes: 5 additions & 5 deletions docs/src/content/docs/commands/BGREWRITEAOF.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ The `BGREWRITEAOF` command does not take any parameters.
When the `BGREWRITEAOF` command is issued, DiceDB performs the following steps:
1. `Forking a Child Process`: DiceDB forks a child process to handle the AOF rewrite. This ensures that the main DiceDB server can continue to handle client requests without interruption.
1. `Creating a Temporary AOF File`: The child process creates a temporary AOF file and writes the minimal set of commands needed to reconstruct the current dataset.
1. `Swapping Files`: Once the temporary AOF file is fully written and synced to disk, the child process swaps the temporary file with the existing AOF file.
1. `Cleaning Up`: The child process exits, and the main DiceDB server continues to operate with the new, optimized AOF file.
2. `Creating a Temporary AOF File`: The child process creates a temporary AOF file and writes the minimal set of commands needed to reconstruct the current dataset.
3. `Swapping Files`: Once the temporary AOF file is fully written and synced to disk, the child process swaps the temporary file with the existing AOF file.
4. `Cleaning Up`: The child process exits, and the main DiceDB server continues to operate with the new, optimized AOF file.
## Example Usage
Expand All @@ -51,15 +51,15 @@ In this example, the `BGREWRITEAOF` command is issued, and the server responds w
"Background append only file rewriting already in progress"
```
1. `Forking Error`:
2. `Forking Error`:
- `Condition`: If DiceDB is unable to fork a new process due to system limitations or resource constraints.
- `Error Message`:
```
"ERR Can't fork"
```
1. `AOF Disabled`:
3. `AOF Disabled`:
- `Condition`: If AOF is disabled in the DiceDB configuration.
- `Error Message`:
Expand Down
12 changes: 6 additions & 6 deletions docs/src/content/docs/commands/BITCOUNT.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ The `BITCOUNT` command returns an integer representing the number of bits set to
When the `BITCOUNT` command is executed, DiceDB will:

1. Retrieve the string stored at the specified key.
1. If the `start` and `end` parameters are provided, DiceDB will consider only the specified range of bytes within the string.
1. Count the number of bits set to 1 within the specified range or the entire string if no range is specified.
1. Return the count as an integer.
2. If the `start` and `end` parameters are provided, DiceDB will consider only the specified range of bytes within the string.
3. Count the number of bits set to 1 within the specified range or the entire string if no range is specified.
4. Return the count as an integer.

## Example Usage

Expand Down Expand Up @@ -76,7 +76,7 @@ In this example, the command counts the bits set to 1 in the bytes from position
0
```

1. `Wrong Type of Key`: If the key exists but does not hold a string value, DiceDB will return an error.
2. `Wrong Type of Key`: If the key exists but does not hold a string value, DiceDB will return an error.

```plaintext
LPUSH mylist "element"
Expand All @@ -89,7 +89,7 @@ In this example, the command counts the bits set to 1 in the bytes from position
(error) WRONGTYPE Operation against a key holding the wrong kind of value
```

1. `Invalid Range`: If the `start` or `end` parameters are not integers, DiceDB will return an error.
3. `Invalid Range`: If the `start` or `end` parameters are not integers, DiceDB will return an error.

```plaintext
SET mykey "foobar"
Expand All @@ -102,7 +102,7 @@ In this example, the command counts the bits set to 1 in the bytes from position
(error) ERR value is not an integer or out of range
```

1. `Out of Range Indices`: If the `start` or `end` parameters are out of the range of the string length, DiceDB will handle it gracefully by considering the valid range within the string.
4. `Out of Range Indices`: If the `start` or `end` parameters are out of the range of the string length, DiceDB will handle it gracefully by considering the valid range within the string.

```plaintext
SET mykey "foobar"
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/commands/BITOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ The `BITOP` command can raise errors in the following cases:

- `Error Message`: `ERR wrong number of arguments for 'bitop' command`

1. `Invalid operation`: If the specified operation is not one of `AND`, `OR`, `XOR`, or `NOT`, DiceDB will return an error.
2. `Invalid operation`: If the specified operation is not one of `AND`, `OR`, `XOR`, or `NOT`, DiceDB will return an error.

- `Error Message`: `ERR syntax error`

1. `Invalid number of keys for NOT operation`: If more than one key is provided for the `NOT` operation, DiceDB will return an error.
3. `Invalid number of keys for NOT operation`: If more than one key is provided for the `NOT` operation, DiceDB will return an error.

- `Error Message`: `ERR BITOP NOT must be called with a single source key`

1. `Non-string keys`: If any of the provided keys are not strings, DiceDB will return an error.
4. `Non-string keys`: If any of the provided keys are not strings, DiceDB will return an error.

- `Error Message`: `WRONGTYPE Operation against a key holding the wrong kind of value`

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/commands/BITPOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ The `BITPOS` command can raise errors in the following cases:

- `Error Message`: `WRONGTYPE Operation against a key holding the wrong kind of value`

1. `Invalid Bit Value`: If the bit value is not 0 or 1, an error is raised.
2. `Invalid Bit Value`: If the bit value is not 0 or 1, an error is raised.

- `Error Message`: `ERR bit is not an integer or out of range`

1. `Invalid Range`: If the `start` or `end` parameters are not valid integers, an error is raised.
3. `Invalid Range`: If the `start` or `end` parameters are not valid integers, an error is raised.

- `Error Message`: `ERR value is not an integer or out of range`

Expand Down
Loading

0 comments on commit b5864c6

Please sign in to comment.