summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-03-31 22:48:01 +0200
committerantirez <antirez@gmail.com>2014-03-31 22:48:01 +0200
commit5afcca34ce5a87c933b48ada9076025c7b76b8bf (patch)
treeed2ca2d1b39be27b310a2be4ec20ffb5e42b1316
parentba4e20835a769eb1934bed41b00155e3c9f448c8 (diff)
downloadredis-5afcca34ce5a87c933b48ada9076025c7b76b8bf.tar.gz
HyperLogLog API prefix modified from "P" to "PF".
Using both the initials of Philippe Flajolet instead of just "P".
-rw-r--r--src/hyperloglog.c14
-rw-r--r--src/redis.c8
-rw-r--r--src/redis.h8
-rw-r--r--utils/hyperloglog/hll-err.rb4
-rw-r--r--utils/hyperloglog/hll-gnuplot-graph.rb4
5 files changed, 19 insertions, 19 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c
index 3fbca201d..caec2ff0e 100644
--- a/src/hyperloglog.c
+++ b/src/hyperloglog.c
@@ -435,8 +435,8 @@ uint64_t hllCount(uint8_t *registers) {
/* ========================== HyperLogLog commands ========================== */
-/* PADD var ele ele ele ... ele => :0 or :1 */
-void paddCommand(redisClient *c) {
+/* PFADD var ele ele ele ... ele => :0 or :1 */
+void pfaddCommand(redisClient *c) {
robj *o = lookupKeyWrite(c->db,c->argv[1]);
uint8_t *registers;
int updated = 0, j;
@@ -482,8 +482,8 @@ void paddCommand(redisClient *c) {
addReply(c, updated ? shared.cone : shared.czero);
}
-/* PCOUNT var -> approximated cardinality of set. */
-void pcountCommand(redisClient *c) {
+/* PFCOUNT var -> approximated cardinality of set. */
+void pfcountCommand(redisClient *c) {
robj *o = lookupKeyRead(c->db,c->argv[1]);
uint8_t *registers;
uint64_t card;
@@ -540,8 +540,8 @@ void pcountCommand(redisClient *c) {
}
}
-/* PMERGE dest src1 src2 src3 ... srcN => OK */
-void pmergeCommand(redisClient *c) {
+/* PFMERGE dest src1 src2 src3 ... srcN => OK */
+void pfmergeCommand(redisClient *c) {
uint8_t max[REDIS_HLL_REGISTERS];
uint8_t *registers;
int j, i;
@@ -614,7 +614,7 @@ void pmergeCommand(redisClient *c) {
* the correct value to be retained and not affect adjacent values. */
#define REDIS_HLL_TEST_CYCLES 1000
-void pselftestCommand(redisClient *c) {
+void pfselftestCommand(redisClient *c) {
int j, i;
sds bitcounters = sdsnewlen(NULL,REDIS_HLL_SIZE);
uint8_t bytecounters[REDIS_HLL_REGISTERS];
diff --git a/src/redis.c b/src/redis.c
index dbcf561fe..03268be79 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -268,10 +268,10 @@ struct redisCommand redisCommandTable[] = {
{"bitcount",bitcountCommand,-2,"r",0,NULL,1,1,1,0,0},
{"bitpos",bitposCommand,-3,"r",0,NULL,1,1,1,0,0},
{"wait",waitCommand,3,"rs",0,NULL,0,0,0,0,0},
- {"pselftest",pselftestCommand,1,"r",0,NULL,0,0,0,0,0},
- {"padd",paddCommand,-2,"wm",0,NULL,1,1,1,0,0},
- {"pcount",pcountCommand,2,"w",0,NULL,1,1,1,0,0},
- {"pmerge",pmergeCommand,-2,"wm",0,NULL,1,-1,1,0,0}
+ {"pfselftest",pfselftestCommand,1,"r",0,NULL,0,0,0,0,0},
+ {"pfadd",pfaddCommand,-2,"wm",0,NULL,1,1,1,0,0},
+ {"pfcount",pfcountCommand,2,"w",0,NULL,1,1,1,0,0},
+ {"pfmerge",pfmergeCommand,-2,"wm",0,NULL,1,-1,1,0,0}
};
struct evictionPoolEntry *evictionPoolAlloc(void);
diff --git a/src/redis.h b/src/redis.h
index b7857dfa8..35345d388 100644
--- a/src/redis.h
+++ b/src/redis.h
@@ -1448,10 +1448,10 @@ void bitcountCommand(redisClient *c);
void bitposCommand(redisClient *c);
void replconfCommand(redisClient *c);
void waitCommand(redisClient *c);
-void pselftestCommand(redisClient *c);
-void paddCommand(redisClient *c);
-void pcountCommand(redisClient *c);
-void pmergeCommand(redisClient *c);
+void pfselftestCommand(redisClient *c);
+void pfaddCommand(redisClient *c);
+void pfcountCommand(redisClient *c);
+void pfmergeCommand(redisClient *c);
#if defined(__GNUC__)
void *calloc(size_t count, size_t size) __attribute__ ((deprecated));
diff --git a/utils/hyperloglog/hll-err.rb b/utils/hyperloglog/hll-err.rb
index 8481844bc..75bb8e424 100644
--- a/utils/hyperloglog/hll-err.rb
+++ b/utils/hyperloglog/hll-err.rb
@@ -18,9 +18,9 @@ while true do
elements << ele
i += 1
}
- r.padd('hll',*elements)
+ r.pfadd('hll',*elements)
}
- approx = r.pcount('hll')
+ approx = r.pfcount('hll')
abs_err = (approx-i).abs
rel_err = 100.to_f*abs_err/i
puts "#{i} vs #{approx}: #{rel_err}%"
diff --git a/utils/hyperloglog/hll-gnuplot-graph.rb b/utils/hyperloglog/hll-gnuplot-graph.rb
index 41e7f717a..6d80adf05 100644
--- a/utils/hyperloglog/hll-gnuplot-graph.rb
+++ b/utils/hyperloglog/hll-gnuplot-graph.rb
@@ -30,9 +30,9 @@ def run_experiment(r,seed,max,step)
elements << ele
i += 1
}
- r.padd('hll',*elements)
+ r.pfadd('hll',*elements)
}
- approx = r.pcount('hll')
+ approx = r.pfcount('hll')
err = approx-i
rel_err = 100.to_f*err/i
samples << [i,rel_err]