aboutsummaryrefslogtreecommitdiffstats
path: root/src/operations.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/operations.erl')
-rw-r--r--src/operations.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/operations.erl b/src/operations.erl
index 8773e0e..de61fd8 100644
--- a/src/operations.erl
+++ b/src/operations.erl
@@ -41,6 +41,7 @@
-include("../include/operations.hrl").
-export([
create_database/1,
+ value_hash/1,
create_relation/3,
create_immutable_relation/2,
update_relation_constraints/3,
@@ -87,6 +88,17 @@
hash(Value) ->
crypto:hash(sha256, term_to_binary(Value)).
+%% @doc Hash a value using Sakura's canonical content hash.
+%%
+%% Public wrapper around the internal hash function, used by other modules
+%% that need to compare values against stored attribute hashes.
+%%
+%% @param Value Any Erlang term
+%% @returns Binary SHA-256 hash
+-spec value_hash(term()) -> binary().
+value_hash(Value) ->
+ hash(Value).
+
%% @doc Insert a tuple into a relation and update the database state.
%%
%% This is the primary operation for adding data to the database. It: