| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2018-07-11 18:39:48 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2018-07-11 18:39:48 +0200 | 
| commit | b6e8cc8606b288970d7cdf577c6dd36950adac91 (patch) | |
| tree | c8388d48e7d3fb8c8622181e4f0a4376477278b4 /src/shared/io/shr_database.erl | |
| parent | acb9dd3220a3edcac93aa11d1d74d008e2fb23ed (diff) | |
Separates read and write permissions.
Diffstat (limited to 'src/shared/io/shr_database.erl')
| -rw-r--r-- | src/shared/io/shr_database.erl | 40 | 
1 files changed, 30 insertions, 10 deletions
diff --git a/src/shared/io/shr_database.erl b/src/shared/io/shr_database.erl index bffcb9f..60327a5 100644 --- a/src/shared/io/shr_database.erl +++ b/src/shared/io/shr_database.erl @@ -10,8 +10,8 @@  -export  (     [ -      insert/4, -      fetch/2, +      insert/5, +      fetch/3,        commit/1     ]  ). @@ -34,21 +34,41 @@ do_remote_operation (Op, Params) ->  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec insert (atom(), any(), shr_db_user:permission(), any()) -> 'ok'. -insert (DB, ObjectID, Permission, Value) -> -   {atomic, _} = do_remote_operation(insert, [DB, ObjectID, Permission, Value]), +-spec insert +   ( +      atom(), +      any(), +      shr_db_user:permission(), +      shr_db_user:permission(), +      any() +   ) +   -> 'ok'. +insert (DB, ObjectID, ReadPerm, WritePerm, Value) -> +   {atomic, _} = +      do_remote_operation(insert, [DB, ObjectID, ReadPerm, WritePerm, Value]), +     io:format     (        "~nshr_database:insert(~p) -> ok.~n", -      [{DB, ObjectID, Permission, Value}] +      [{DB, ObjectID, ReadPerm, WritePerm, Value}]     ),     ok. --spec fetch (atom(), any()) -> ({'ok', any()} | 'not_found'). -fetch (DB, ObjectID) -> -   {atomic, Reply} = do_remote_operation(read, [DB, ObjectID]), -   io:format("~nshr_database:fetch(~p) -> ~p.~n", [{DB, ObjectID}, Reply]), +-spec fetch +   ( +      atom(), +      any(), +      shr_db_user:user() +   ) +   -> ({'ok', any()} | 'not_found'). +fetch (DB, ObjectID, Cred) -> +   {atomic, Reply} = do_remote_operation(read, [DB, ObjectID, Cred]), +   io:format +   ( +      "~nshr_database:fetch(~p) -> ~p.~n", +      [{DB, ObjectID, Cred}, Reply] +   ),     Reply.  -spec commit (shr_db_query:type()) -> 'ok'.  | 


