Skip to content

Commit dfdc32b

Browse files
authored
chore: import t-digest-c lib (#5102)
* import t-digest-c lib --------- Signed-off-by: kostas <[email protected]>
1 parent 10ab0dc commit dfdc32b

File tree

5 files changed

+975
-1
lines changed

5 files changed

+975
-1
lines changed

src/redis/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_library(redis_lib crc16.c crc64.c crcspeed.c debug.c intset.c geo.c
1212
geohash.c geohash_helper.c t_zset.c
1313
listpack.c lzf_c.c lzf_d.c sds.c
1414
quicklist.c rax.c redis_aux.c t_stream.c
15-
util.c ziplist.c hyperloglog.c ${ZMALLOC_SRC})
15+
util.c ziplist.c hyperloglog.c tdigest.c ${ZMALLOC_SRC})
1616

1717
cxx_link(redis_lib ${ZMALLOC_DEPS})
1818

src/redis/t-digest.LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2019 Bob Rudis
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/redis/td_malloc.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Adaptive histogram based on something like streaming k-means crossed with Q-digest.
3+
* The implementation is a direct descendent of MergingDigest
4+
* https://github.com/tdunning/t-digest/
5+
*
6+
* Copyright (c) 2021 Redis, All rights reserved.
7+
*
8+
* Allocator selection.
9+
*
10+
* This file is used in order to change the t-digest allocator at compile time.
11+
* Just define the following defines to what you want to use. Also add
12+
* the include of your alternate allocator if needed (not needed in order
13+
* to use the default libc allocator). */
14+
15+
#ifndef TD_ALLOC_H
16+
#define TD_ALLOC_H
17+
#define __td_malloc malloc
18+
#define __td_calloc calloc
19+
#define __td_realloc realloc
20+
#define __td_free free
21+
#endif

0 commit comments

Comments
 (0)