Skip to content

Commit 37c02c0

Browse files
Rename function for reducing a hash set to a seed.
1 parent 4703be1 commit 37c02c0

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

pg_diffix/aggregation/noise.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "pg_diffix/utils.h"
55

6-
typedef hash_t seed_t;
7-
86
/*
97
* Returns a uniform integer in the positive interval [min, max] for the given seed and step name.
108
*/

pg_diffix/utils.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
typedef uint64 hash_t;
24+
typedef hash_t seed_t;
2425

2526
static inline hash_t hash_bytes(const void *bytes, size_t size)
2627
{
@@ -66,7 +67,7 @@ static inline List *hash_set_add(List *hash_set, hash_t hash)
6667
return list_append_unique_ptr(hash_set, (void *)hash);
6768
}
6869

69-
extern hash_t hash_set_combine(const List *hash_set);
70+
extern seed_t hash_set_to_seed(const List *hash_set);
7071

7172
static inline List *hash_set_union(List *dst_set, const List *src_set)
7273
{

src/aggregation/count_distinct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static bool aid_set_is_high_count(seed_t bucket_seed, const List *aid_values_set
8787
if (list_length(aid_values_set) < g_config.low_count_min_threshold)
8888
return false; /* Fewer AID values than minimum threshold, value is low-count. */
8989

90-
seed_t aid_seed = hash_set_combine(aid_values_set);
90+
seed_t aid_seed = hash_set_to_seed(aid_values_set);
9191

9292
seed_t seeds[] = {bucket_seed, aid_seed};
9393
int threshold = generate_lcf_threshold(seeds, ARRAY_LENGTH(seeds));

src/query/anonymization.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static void prepare_bucket_seeds(Query *query)
490490
seed_material_hash_set = hash_set_add(seed_material_hash_set, seed_material_hash);
491491
}
492492

493-
g_sql_seed = hash_set_combine(seed_material_hash_set);
493+
g_sql_seed = hash_set_to_seed(seed_material_hash_set);
494494

495495
list_free(seed_material_hash_set);
496496
}
@@ -576,7 +576,7 @@ seed_t compute_bucket_seed(const Bucket *bucket, const BucketDescriptor *bucket_
576576
label_hash_set = hash_set_add(label_hash_set, label_hash);
577577
}
578578

579-
seed_t bucket_seed = g_sql_seed ^ hash_set_combine(label_hash_set);
579+
seed_t bucket_seed = g_sql_seed ^ hash_set_to_seed(label_hash_set);
580580

581581
list_free(label_hash_set);
582582

src/utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
#include "pg_diffix/utils.h"
1212

13-
hash_t hash_set_combine(const List *hash_set)
13+
seed_t hash_set_to_seed(const List *hash_set)
1414
{
1515
ListCell *cell = NULL;
16-
hash_t accumulator = 0;
16+
seed_t accumulator = 0;
1717
foreach (cell, hash_set)
1818
{
1919
hash_t hash = (hash_t)lfirst(cell);

0 commit comments

Comments
 (0)