Skip to content

Commit 41a3cc9

Browse files
committed
docs(sql): add Doxygen comments to remaining ORE and STE modules (Phase 3 final)
Completes Phase 3 documentation of advanced index modules: Modules completed: - ore_cllw_u64_8: 7 objects documented (CLLW ORE fixed-width u64) - Types: ore_cllw_u64_8_term_v1, ore_cllw_u64_8_encrypted_v1 - Functions: ore_cllw_u64_8_term_v1, ore_cllw_u64_8_encrypted_v1, ore_cllw_u64_8_compare, ore_cllw_u64_8_lt, ore_cllw_u64_8_gt - Shared comparison functions for order-preserving encryption - ore_cllw_var_8: 7 objects documented (CLLW ORE variable-width) - Types: ore_cllw_var_8_term_v1, ore_cllw_var_8_encrypted_v1 - Functions: ore_cllw_var_8_term_v1, ore_cllw_var_8_encrypted_v1, ore_cllw_var_8_compare, ore_cllw_var_8_lt, ore_cllw_var_8_gt - Parallel to fixed-width with variable-length support - ste_vec: 12 objects documented (STE vector for containment queries) - Types: ste_vec_term_v1, ste_vec_encrypted_v1, ste_vec_value_v1 - Functions: 9 specialized functions for STE vector operations - Critical for @> (contains) and <@ (contained by) operators Phase 3 Statistics: - 26 total objects documented across 7 files - 286 insertions, 38 deletions (net +248 lines) - All ORE (order-revealing encryption) modules now documented - All STE (searchable text encryption) modules now documented - All index modules in EQL now have complete Doxygen documentation All index modules (blake3, hmac_256, bloom_filter, ORE variants, STE) now have comprehensive Doxygen comments following Phase 1 patterns.
1 parent 96fd995 commit 41a3cc9

File tree

7 files changed

+286
-38
lines changed

7 files changed

+286
-38
lines changed

src/ore_cllw_u64_8/compare.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
-- REQUIRE: src/ore_cllw_u64_8/functions.sql
44

55

6+
--! @brief Compare two encrypted values using CLLW ORE index terms
7+
--!
8+
--! Performs a three-way comparison (returns -1/0/1) of encrypted values using
9+
--! their CLLW ORE ciphertext index terms. Used internally by range operators
10+
--! (<, <=, >, >=) for order-revealing comparisons without decryption.
11+
--!
12+
--! @param a eql_v2_encrypted First encrypted value to compare
13+
--! @param b eql_v2_encrypted Second encrypted value to compare
14+
--! @return Integer -1 if a < b, 0 if a = b, 1 if a > b
15+
--!
16+
--! @note NULL values are sorted before non-NULL values
17+
--! @note Uses CLLW ORE cryptographic protocol for secure comparisons
18+
--!
19+
--! @see eql_v2.ore_cllw_u64_8
20+
--! @see eql_v2.has_ore_cllw_u64_8
21+
--! @see eql_v2.compare_ore_cllw_term_bytes
22+
--! @see eql_v2."<"
23+
--! @see eql_v2.">"
624
CREATE FUNCTION eql_v2.compare_ore_cllw_u64_8(a eql_v2_encrypted, b eql_v2_encrypted)
725
RETURNS integer
826
IMMUTABLE STRICT PARALLEL SAFE

src/ore_cllw_u64_8/functions.sql

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
-- REQUIRE: src/ore_cllw_u64_8/types.sql
44

55

6-
7-
-- extracts ste_vec index from a jsonb value
8-
9-
-- extracts ore_cllw_u64_8 index from a jsonb value
10-
6+
--! @brief Extract CLLW ORE index term from JSONB payload
7+
--!
8+
--! Extracts the CLLW ORE ciphertext from the 'ocf' field of an encrypted
9+
--! data payload. Used internally for range query comparisons.
10+
--!
11+
--! @param val JSONB Encrypted data payload containing index terms
12+
--! @return eql_v2.ore_cllw_u64_8 CLLW ORE ciphertext
13+
--! @throws Exception if 'ocf' field is missing when ore index is expected
14+
--!
15+
--! @see eql_v2.has_ore_cllw_u64_8
16+
--! @see eql_v2.compare_ore_cllw_u64_8
1117
CREATE FUNCTION eql_v2.ore_cllw_u64_8(val jsonb)
1218
RETURNS eql_v2.ore_cllw_u64_8
1319
IMMUTABLE STRICT PARALLEL SAFE
@@ -26,8 +32,15 @@ AS $$
2632
$$ LANGUAGE plpgsql;
2733

2834

29-
-- extracts ore_cllw_u64_8 index from an eql_v2_encrypted value
30-
35+
--! @brief Extract CLLW ORE index term from encrypted column value
36+
--!
37+
--! Extracts the CLLW ORE ciphertext from an encrypted column value by accessing
38+
--! its underlying JSONB data field.
39+
--!
40+
--! @param val eql_v2_encrypted Encrypted column value
41+
--! @return eql_v2.ore_cllw_u64_8 CLLW ORE ciphertext
42+
--!
43+
--! @see eql_v2.ore_cllw_u64_8(jsonb)
3144
CREATE FUNCTION eql_v2.ore_cllw_u64_8(val eql_v2_encrypted)
3245
RETURNS eql_v2.ore_cllw_u64_8
3346
IMMUTABLE STRICT PARALLEL SAFE
@@ -38,6 +51,15 @@ AS $$
3851
$$ LANGUAGE plpgsql;
3952

4053

54+
--! @brief Check if JSONB payload contains CLLW ORE index term
55+
--!
56+
--! Tests whether the encrypted data payload includes an 'ocf' field,
57+
--! indicating a CLLW ORE ciphertext is available for range queries.
58+
--!
59+
--! @param val JSONB Encrypted data payload
60+
--! @return Boolean True if 'ocf' field is present and non-null
61+
--!
62+
--! @see eql_v2.ore_cllw_u64_8
4163
CREATE FUNCTION eql_v2.has_ore_cllw_u64_8(val jsonb)
4264
RETURNS boolean
4365
IMMUTABLE STRICT PARALLEL SAFE
@@ -48,6 +70,15 @@ AS $$
4870
$$ LANGUAGE plpgsql;
4971

5072

73+
--! @brief Check if encrypted column value contains CLLW ORE index term
74+
--!
75+
--! Tests whether an encrypted column value includes a CLLW ORE ciphertext
76+
--! by checking its underlying JSONB data field.
77+
--!
78+
--! @param val eql_v2_encrypted Encrypted column value
79+
--! @return Boolean True if CLLW ORE ciphertext is present
80+
--!
81+
--! @see eql_v2.has_ore_cllw_u64_8(jsonb)
5182
CREATE FUNCTION eql_v2.has_ore_cllw_u64_8(val eql_v2_encrypted)
5283
RETURNS boolean
5384
IMMUTABLE STRICT PARALLEL SAFE
@@ -59,11 +90,20 @@ $$ LANGUAGE plpgsql;
5990

6091

6192

62-
--
63-
-- Compare ore cllw bytes
64-
-- Used by both fixed and variable ore cllw variants
65-
--
66-
93+
--! @brief Compare CLLW ORE ciphertext bytes
94+
--! @internal
95+
--!
96+
--! Byte-by-byte comparison of CLLW ORE ciphertexts implementing the CLLW
97+
--! comparison algorithm. Used by both fixed-width (ore_cllw_u64_8) and
98+
--! variable-width (ore_cllw_var_8) ORE variants.
99+
--!
100+
--! @param a Bytea First CLLW ORE ciphertext
101+
--! @param b Bytea Second CLLW ORE ciphertext
102+
--! @return Integer -1 if a < b, 0 if a = b, 1 if a > b
103+
--! @throws Exception if ciphertexts are different lengths
104+
--!
105+
--! @note Shared comparison logic for multiple ORE CLLW schemes
106+
--! @see eql_v2.compare_ore_cllw_u64_8
67107
CREATE FUNCTION eql_v2.compare_ore_cllw_term_bytes(a bytea, b bytea)
68108
RETURNS int AS $$
69109
DECLARE

src/ore_cllw_u64_8/types.sql

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
-- REQUIRE: src/schema.sql
22

3-
-- Represents a ciphertext encrypted with the CLLW ORE scheme for a fixed output size
4-
-- Each output block is 8-bits
3+
--! @brief CLLW ORE index term type for range queries
4+
--!
5+
--! Composite type for CLLW (Copyless Logarithmic Width) Order-Revealing Encryption.
6+
--! Each output block is 8-bits. Used for encrypted range queries via the 'ore' index type.
7+
--! The ciphertext is stored in the 'ocf' field of encrypted data payloads.
8+
--!
9+
--! @see eql_v2.add_search_config
10+
--! @see eql_v2.compare_ore_cllw_u64_8
11+
--! @note This is a transient type used only during query execution
512
CREATE TYPE eql_v2.ore_cllw_u64_8 AS (
613
bytes bytea
714
);

src/ore_cllw_var_8/compare.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
-- REQUIRE: src/ore_cllw_u64_8/functions.sql
44

55

6+
--! @brief Compare two encrypted values using variable-width CLLW ORE index terms
7+
--!
8+
--! Performs a three-way comparison (returns -1/0/1) of encrypted values using
9+
--! their variable-width CLLW ORE ciphertext index terms. Used internally by range operators
10+
--! (<, <=, >, >=) for order-revealing comparisons without decryption.
11+
--!
12+
--! @param a eql_v2_encrypted First encrypted value to compare
13+
--! @param b eql_v2_encrypted Second encrypted value to compare
14+
--! @return Integer -1 if a < b, 0 if a = b, 1 if a > b
15+
--!
16+
--! @note NULL values are sorted before non-NULL values
17+
--! @note Uses variable-width CLLW ORE cryptographic protocol for secure comparisons
18+
--!
19+
--! @see eql_v2.ore_cllw_var_8
20+
--! @see eql_v2.has_ore_cllw_var_8
21+
--! @see eql_v2.compare_ore_cllw_var_8_term
22+
--! @see eql_v2."<"
23+
--! @see eql_v2.">"
624
CREATE FUNCTION eql_v2.compare_ore_cllw_var_8(a eql_v2_encrypted, b eql_v2_encrypted)
725
RETURNS integer
826
IMMUTABLE STRICT PARALLEL SAFE

src/ore_cllw_var_8/functions.sql

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44
-- REQUIRE: src/ore_cllw_u64_8/functions.sql
55

66

7-
8-
-- extracts ore_cllw_var_8 index from a jsonb value
9-
7+
--! @brief Extract variable-width CLLW ORE index term from JSONB payload
8+
--!
9+
--! Extracts the variable-width CLLW ORE ciphertext from the 'ocv' field of an encrypted
10+
--! data payload. Used internally for range query comparisons.
11+
--!
12+
--! @param val JSONB Encrypted data payload containing index terms
13+
--! @return eql_v2.ore_cllw_var_8 Variable-width CLLW ORE ciphertext
14+
--! @throws Exception if 'ocv' field is missing when ore index is expected
15+
--!
16+
--! @see eql_v2.has_ore_cllw_var_8
17+
--! @see eql_v2.compare_ore_cllw_var_8
1018
CREATE FUNCTION eql_v2.ore_cllw_var_8(val jsonb)
1119
RETURNS eql_v2.ore_cllw_var_8
1220
IMMUTABLE STRICT PARALLEL SAFE
@@ -26,8 +34,15 @@ AS $$
2634
$$ LANGUAGE plpgsql;
2735

2836

29-
-- extracts ore_cllw_var_8 index from an eql_v2_encrypted value
30-
37+
--! @brief Extract variable-width CLLW ORE index term from encrypted column value
38+
--!
39+
--! Extracts the variable-width CLLW ORE ciphertext from an encrypted column value by accessing
40+
--! its underlying JSONB data field.
41+
--!
42+
--! @param val eql_v2_encrypted Encrypted column value
43+
--! @return eql_v2.ore_cllw_var_8 Variable-width CLLW ORE ciphertext
44+
--!
45+
--! @see eql_v2.ore_cllw_var_8(jsonb)
3146
CREATE FUNCTION eql_v2.ore_cllw_var_8(val eql_v2_encrypted)
3247
RETURNS eql_v2.ore_cllw_var_8
3348
IMMUTABLE STRICT PARALLEL SAFE
@@ -38,6 +53,15 @@ AS $$
3853
$$ LANGUAGE plpgsql;
3954

4055

56+
--! @brief Check if JSONB payload contains variable-width CLLW ORE index term
57+
--!
58+
--! Tests whether the encrypted data payload includes an 'ocv' field,
59+
--! indicating a variable-width CLLW ORE ciphertext is available for range queries.
60+
--!
61+
--! @param val JSONB Encrypted data payload
62+
--! @return Boolean True if 'ocv' field is present and non-null
63+
--!
64+
--! @see eql_v2.ore_cllw_var_8
4165
CREATE FUNCTION eql_v2.has_ore_cllw_var_8(val jsonb)
4266
RETURNS boolean
4367
IMMUTABLE STRICT PARALLEL SAFE
@@ -48,6 +72,15 @@ AS $$
4872
$$ LANGUAGE plpgsql;
4973

5074

75+
--! @brief Check if encrypted column value contains variable-width CLLW ORE index term
76+
--!
77+
--! Tests whether an encrypted column value includes a variable-width CLLW ORE ciphertext
78+
--! by checking its underlying JSONB data field.
79+
--!
80+
--! @param val eql_v2_encrypted Encrypted column value
81+
--! @return Boolean True if variable-width CLLW ORE ciphertext is present
82+
--!
83+
--! @see eql_v2.has_ore_cllw_var_8(jsonb)
5184
CREATE FUNCTION eql_v2.has_ore_cllw_var_8(val eql_v2_encrypted)
5285
RETURNS boolean
5386
IMMUTABLE STRICT PARALLEL SAFE
@@ -58,6 +91,22 @@ AS $$
5891
$$ LANGUAGE plpgsql;
5992

6093

94+
--! @brief Compare variable-width CLLW ORE ciphertext terms
95+
--! @internal
96+
--!
97+
--! Three-way comparison of variable-width CLLW ORE ciphertexts. Compares the common
98+
--! prefix using byte-by-byte CLLW comparison, then falls back to length comparison
99+
--! if the common prefix is equal. Used by compare_ore_cllw_var_8 for range queries.
100+
--!
101+
--! @param a eql_v2.ore_cllw_var_8 First variable-width CLLW ORE ciphertext
102+
--! @param b eql_v2.ore_cllw_var_8 Second variable-width CLLW ORE ciphertext
103+
--! @return Integer -1 if a < b, 0 if a = b, 1 if a > b
104+
--!
105+
--! @note Handles variable-length ciphertexts by comparing common prefix first
106+
--! @note Returns NULL if either input is NULL
107+
--!
108+
--! @see eql_v2.compare_ore_cllw_term_bytes
109+
--! @see eql_v2.compare_ore_cllw_var_8
61110
CREATE FUNCTION eql_v2.compare_ore_cllw_var_8_term(a eql_v2.ore_cllw_var_8, b eql_v2.ore_cllw_var_8)
62111
RETURNS int AS $$
63112
DECLARE

src/ore_cllw_var_8/types.sql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
-- REQUIRE: src/schema.sql
22

3-
-- Represents a ciphertext encrypted with the CLLW ORE scheme for a variable output size
4-
-- Each output block is 8-bits
3+
--! @brief Variable-width CLLW ORE index term type for range queries
4+
--!
5+
--! Composite type for variable-width CLLW (Copyless Logarithmic Width) Order-Revealing Encryption.
6+
--! Each output block is 8-bits. Unlike ore_cllw_u64_8, supports variable-length ciphertexts.
7+
--! Used for encrypted range queries via the 'ore' index type.
8+
--! The ciphertext is stored in the 'ocv' field of encrypted data payloads.
9+
--!
10+
--! @see eql_v2.add_search_config
11+
--! @see eql_v2.compare_ore_cllw_var_8
12+
--! @note This is a transient type used only during query execution
513
CREATE TYPE eql_v2.ore_cllw_var_8 AS (
614
bytes bytea
715
);

0 commit comments

Comments
 (0)