Skip to content

Commit

Permalink
Renaming pybushka to glide, renaming glide-core lib name to glide-core
Browse files Browse the repository at this point in the history
  • Loading branch information
barshaul committed Dec 19, 2023
1 parent 9d446fd commit 54b433b
Show file tree
Hide file tree
Showing 50 changed files with 126 additions and 124 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-python-wrapper/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ runs:
run: |
export PATH="$PATH:$HOME/.local/bin"
MYPY_PROTOC_PATH=`which protoc-gen-mypy`
protoc --plugin=protoc-gen-mypy=${MYPY_PROTOC_PATH} -Iprotobuf=./glide-core/src/protobuf/ --python_out=./python/python/pybushka --mypy_out=./python/python/pybushka ./glide-core/src/protobuf/*.proto
protoc --plugin=protoc-gen-mypy=${MYPY_PROTOC_PATH} -Iprotobuf=./glide-core/src/protobuf/ --python_out=./python/python/glide --mypy_out=./python/python/glide ./glide-core/src/protobuf/*.proto
- name: Build Pybushka
- name: Build GLIDE
shell: bash
working-directory: ./python
if: ${{ inputs.publish != 'true' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ jobs:
working-directory: ./python
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --extend-ignore=E230 --exclude=python/pybushka/protobuf,.env/*
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --extend-ignore=E230 --exclude=python/glide/protobuf,.env/*
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics --extend-ignore=E230 --exclude=python/pybushka/protobuf,.env/*
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics --extend-ignore=E230 --exclude=python/glide/protobuf,.env/*
- name: Lint with black
working-directory: ./python
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/install_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ javaTlsFlag="-tls"

function runPythonBenchmark(){
# generate protobuf files
protoc -Iprotobuf=${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/ --python_out=${PYTHON_FOLDER}/python/pybushka ${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/*.proto
protoc -Iprotobuf=${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/ --python_out=${PYTHON_FOLDER}/python/glide ${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/*.proto
cd ${PYTHON_FOLDER}
$pythonCommand -m venv .env
source .env/bin/activate
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/python/python_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import numpy as np
import redis.asyncio as redispy # type: ignore
from pybushka import (
from glide import (
BaseClientConfiguration,
Logger,
LogLevel,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = ["Amazon Web Services"]

[dependencies]
tokio = { version = "1", features = ["macros", "time", "rt-multi-thread"] }
glide = { path = "../../glide-core" }
glide-core = { path = "../../glide-core" }
logger_core = {path = "../../logger_core"}
redis = { path = "../../submodules/redis-rs/redis", features = ["aio"] }
futures = "0.3.28"
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::Parser;
use futures::{self, future::join_all, stream, StreamExt};
use glide::{
use glide_core::{
client::Client,
connection_request::{ConnectionRequest, NodeAddress, TlsMode},
};
Expand Down Expand Up @@ -218,7 +218,7 @@ async fn get_connection(args: &Args) -> Client {
connection_request.request_timeout = 2000;
connection_request.cluster_mode_enabled = args.cluster_mode_enabled;

glide::client::Client::new(connection_request)
glide_core::client::Client::new(connection_request)
.await
.unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion csharp/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]

[dependencies]
redis = { path = "../../submodules/redis-rs/redis", features = ["aio", "tokio-comp","tokio-native-tls-comp"] }
glide = { path = "../../glide-core" }
glide-core = { path = "../../glide-core" }
tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] }
num-derive = "0.4.0"
num-traits = "0.2.15"
Expand Down
4 changes: 2 additions & 2 deletions csharp/lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use glide::connection_request;
use glide::{client::Client as GlideClient, connection_request::NodeAddress};
use glide_core::connection_request;
use glide_core::{client::Client as GlideClient, connection_request::NodeAddress};
use redis::{Cmd, FromRedisValue, RedisResult};
use std::{
ffi::{c_void, CStr, CString},
Expand Down
2 changes: 1 addition & 1 deletion examples/python/build_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export GLIDE_HOME_FOLDER="${PYTHON_EXAMPLE_FOLDER}/../.."
export PYTHON_FOLDER="${GLIDE_HOME_FOLDER}/python"

# Generate protobuf files
protoc -Iprotobuf=${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/ --python_out=${PYTHON_FOLDER}/python/pybushka ${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/*.proto
protoc -Iprotobuf=${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/ --python_out=${PYTHON_FOLDER}/python/glide ${GLIDE_HOME_FOLDER}/glide-core/src/protobuf/*.proto
cd ${PYTHON_EXAMPLE_FOLDER}
# Create a virtual environment
python3 -m pip install --user virtualenv
Expand Down
2 changes: 1 addition & 1 deletion examples/python/client_example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
from typing import Optional, Union

from pybushka import (
from glide import (
AllNodes,
BaseClientConfiguration,
Logger,
Expand Down
2 changes: 1 addition & 1 deletion glide-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "glide"
name = "glide-core"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion glide-core/benches/connections_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use criterion::{criterion_group, criterion_main, Criterion};
use futures::future::join_all;
use glide::client::GlideClient;
use glide_core::client::GlideClient;
use redis::{
cluster::ClusterClientBuilder, AsyncCommands, ConnectionAddr, ConnectionInfo,
RedisConnectionInfo, RedisResult, Value,
Expand Down
2 changes: 1 addition & 1 deletion glide-core/benches/memory_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use glide::{
use glide_core::{
client::Client,
connection_request::{ConnectionRequest, NodeAddress, TlsMode},
};
Expand Down
2 changes: 1 addition & 1 deletion glide-core/benches/rotating_buffer_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::io::Write;

use bytes::BufMut;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use glide::{
use glide_core::{
redis_request::{command, redis_request},
redis_request::{Command, RedisRequest, RequestType},
rotating_buffer::RotatingBuffer,
Expand Down
2 changes: 1 addition & 1 deletion glide-core/tests/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod utilities;
#[cfg(test)]
mod shared_client_tests {
use super::*;
use glide::client::Client;
use glide_core::client::Client;
use redis::RedisConnectionInfo;
use redis::Value;
use rstest::rstest;
Expand Down
2 changes: 1 addition & 1 deletion glide-core/tests/test_cluster_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod cluster_client_tests {
use std::collections::HashMap;

use super::*;
use glide::connection_request::ReadFrom;
use glide_core::connection_request::ReadFrom;
use redis::cluster_routing::{
MultipleNodeRoutingInfo, Route, RoutingInfo, SingleNodeRoutingInfo, SlotAddr,
};
Expand Down
8 changes: 4 additions & 4 deletions glide-core/tests/test_socket_listener.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use glide::*;
use glide_core::*;
use rsevents::{Awaitable, EventState, ManualResetEvent};
use std::io::prelude::*;
use std::sync::{Arc, Mutex};
Expand All @@ -17,9 +17,9 @@ mod socket_listener {
use crate::utilities::mocks::{Mock, ServerMock};

use super::*;
use glide::redis_request::command::{Args, ArgsArray};
use glide::redis_request::{Command, Transaction};
use glide::response::{response, ConstantResponse, Response};
use glide_core::redis_request::command::{Args, ArgsArray};
use glide_core::redis_request::{Command, Transaction};
use glide_core::response::{response, ConstantResponse, Response};
use protobuf::{EnumOrUnknown, Message};
use redis::{Cmd, ConnectionAddr, Value};
use redis_request::{RedisRequest, RequestType};
Expand Down
8 changes: 5 additions & 3 deletions glide-core/tests/test_standalone_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod standalone_client_tests {
use crate::utilities::mocks::{Mock, ServerMock};

use super::*;
use glide::{client::StandaloneClient, connection_request::ReadFrom};
use glide_core::{client::StandaloneClient, connection_request::ReadFrom};
use redis::{FromRedisValue, Value};
use rstest::rstest;
use utilities::*;
Expand Down Expand Up @@ -75,8 +75,10 @@ mod standalone_client_tests {
});

let _new_server = receiver.await;
tokio::time::sleep(glide::client::HEARTBEAT_SLEEP_DURATION + Duration::from_secs(1))
.await;
tokio::time::sleep(
glide_core::client::HEARTBEAT_SLEEP_DURATION + Duration::from_secs(1),
)
.await;

let mut get_command = redis::Cmd::new();
get_command
Expand Down
4 changes: 2 additions & 2 deletions glide-core/tests/utilities/cluster.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use super::{create_connection_request, ClusterMode, TestConfiguration};
use futures::future::{join_all, BoxFuture};
use futures::FutureExt;
use glide::client::Client;
use glide::connection_request::NodeAddress;
use glide_core::client::Client;
use glide_core::connection_request::NodeAddress;
use once_cell::sync::Lazy;
use redis::{ConnectionAddr, RedisConnectionInfo};
use std::process::Command;
Expand Down
2 changes: 1 addition & 1 deletion glide-core/tests/utilities/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(dead_code)]
use futures::Future;
use glide::{
use glide_core::{
client::{Client, StandaloneClient},
connection_request::{self, AuthenticationInfo, NodeAddress},
};
Expand Down
2 changes: 1 addition & 1 deletion java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]

[dependencies]
redis = { path = "../submodules/redis-rs/redis", features = ["aio", "tokio-comp", "connection-manager", "tokio-rustls-comp"] }
glide = { path = "../glide-core" }
glide-core = { path = "../glide-core" }
tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] }
logger_core = {path = "../logger_core"}
tracing-subscriber = "0.3.16"
Expand Down
2 changes: 1 addition & 1 deletion java/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use glide::start_socket_listener;
use glide_core::start_socket_listener;

use jni::objects::{JClass, JObject, JThrowable};
use jni::sys::jlong;
Expand Down
2 changes: 1 addition & 1 deletion node/rust-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]

[dependencies]
redis = { path = "../../submodules/redis-rs/redis", features = ["aio", "tokio-comp", "tokio-rustls-comp"] }
glide = { path = "../../glide-core" }
glide-core = { path = "../../glide-core" }
tokio = { version = "1", features = ["rt", "macros", "rt-multi-thread", "time"] }
napi = {version = "2.14", features = ["napi4", "napi6"] }
napi-derive = "2.14"
Expand Down
6 changes: 3 additions & 3 deletions node/rust-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use byteorder::{LittleEndian, WriteBytesExt};
use glide::start_socket_listener;
use glide::MAX_REQUEST_ARGS_LENGTH;
use glide_core::start_socket_listener;
use glide_core::MAX_REQUEST_ARGS_LENGTH;
#[cfg(feature = "testing_utilities")]
use napi::bindgen_prelude::BigInt;
use napi::{Env, Error, JsObject, JsUnknown, Result, Status};
Expand All @@ -26,7 +26,7 @@ pub const MAX_REQUEST_ARGS_LEN: u32 = MAX_REQUEST_ARGS_LENGTH as u32;

#[napi]
pub const DEFAULT_TIMEOUT_IN_MILLISECONDS: u32 =
glide::client::DEFAULT_RESPONSE_TIMEOUT.as_millis() as u32;
glide_core::client::DEFAULT_RESPONSE_TIMEOUT.as_millis() as u32;

#[napi]
struct AsyncClient {
Expand Down
4 changes: 2 additions & 2 deletions python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ authors = ["Amazon Web Services"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "glide_for_redis"
name = "glide"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "^0.19", features = ["extension-module"] }
pyo3-asyncio = { version = "^0.19", features = ["tokio-runtime"] }
redis = { path = "../submodules/redis-rs/redis", features = ["aio", "tokio-comp", "connection-manager","tokio-rustls-comp"] }
glide = { path = "../glide-core" }
glide-core = { path = "../glide-core" }
tokio = { version = "^1", features = ["rt", "macros", "rt-multi-thread", "time"] }
logger_core = {path = "../logger_core"}
tracing-subscriber = "0.3.16"
Expand Down
14 changes: 7 additions & 7 deletions python/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ git submodule update
```
### Generate protobuf files
During the initial build, Python protobuf files were created in `python/python/pybushka/protobuf`. If modifications are made to the protobuf definition files (.proto files located in `glide-core/src/protofuf`), it becomes necessary to regenerate the Python protobuf files. To do so, run:
During the initial build, Python protobuf files were created in `python/python/glide/protobuf`. If modifications are made to the protobuf definition files (.proto files located in `glide-core/src/protofuf`), it becomes necessary to regenerate the Python protobuf files. To do so, run:
```bash
GLIDE_ROOT_FOLDER_PATH=. # e.g. /home/ubuntu/glide-for-redis
protoc -Iprotobuf=${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/ --python_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/pybushka ${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/*.proto
protoc -Iprotobuf=${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/ --python_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/glide ${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/*.proto
```
#### Protobuf interface files
Expand All @@ -56,7 +56,7 @@ To generate the protobuf files with Python Interface files (pyi) for type-checki
```bash
GLIDE_ROOT_FOLDER_PATH=. # e.g. /home/ubuntu/glide-for-redis
MYPY_PROTOC_PATH=`which protoc-gen-mypy`
protoc --plugin=protoc-gen-mypy=${MYPY_PROTOC_PATH} -Iprotobuf=${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/ --python_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/pybushka --mypy_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/pybushka ${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/*.proto
protoc --plugin=protoc-gen-mypy=${MYPY_PROTOC_PATH} -Iprotobuf=${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/ --python_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/glide --mypy_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/glide ${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/*.proto
```
### Linters
Expand All @@ -80,10 +80,10 @@ Run from the main `/python` folder
> Note: make sure to [generate protobuf with interface files]("#protobuf-interface-files") before running mypy linter
```bash
pip install -r dev_requirements.txt
isort . --profile black --skip-glob python/pybushka/protobuf
black . --exclude python/pybushka/protobuf
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=python/pybushka/protobuf,.env/* --extend-ignore=E230
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics --exclude=python/pybushka/protobuf,.env/* --extend-ignore=E230
isort . --profile black --skip-glob python/glide/protobuf
black . --exclude python/glide/protobuf
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=python/glide/protobuf,.env/* --extend-ignore=E230
flake8 . --count --exit-zero --max-complexity=12 --max-line-length=127 --statistics --exclude=python/glide/protobuf,.env/* --extend-ignore=E230
# run type check
mypy .
```
Expand Down
8 changes: 4 additions & 4 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To install GLIDE for Redis using `pip`, follow these steps:
3. After installation, confirm the client is accessible by running:
```bash
$ python3
>>> import glide-for-redis
>>> import glide
```

### Build from source
Expand Down Expand Up @@ -80,7 +80,7 @@ Before starting this step, make sure you've installed all software requirments.
3. Generate protobuf files:
```bash
GLIDE_ROOT_FOLDER_PATH=.
protoc -Iprotobuf=${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/ --python_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/pybushka ${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/*.proto
protoc -Iprotobuf=${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/ --python_out=${GLIDE_ROOT_FOLDER_PATH}/python/python/glide ${GLIDE_ROOT_FOLDER_PATH}/glide-core/src/protobuf/*.proto
```
4. Create a virtual environment:
```bash
Expand Down Expand Up @@ -113,7 +113,7 @@ Before starting this step, make sure you've installed all software requirments.
#### Cluster Redis:
```python:
>>> from pybushka import (
>>> from glide import (
... NodeAddress,
... ClusterClientConfiguration,
... RedisClusterClient,
Expand All @@ -132,7 +132,7 @@ Before starting this step, make sure you've installed all software requirments.
#### Standalone Redis:
```python:
>>> from pybushka import (
>>> from glide import (
... NodeAddress,
... RedisClientConfiguration,
... RedisClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
from pybushka.async_commands.core import (
from glide.async_commands.core import (
ConditionalSet,
ExpireOptions,
ExpirySet,
ExpiryType,
)
from pybushka.async_commands.transaction import ClusterTransaction, Transaction
from pybushka.config import (
from glide.async_commands.transaction import ClusterTransaction, Transaction
from glide.config import (
BaseClientConfiguration,
ClusterClientConfiguration,
NodeAddress,
ReadFrom,
RedisClientConfiguration,
RedisCredentials,
)
from pybushka.constants import OK
from pybushka.exceptions import (
from glide.constants import OK
from glide.exceptions import (
ClosingError,
ExecAbortError,
RedisError,
RequestError,
TimeoutError,
)
from pybushka.logger import Level as LogLevel
from pybushka.logger import Logger
from pybushka.redis_client import RedisClient, RedisClusterClient
from pybushka.routes import (
from glide.logger import Level as LogLevel
from glide.logger import Logger
from glide.redis_client import RedisClient, RedisClusterClient
from glide.routes import (
AllNodes,
AllPrimaries,
RandomNode,
Expand Down
Loading

0 comments on commit 54b433b

Please sign in to comment.