diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-05 23:42:15 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-05 23:42:15 -0300 |
| commit | 8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5 (patch) | |
| tree | 84f9ddd9e41236fb7a6f540aab07e65db9bc93cb /src/main.erl | |
| parent | 295c6a5a1f2b0db9d756ffe7bf413553a0c02737 (diff) | |
| download | Sakura-8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5.tar.gz Sakura-8c640a262969ef44cd8bc0e0abe95e2a54f4c3f5.zip | |
ocaml re-migration
Diffstat (limited to 'src/main.erl')
| -rw-r--r-- | src/main.erl | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/main.erl b/src/main.erl deleted file mode 100644 index 323d054..0000000 --- a/src/main.erl +++ /dev/null @@ -1,66 +0,0 @@ --module(main). --behaviour(application). - --export([start/2, stop/1, setup/0]). - -%% @doc Initialize Mnesia database schema and tables. -%% -%% Creates a fresh Mnesia schema with four tables for content-addressed storage: -%% <ul> -%% <li>`attribute' - Hash → Value mapping for deduplication</li> -%% <li>`tuple' - Hash → Tuple mapping with attribute references</li> -%% <li>`relation' - Hash → Relation with merkle tree and schema</li> -%% <li>`database_state' - Hash → Database with relation merkle tree</li> -%% </ul> -%% -%% <b>Warning:</b> This function deletes any existing schema and recreates it from scratch. -%% -%% @returns `ok' on success -%% @see operations:create_database/1 -setup() -> - mnesia:stop(), - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - mnesia:start(), - mnesia:create_table(attribute, [ - {attributes, [hash, value]}, - {disc_copies, [node()]}, - {type, set} - ]), - mnesia:create_table(tuple, [ - {attributes, [hash, relation, attribute_map]}, - {disc_copies, [node()]}, - {type, set} - ]), - mnesia:create_table(relation, [ - {attributes, [hash, name, tree, schema, constraints, cardinality, generator, membership_criteria, provenance, lineage]}, - {disc_copies, [node()]}, - {type, set}, - {index, [name]} % Index on name for efficient lookup - ]), - mnesia:create_table(database_state, [ - {attributes, [hash, name, tree, relations, timestamp]}, - {disc_copies, [node()]}, - {type, set} - ]). - -uuid() -> - ok = application:load(quickrand), - ok = quickrand:seed(), - ok = quickrand_cache:init(), - quickrand_cache:new(). - -start(_StartType, _StartArgs) -> - %% Start Mnesia (or other children) here - io:format("Starting app...~n"), - - %% Ensure Mnesia is started - mnesia:start(), - setup(), - _ = uuid(), - - {ok, self()}. - -stop(_State) -> - io:format("Stopping app...~n"), - ok. |
