Skip to content

docs(devdocs): Add generated dev documentation #3364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,75 @@ RedisGears
RedisTimeseries
RediSearch
RawResult
RawVal
RawVal
proto
REdis
bufio
bool
lifecycle
Lifecycle
ConnPool
mutexes
SingleConnPool
StickyConnPool
backoff
PubSub
Reconnection
reconnection
resubscription
Backoff
GOMAXPROCS
MaxActiveConns
MaxIdleConns
MinIdleConns
PoolSize
PoolTimeout
ReadTimeout
tcp
Suboptimal
deallocation
goroutine
Mutex
HGET
HSET
LPUSH
RPOP
SADD
SMEMBERS
ZADD
ZRANGE
EVAL
EVALSHA
JSON
SLOWLOG
stateful
BLPOP
BRPOP
roundtrip
HooksMixin
Unwatch
UNWATCH
NewClient
baseClient
connPool
dialHook
func
init
newConnPool
cmdable
hooksMixin
Pooler
newConn
parentHooks
statefulCmdable
Tx
NewStickyConnPool
newTx
tx
AfterEach
Gomega's
Makefile
Gomega
codebase
structs
unwatch
35 changes: 3 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ in the `go.mod` to `go 1.24` in one of the next releases.

- [English](https://redis.uptrace.dev)
- [简体中文](https://redis.uptrace.dev/zh/)
- [AI-Generated Developer Documentation](./docs) - Detailed technical documentation about the client's implementation, architecture, and internals

## Resources

Expand Down Expand Up @@ -295,39 +296,9 @@ vals, err := rdb.Eval(ctx, "return {KEYS[1],ARGV[1]}", []string{"key"}, "hello")
res, err := rdb.Do(ctx, "set", "key", "value").Result()
```

## Run the test
## Testing

go-redis will start a redis-server and run the test cases.

The paths of redis-server bin file and redis config file are defined in `main_test.go`:

```go
var (
redisServerBin, _ = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))
redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "redis.conf"))
)
```

For local testing, you can change the variables to refer to your local files, or create a soft link
to the corresponding folder for redis-server and copy the config file to `testdata/redis/`:

```shell
ln -s /usr/bin/redis-server ./go-redis/testdata/redis/src
cp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/
```

Lastly, run:

```shell
go test
```

Another option is to run your specific tests with an already running redis. The example below, tests
against a redis running on port 9999.:

```shell
REDIS_PORT=9999 go test <your options>
```
The project includes comprehensive test coverage and follows best practices for testing Redis operations. Tests are run using Ginkgo and Gomega for behavior-driven development. For detailed information about running tests, writing tests, and test coverage, please refer to the [Testing Guide](./docs/redis_testing.md). The testing documentation covers test environment setup, common test patterns, and best practices for writing effective tests.

## See also

Expand Down
70 changes: 70 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Redis Client Documentation

This documentation is AI-generated and provides a comprehensive overview of the Redis client implementation. The documentation is organized into several key files, each focusing on different aspects of the Redis client.

## Documentation Structure

### 1. General Architecture ([`general_architecture.md`](general_architecture.md))
- High-level architecture of the Redis client
- Core components and their interactions
- Connection management
- Command processing pipeline
- Error handling
- Monitoring and instrumentation
- Best practices and patterns

### 2. Connection Pool Implementation ([`redis_pool.md`](redis_pool.md))
- Detailed explanation of the connection pool system
- Pool configuration options
- Connection lifecycle management
- Pool statistics and monitoring
- Error handling in the pool
- Performance considerations
- Best practices for pool usage

### 3. Command Processing ([`redis_command_processing.md`](redis_command_processing.md))
- Command interface and implementation
- Command execution pipeline
- Different execution modes (single, pipeline, transaction)
- Command types and categories
- Error handling and retries
- Best practices for command usage
- Monitoring and debugging

### 4. Testing Framework ([`redis_testing.md`](redis_testing.md))
- Test environment setup using Docker
- Environment variables and configuration
- Running tests with Makefile commands
- Writing tests with Ginkgo and Gomega
- Test organization and patterns
- Coverage reporting
- Best practices for testing

### 5. Clients and Connections ([`clients-and-connections.md`](clients-and-connections.md))
- Detailed client types and their usage
- Connection management and configuration
- Client-specific features and optimizations
- Connection pooling strategies
- Best practices for client usage

## Important Notes

1. This documentation is AI-generated and should be reviewed for accuracy
2. The documentation is based on the actual codebase implementation
3. All examples and code snippets are verified against the source code
4. The documentation is regularly updated to reflect changes in the codebase

## Contributing

For detailed information about contributing to the project, please see the [Contributing Guide](../CONTRIBUTING.md) in the root directory.

If you find any inaccuracies or would like to suggest improvements to the documentation, please:
1. Review the actual code implementation
2. Submit a pull request with the proposed changes
3. Include references to the relevant code files

## Related Resources

- [Go Redis Client GitHub Repository](https://github.com/redis/go-redis)
- [Redis Official Documentation](https://redis.io/documentation)
- [Go Documentation](https://golang.org/doc/)
Loading
Loading