nserver

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 1165a168cbe986c2e3224b760596d5543caa6a6d
parent 5c0ede68c238c5b1f689e8c55464cebbf62f1057
Author: rsiddharth <s@ricketyspace.net>
Date:   Mon, 17 Feb 2020 20:34:34 -0500

nserver/src/protocol.c: Add "deleted" flag handling.

* nserver/src/protocol.c (sssample_parent, sssample)
(ssmean, ssdump, traverse_tree): Add check to see if record was
deleted.

Diffstat:
nserver/src/protocol.c | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/nserver/src/protocol.c b/nserver/src/protocol.c @@ -79,6 +79,11 @@ int sssample_parent(char *key, double s) } check(rec->st != NULL, "record's st invalid"); + if (rec->deleted == 1) { + // Record was deleted; nop. + return 0; + } + // 2. Sample! Stats_sample(rec->st, s); @@ -97,6 +102,7 @@ double sssample(char *key, double s) check(rec != NULL, "record not found"); check(rec->st != NULL, "record's st invalid"); + check(rec->deleted != 1, "record was deleted"); // 2. Sample! Stats_sample(rec->st, s); @@ -123,6 +129,7 @@ double ssmean(char *key) check(rec != NULL, "record not found"); check(rec->st != NULL, "record's st invalid"); + check(rec->deleted != 1, "record was deleted"); // 2. Get mean. double m = Stats_mean(rec->st); @@ -142,6 +149,7 @@ char *ssdump(char *key) check(rec != NULL, "record not found"); check(rec->st != NULL, "stats not found for key"); + check(rec->deleted != 1, "record was deleted"); // 2. get dump. char *dstr = Stats_dump(rec->st); @@ -159,6 +167,7 @@ void traverse_tree(void *value, void *data) bstring bstr = (bstring) data; check(rec != NULL, "Record is NULL"); + check(rec->deleted != 1, "Record was deleted"); check(bstr != NULL, "bstr is NULL"); check(rec->key != NULL, "Record's key is NULL"); check(blength(rec->key) > 0, "Record's key is an empty string");