Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jiisanda/pandas-pouch

🐼🐼A Distributed Caching Service in Rust πŸ¦€πŸ¦€
https://github.com/jiisanda/pandas-pouch

cache distributed distributed-systems grpc pandas-pouch postgresql rust tokio tonic

Last synced: about 7 hours ago
JSON representation

🐼🐼A Distributed Caching Service in Rust πŸ¦€πŸ¦€

Awesome Lists containing this project

README

        

![banner](static/banner.png)

# 🐼 pandas-pouch 🐼

A Distributed Caching Service with Rust πŸ¦€πŸ¦€.

## Progress

- βœ… Basic Cache
- βœ… LRU Cache
- βœ… Database Setup
- βœ… API Integration
- βœ… Docker Setup
- 🟑 Consistent Hashing
- 🟑 Distributed Cache - Dedicated cache cluster

## Pre-requisites

- [Rust](https://www.rust-lang.org/tools/install)
- [Docker](https://docs.docker.com/get-docker/)
- gRPC
- [grpcurl](https://github.com/fullstorydev/grpcurl)

## How can pandas-pouch be used with current features?

### Configuration

Create a `config` directory. And add `default.toml` file with the following configuration.
Sample default.toml file is provided in the `config` directory [config/sample_default.toml](config/sample_default.toml). Also add a `.env` file with the
configuration in [config/.env.sample](config/.env.sample) file.

### Running the Service

1. Clone the repository and navigate to the project directory.

```bash
git clone https://github.com/jiisanda/pandas-pouch.git
cd pandas-pouch
```

2. Start the service using `docker-compose`.

```bash
docker-compose build
docker-compose up
```

### Interacting with the Service

You can use `grpcurl` to interact with the service. Install `grpcurl` using the installation guide in the [grpcurl repository](https://github.com/fullstorydev/grpcurl)

Run the following command to interact with the service.

1. Put operation
```bash
grpcurl -plaintext -proto proto/pandas_pouch.proto -d '{"key": "key2", "value": "value2"}' 0.0.0.0:50051 pandas_pouch.PandasPouchCacheService/Put
```

2. Get Operation
```bash
grpcurl -plaintext -proto proto/pandas_pouch.proto -d '{"key": "key2"}' 0.0.0.0:50051 pandas_pouch.PandasPouchCacheService/Get
```

3. PrintAll Operation
```bash
grpcurl -plaintext -proto proto/pandas_pouch.proto 0.0.0.0:50051 pandas_pouch.PandasPouchCacheService/PrintAll
```

### pandas-pouch as a crate

To use pandas-pouch as a crate, add the following to your `Cargo.toml` file.

```toml
[dependencies]
pandas-pouch = { git = "https://github.com/jiisanda/pandas-pouch.git" }
```

Using it in code:
```rust
use pandas_pouch::Client;

#[tokio::main]
async fn main() -> Result<(), Box> {
let mut client = Client::new("http://localhost:50051").await?;

// put a value
client.put("key1".to_string(), "value1".to_string()).await?;

// get a value
let value = client.get("key1".to_string()).await?;
println!("Value: {:?}", value);

Ok(())
}
```

## License

This project is licensed under the [MIT License](LICENSE).