Skip to content
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

Publicizing RedisKey member #245

Open
wants to merge 8 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
35 changes: 23 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ commands:
apt-get -q install -y git openssh-client curl ca-certificates make tar gzip
bash <(curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh)
- setup_remote_docker:
version: 20.10.2
version: 20.10.14
docker_layer_caching: true

checkout-all:
Expand All @@ -56,6 +56,8 @@ commands:
name: Setup automation
command: |
./deps/readies/bin/getpy3
python3 --version
python3 -m pip list

install-prerequisites:
parameters:
Expand All @@ -72,10 +74,12 @@ commands:
command: |
./sbin/system-setup.py
bash -l -c "make info"
python3 -m pip list
- run:
name: Install Redis
shell: /bin/bash -l -eo pipefail
command: |
bash -l -c "./deps/readies/bin/getredis -v \"<<parameters.redis_version>>\" --force <<parameters.getredis_params>>"
./deps/readies/bin/getredis -v <<parameters.redis_version>> --force <<parameters.getredis_params>>
redis-server --version

build-steps:
Expand Down Expand Up @@ -103,21 +107,25 @@ commands:
- v3-dependencies-{{ arch }}-{{ checksum "Cargo.toml" }}
- run:
name: Check formatting
command: bash -l -c "make lint"
shell: /bin/bash -l -eo pipefail
command: make lint
- run:
name: Build debug
command: bash -l -c "make build DEBUG=1 <<parameters.build_params>>"
shell: /bin/bash -l -eo pipefail
command: make build DEBUG=1 <<parameters.build_params>>
- run:
name: Build release
command: bash -l -c "make build <<parameters.build_params>>"
shell: /bin/bash -l -eo pipefail
command: make build <<parameters.build_params>>
- save_cache:
key: v3-dependencies-{{ arch }}-{{ checksum "Cargo.toml" }}
paths:
- "~/.cargo"
- "./target"
- run:
name: Run all tests
command: bash -l -c "make test"
shell: /bin/bash -l -eo pipefail
command: make test

platforms-build-steps:
parameters:
Expand All @@ -130,27 +138,30 @@ commands:
- setup-automation
- run:
name: Build for platform
shell: /bin/bash -l -eo pipefail
command: |
cd build/platforms
make build OSNICK="<<parameters.platform>>" VERSION="$CIRCLE_TAG" BRANCH="$CIRCLE_BRANCH" TEST=1 SHOW=1

#----------------------------------------------------------------------------------------------------------------------------------

#----------------------------------------------------------------------------------------------------------------------------------

jobs:
build:
docker:
- image: redisfab/rmbuilder:6.2.5-x64-bullseye
- image: redisfab/rmbuilder:6.2.7-x64-bullseye
steps:
- build-steps

platforms-build:
parameters:
platform:
type: string
docker:
- image: debian:bullseye
# docker:
# - image: debian:bullseye
machine:
enabled: true
image: ubuntu-2004:202010-01
resource_class: large
steps:
- platforms-build-steps:
platform: <<parameters.platform>>
Expand Down Expand Up @@ -234,6 +245,6 @@ workflows:
<<: *on-integ-and-version-tags
matrix:
parameters:
platform: [focal, bionic, xenial, ol8, centos7, bullseye]
platform: [jammy, focal, bionic, xenial, ol8, centos7, bullseye]
- build-macos:
<<: *on-any-branch
2 changes: 1 addition & 1 deletion deps/readies
2 changes: 1 addition & 1 deletion examples/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static MY_REDIS_TYPE: RedisType = RedisType::new(
);

unsafe extern "C" fn free(value: *mut c_void) {
Box::from_raw(value.cast::<MyType>());
drop(Box::from_raw(value.cast::<MyType>()));
}

fn alloc_set(ctx: &Context, args: Vec<RedisString>) -> RedisResult {
Expand Down
10 changes: 10 additions & 0 deletions sbin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

PROGNAME="${BASH_SOURCE[0]}"
HERE="$(cd "$(dirname "$PROGNAME")" &>/dev/null && pwd)"
ROOT=$(cd $HERE/.. && pwd)
READIES=$ROOT/deps/readies
. $READIES/shibumi/defs

$READIES/bin/getpy3
$ROOT/sbin/system-setup.py
4 changes: 3 additions & 1 deletion sbin/system-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ def common_first(self):

self.run("%s/bin/enable-utf8" % READIES)

self.run("%s/bin/getclang --modern" % READIES)
if not self.has_command("rustc"):
self.run("%s/bin/getrust" % READIES)
if self.osnick == 'ol8':
self.install('tar')
self.run("%s/bin/getcmake" % READIES)

def linux_first(self):
self.run("%s/bin/getclang --modern" % READIES)

def debian_compat(self):
self.run("%s/bin/getgcc" % READIES)

Expand Down
2 changes: 1 addition & 1 deletion src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub enum KeyMode {
#[derive(Debug)]
pub struct RedisKey {
ctx: *mut raw::RedisModuleCtx,
key_inner: *mut raw::RedisModuleKey,
pub key_inner: *mut raw::RedisModuleKey,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we instead have a method to return it, rather than having it visible to everyone. Usually, such methods are called as_ptr and as_mut_ptr. I suggest we follow the conventional naming and leave this struct member private in favour of having a method.
I also didn't see where it was needed exactly and in what way. Perhaps, if there are examples of where it is needed, we could make it accessible in a more optimal way.

}

impl RedisKey {
Expand Down