giriraj-singh-couchbase opened a new pull request, #3138:
URL: https://github.com/apache/brpc/pull/3138
This pull request introduces Couchbase Binary Protocol support to bRPC,
enabling communication with Couchbase Server and Capella deployments. It adds a
new protocol handler, request/response builders, comprehensive example clients,
performance benchmarking tools, and detailed documentation. The changes are
grouped below by theme:
## Couchbase Binary Protocol Integration
**Protocol Layer** (`src/brpc/policy/`):
- Added `couchbase_protocol.h` and `couchbase_protocol.cpp` implementing the
complete binary protocol framing, parsing, with support for all standard
Couchbase commands (GET, SET, ADD, REPLACE, DELETE, etc.)
**High-Level API** (`src/brpc/`):
- Implemented `CouchbaseOperations` class in `src/brpc/couchbase.h` and
`src/brpc/couchbase.cpp` (~3,500 lines), providing simplified APIs for:
- **Authentication**: `authenticate()` and `authenticateSSL()` for both
non-SSL and SSL connections (required for Couchbase Capella)
- **Bucket management**: `selectBucket()` for bucket selection
- **CRUD operations**: `get()`, `upsert()`, `add()`, `replace()`,
`append()`, `prepend()`, `delete_()` with `Result` struct for clean error
handling
- **Pipeline batching**: `beginPipeline()`, `pipelineRequest()`,
`executePipeline()`, `clearPipeline()` for batching multiple operations in a
single network call.
- Implemented `CouchbaseRequest` and `CouchbaseResponse` classes (inherit
from `NonreflectableMessage`) providing low-level request construction and
response parsing
- Implemented `CouchbaseManifestManager` singleton for thread-safe
collection manifest management with automatic caching and refresh
## Example Clients
**Basic Client** (`example/couchbase_c++/couchbase_client.cpp` - 462 lines):
- Demonstrates authentication (both SSL and non-SSL), bucket selection,
basic CRUD operations, collection-scoped operations, and error handling patterns
**Multithreaded Client**
(`example/couchbase_c++/multithreaded_couchbase_client.cpp` - 375 lines):
- Demonstrates two threading patterns:
- Multiple threads sharing a single `CouchbaseOperations` instance (same
bucket, shared connection)
- Multiple threads with dedicated `CouchbaseOperations` instances
(different buckets, isolated connections)
## Documentation
**Comprehensive Guide** (`docs/en/couchbase_example.md`):
## Key Features
- **SSL/TLS Support**: Built-in encryption for Couchbase Capella and secure
on-premises deployments
- **Collection Management**: Native Couchbase 7.0+ collections with
automatic ID resolution, manifest caching, and scope support
- **Pipeline Batching**: Batch multiple operations.
- **Thread Safety**: Reader-writer locks for manifest caching, support for
shared or isolated connection patterns
- **Connection Pooling**: Intelligent connection sharing per server+bucket
combination
- **Error Handling**: Clean `Result` struct with success flag, error
messages, status codes, and values
## What problem does this PR solve?
Added native support to interact with Couchbase servers using the binary
protocol, enabling efficient CRUD operations, SSL/TLS encrypted connections and
collection management.
Side effects:
- Performance effects: None
- Breaking backward compatibility: NO
---
### Check List:
- Please make sure your changes are compilable.
- When providing us with a new feature, it is best to add related tests.
- Please follow [Contributor Covenant Code of
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]