summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-07-11 18:02:26 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-07-11 18:02:26 +0200
commitacb9dd3220a3edcac93aa11d1d74d008e2fb23ed (patch)
tree98b45af3f7eb9c7d812ed33a07e6a0f665a7a8cd /src/shared/io/sh_database.erl
parentfde827cba1ff3d889135c74ee1978098465fd200 (diff)
"sh_" -> "shr_".
Diffstat (limited to 'src/shared/io/sh_database.erl')
-rw-r--r--src/shared/io/sh_database.erl58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/shared/io/sh_database.erl b/src/shared/io/sh_database.erl
deleted file mode 100644
index 233e37d..0000000
--- a/src/shared/io/sh_database.erl
+++ /dev/null
@@ -1,58 +0,0 @@
--module(sh_database).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--export
-(
- [
- insert/4,
- fetch/2,
- commit/1
- ]
-).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec get_db_node () -> node().
-get_db_node () -> list_to_atom("db_node@" ++ net_adm:localhost()).
-
--spec do_remote_operation (atom(), list(any())) ->
- (
- {'badrpc', any()}
- | {'aborted', any()}
- | {'atomic', ({'ok', any()} | 'ok' | 'not_found')}
- ).
-do_remote_operation (Op, Params) ->
- rpc:call(get_db_node(), db_access, Op, Params).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec insert (atom(), any(), sh_db_user:permission(), any()) -> 'ok'.
-insert (DB, ObjectID, Permission, Value) ->
- {atomic, _} = do_remote_operation(insert, [DB, ObjectID, Permission, Value]),
- io:format
- (
- "~nsh_database:insert(~p) -> ok.~n",
- [{DB, ObjectID, Permission, Value}]
- ),
-
- ok.
-
--spec fetch (atom(), any()) -> ({'ok', any()} | 'not_found').
-fetch (DB, ObjectID) ->
- {atomic, Reply} = do_remote_operation(read, [DB, ObjectID]),
- io:format("~nsh_database:fetch(~p) -> ~p.~n", [{DB, ObjectID}, Reply]),
- Reply.
-
--spec commit (sh_db_query:type()) -> 'ok'.
-commit (Query) ->
- {atomic, ok} = do_remote_operation(query, [Query]),
- io:format("~nsh_database:commit(~p) -> ok.~n", [Query]),
- ok.