Skip to content

Commit

Permalink
5.0.0 (#31)
Browse files Browse the repository at this point in the history
* feat: move `decode-mut` to `bytes`
* feat: range-based frame types
* feat: separate `Owned` and `Bytes` frame variants
* feat: codec interfaces
* feat: `FromResp2` and `FromResp3` type conversion traits
* feat: fuzzing
* feat: criterion benchmark scaffolding
* fix: CI
  • Loading branch information
aembke committed Mar 31, 2024
1 parent 747cc5d commit a539798
Show file tree
Hide file tree
Showing 58 changed files with 12,446 additions and 7,595 deletions.
79 changes: 52 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,87 @@
version: 2

jobs:
tests-default:
build-docs:
docker:
- image: cimg/rust:1.57.0
- image: cimg/rust:1.77.0
steps:
- checkout
- run:
name: Clear the cargo git cache
command: rm -rf ~/.cargo/git/* && rm -rf ~/.cargo/registry/cache/*
name: Install nightly
command: rustup install nightly
- run:
name: Run tests with default features
command: cargo clean && eval `ssh-agent` && ssh-add ~/.ssh/id_rsa && cargo test --release
tests-indexmap:
docker:
- image: cimg/rust:1.57.0
name: Build documentation
command: tests/doc.sh
tests-codec:
machine:
image: ubuntu-2204:2022.10.2
docker_layer_caching: true
resource_class: medium
environment:
REDIS_VERSION: 7.2.4
steps:
- checkout
- run:
name: Clear the cargo git cache
command: rm -rf ~/.cargo/git/* && rm -rf ~/.cargo/registry/cache/*
name: Run tests with codec features
command: source tests/environ && tests/codec/runner.sh
tests-bytes:
docker:
- image: cimg/rust:1.77.0
steps:
- checkout
- run:
name: Run tests with indexmap features
command: cargo clean && eval `ssh-agent` && ssh-add ~/.ssh/id_rsa && cargo test --release --features index-map
tests-decode-mut:
name: Run tests with bytes features
command: cargo test --release --features "resp2 resp3 bytes codec convert" --lib
tests-no-bytes:
docker:
- image: cimg/rust:1.57.0
- image: cimg/rust:1.77.0
steps:
- checkout
- run:
name: Clear the cargo git cache
command: rm -rf ~/.cargo/git/* && rm -rf ~/.cargo/registry/cache/*
name: Run tests without bytes or bytes_utils
command: cargo test --release --features "resp2 resp3 convert" --lib
tests-indexmap:
docker:
- image: cimg/rust:1.77.0
steps:
- checkout
- run:
name: Run tests with indexmap features
command: cargo clean && eval `ssh-agent` && ssh-add ~/.ssh/id_rsa && cargo test --release --features decode-mut
build_no_std:
command: cargo test --release --features "index-map resp2 resp3 convert" --lib
clippy-lint:
docker:
- image: cimg/rust:1.77.0
environment:
CARGO_NET_GIT_FETCH_WITH_CLI: true
steps:
- checkout
- run:
name: Clippy
command: cargo clippy --features "bytes convert codec std resp2 resp3" --lib --tests --benches -- -Dwarnings
build-no-std:
docker:
- image: cimg/rust:1.57.0
- image: cimg/rust:1.77.0
steps:
- checkout
- run:
name: Switch to nightly for using unstable feature avoid-dev-deps
command: rustup default nightly
- run:
name: Clear the cargo git cache
command: rm -rf ~/.cargo/git/* && rm -rf ~/.cargo/registry/cache/*
- run:
name: Add cross compile target
command: rustup target add thumbv7m-none-eabi
- run:
name: Verifies successful build for no_std target
command: cargo clean && eval `ssh-agent` && ssh-add ~/.ssh/id_rsa && cargo build -Z avoid-dev-deps --release --no-default-features --features libm,hashbrown,alloc --target=thumbv7m-none-eabi
command: cargo clean && cargo build -Z avoid-dev-deps --release --no-default-features --features resp2,resp3,convert,libm,hashbrown,alloc --target=thumbv7m-none-eabi


workflows:
version: 2
build:
jobs:
- tests-default
- tests-bytes
- tests-no-bytes
- tests-codec
- tests-indexmap
- tests-decode-mut
- build_no_std
- build-no-std
- clippy-lint
- build-docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/target
**/*.rs.bk
Cargo.lock
process.yml
85 changes: 51 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,60 +1,77 @@
[package]
authors = ["Alec Embke <[email protected]>"]
description = "Structs and functions to implement the Redis protocol."
description = "An implementation of the RESP2 and RESP3 protocols."
homepage = "https://github.com/aembke/redis-protocol.rs"
keywords = ["redis", "protocol", "nom", "resp", "no_std"]
keywords = ["redis", "protocol", "RESP", "no_std"]
license = "MIT"
name = "redis-protocol"
readme = "README.md"
repository = "https://github.com/aembke/redis-protocol.rs"
version = "4.1.0"
edition = "2018"
version = "5.0.0"
edition = "2021"
exclude = ["fuzz", ".circleci", "benches"]

[badges.maintenance]
status = "actively-developed"

[badges.travis-ci]
branch = "main"
repository = "aembke/redis-protocol.rs"
[package.metadata.docs.rs]
features = [
"bytes",
"std",
"codec",
"convert",
"resp2",
"resp3"
]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
bytes = { version = "1.1", default-features = false }
bytes-utils = { version = "0.1.2", default-features = false }
cookie-factory = { version = "0.3", default-features = false }
crc16 = "0.4"
indexmap = { version = "1.6", optional = true }
bytes = { version = "1.1", default-features = false, optional = true }
bytes-utils = { version = "0.1", default-features = false, optional = true }
cookie-factory = { version = "=0.3.2", default-features = false }
crc16 = { version = "0.4" }
indexmap = { version = "2.2", optional = true }
log = "0.4"
nom = { version = "7.1", default-features = false }
libm = { version = "0.2.2", optional = true }
hashbrown = { version = "0.13.2", optional = true }
libm = { version = "0.2", optional = true }
hashbrown = { version = "0.14", optional = true }
tokio-util = { version = "0.7", features = ["codec"], optional = true }

[dev-dependencies]
rand = "0.5"
tokio-util = { version = "0.6", features = ["codec"] }
tokio = { version = "1.12", features = ["full"] }
itertools = "0.10"
pretty_env_logger = "0.4"
rand = "0.8"
tokio = { version = "1.36", features = ["full"] }
pretty_env_logger = "0.5"
futures = "0.3"
itertools = "0.12"
criterion = { version = "0.4", features = ["html_reports"] }

[features]
default = ["std"]
default = ["std", "resp2", "resp3"]
resp2 = []
resp3 = []
index-map = ["indexmap"]
bytes = ["dep:bytes", "bytes-utils"]
decode-logs = []
decode-mut = []
alloc = ["nom/alloc"]
std = ["bytes/default", "bytes-utils/std", "cookie-factory/default", "nom/default"]
std = ["cookie-factory/default", "nom/default"]
codec = ["tokio-util", "bytes", "resp2", "resp3"]
convert = []

[lib]
doc = true
doctest = true
name = "redis_protocol"
test = true

[profile]
[profile.bench]
codegen-units = 16
debug = false
debug-assertions = false
incremental = false
opt-level = 3
overflow-checks = false
rpath = false
#[[bench]]
#name = "resp2_decode"
#harness = false

#[[bench]]
#name = "resp2_encode"
#harness = false

#[[bench]]
#name = "resp3_encode"
#harness = false

#[[bench]]
#name = "resp3_decode"
#harness = false
2 changes: 1 addition & 1 deletion LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2021 Alec Embke
Copyright 2024 Alec Embke

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 Alec Embke
Copyright 2024 Alec Embke

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
Loading

0 comments on commit a539798

Please sign in to comment.