Skip to content

Commit e2c85c9

Browse files
committed
Merges dev branch
1 parent 4de48ff commit e2c85c9

File tree

201 files changed

+26601
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+26601
-163
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,10 @@
3232
*.dSYM/
3333
*.su
3434

35+
# Python
36+
venv/
37+
*.pyc
38+
3539
/build
3640
/Testing
41+
/.vscode

CMakeLists.txt

+37-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,47 @@
11
cmake_minimum_required(VERSION 3.0.0)
2-
project(rejson VERSION 0.0.0)
2+
project(ReJSON VERSION 0.0.0)
3+
4+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
5+
6+
# Use gnu99, source: http://stackoverflow.com/a/30564223/3160475
7+
if (CMAKE_VERSION VERSION_LESS "3.1")
8+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
9+
set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}")
10+
endif ()
11+
else ()
12+
set (CMAKE_C_STANDARD 99)
13+
endif ()
14+
15+
# source: https://cmake.org/pipermail/cmake/2007-May/014345.html
16+
# KDE's with -fPIC
17+
IF(UNIX AND NOT WIN32)
18+
FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
19+
IF(CMAKE_UNAME)
20+
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
21+
SET(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL
22+
"processor type (i386 and x86_64)")
23+
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
24+
ADD_DEFINITIONS(-fPIC)
25+
ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
26+
ENDIF(CMAKE_UNAME)
27+
ENDIF(UNIX AND NOT WIN32)
28+
29+
set (RMUTIL_DIR "${PROJECT_SOURCE_DIR}/deps/RedisModuleSDK/rmutil")
30+
set (JSONSL_DIR "${PROJECT_SOURCE_DIR}/deps/jsonsl")
31+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
332

433
include(CTest)
534
enable_testing()
6-
add_executable(test_object test/test_object.c src/object.c src/path.c src/json_path.c)
735

8-
add_test(test_object test_object)
36+
# This helps https://github.com/vector-of-bool/vscode-cmake-tools
37+
include(CMakeToolsHelpers OPTIONAL)
938

10-
add_library(rejson src/object.c)
39+
include_directories("${PROJECT_SOURCE_DIR}/src" ${RMUTIL_DIR} ${JSONSL_DIR})
40+
add_subdirectory(src)
41+
add_subdirectory(test)
1142

1243
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
1344
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
45+
1446
include(CPack)
47+
include_directories()

COPYRIGHT

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (C) 2016 Redis Labs
2+
3+
This program is free software: you can redistribute it and/or modify
4+
it under the terms of the GNU Affero General Public License as
5+
published by the Free Software Foundation, either version 3 of the
6+
License, or (at your option) any later version.
7+
8+
This program is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
GNU Affero General Public License for more details.
12+
13+
You should have received a copy of the GNU Affero General Public License
14+
along with this program. If not, see <http://www.gnu.org/licenses/>.

README.md

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# ReJSON - a JSON data type for Redis
2+
3+
ReJSON is a Redis module that implements
4+
[ECMA-404 The JSON Data Interchange Standard](http://json.org/) as a native data type. It allows
5+
storing, updating and fetching JSON values from Redis keys (documents). The JSON values are managed
6+
as binary objects, thus allowing Redis-blazing performance.
7+
8+
## Quickstart
9+
10+
1. [Build the ReJSON module library](#building-the-module-library)
11+
1. [Load ReJSON to Redis](#loading-the-module-to-redis)
12+
1. [Use it from **any** Redis client](#using-rejson), e.g.:
13+
14+
````
15+
~$/ redis-cli
16+
127.0.0.1:6379> JSON.SET doc . '{ "foo": "bar", "baz": [42, true] }'
17+
OK
18+
127.0.0.1:6379> JSON.GET doc .baz[0]
19+
"42"
20+
127.0.0.1:6379> JSON.DEL doc .foo
21+
1
22+
127.0.0.1:6379> JSON.OBJKEYS doc .
23+
1) "baz"
24+
````
25+
26+
## What is ReJSON
27+
28+
## Limitations and known issues
29+
30+
* Alpha quality
31+
* AOF rewrite will fail for documents with serialization over 0.5GB?
32+
* Searching for object keys is O(N)
33+
34+
## Building the module library
35+
36+
Prerequirements:
37+
38+
* devtools
39+
* cmake
40+
* rejson repository (e.g. `git clone https://github.com/RedisLabsModules/rejson.git`)
41+
42+
Assuming that the repository's directory is at `~/rejson`, navigate to it and run the script
43+
`bootstrap.sh` followed by `cmake`. This should look something like:
44+
45+
```
46+
~/rejson$ ./bootstrap.sh
47+
-- The C compiler identification is GNU 5.4.0
48+
...
49+
-- Configuring done
50+
-- Generating done
51+
-- Build files have been written to: rejson/build
52+
rejson$ cmake --build build --target rejson
53+
Scanning dependencies of target rmobject
54+
...
55+
[100%] Linking C shared library rejson/lib/rejson.so
56+
[100%] Built target rejson
57+
rejson$
58+
```
59+
60+
Congratulations! You can find the compiled module library at `lib/rejson.so`.
61+
62+
#### MacOSX
63+
64+
TBD
65+
66+
#### Windows
67+
68+
Yeah, right :)
69+
70+
## Loading the module to Redis
71+
72+
Prerequirements:
73+
74+
* Redis v4.0 or above (see ...)
75+
76+
The recommended way have Redis load the module is during startup by by adding the following to the
77+
`redis.conf` file:
78+
79+
```
80+
loadmodule /path/to/module/rejson.so
81+
```
82+
83+
In the line above replace `/path/to/module/rejson.so` with the actual path to the module's library.
84+
Alternatively you, you can have Redis load the module using the following command line argument
85+
syntax:
86+
87+
```
88+
~/$ redis-server --loadmodule /path/to/module/rejson.so
89+
```
90+
91+
Lastly, you can also use the [`MODULE LOAD`](http://redis.io/commands/module-load) command. Note,
92+
however, that `MODULE LOAD` is a dangerous command and may be blocked/deprecated in the future due
93+
to security considerations.
94+
95+
## Using ReJSON
96+
97+
Link to docs/commands
98+
Basic Python and Node examples to illustrate the use of a raw command.
99+
100+
## Testing and development
101+
102+
Link to docs/design.md
103+
104+
Setting the path to the Redis server executable for unit testing: `REDIS_SERVER_PATH` CMake variable
105+
106+
`valgrind --tool=memcheck --suppressions=../redis/src/valgrind.sup ../redis/src/redis-server --loadmodule ./lib/rejson.so`
107+
108+
## Contributing
109+
110+
## License
111+
AGPLv3 - see [LICENSE](LICENSE)

deps/RedisModuleSDK/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.o
2+
*.a
3+
*.so
4+
*.db
5+
.vscode
6+
rmutil/test_vector

0 commit comments

Comments
 (0)