| summaryrefslogtreecommitdiff |
diff options
| -rw-r--r-- | src/ataxia_client.erl | 24 | ||||
| -rw-r--r-- | src/ataxia_server.erl | 12 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/ataxia_client.erl b/src/ataxia_client.erl index 9968f85..5e8659e 100644 --- a/src/ataxia_client.erl +++ b/src/ataxia_client.erl @@ -75,15 +75,15 @@ get_db_node_for (_ObjectID) -> -spec add_at ( atom(), - ataxia_id:type(), ataxia_security:user(), - any() + any(), + ataxia_id:type() ) -> ('ok' | ataxia_error:type()). -add_at (DB, ID, User, Value) -> +add_at (DB, User, Value, ID) -> Permission = ataxia_security:allow_only(User), - add_at(DB, ID, Permission, Permission, ataxia_lock:unlocked(), Value). + add_at(DB, Permission, Permission, ataxia_lock:unlocked(), Value, ID). -spec add ( @@ -126,14 +126,14 @@ reserve_at (DB, User, ID) -> -spec add_at ( atom(), - ataxia_id:type(), ataxia_security:permission(), ataxia_security:permission(), - any() + any(), + ataxia_id:type() ) -> ('ok' | ataxia_error:type()). -add_at (DB, ID, ReadPerm, WritePerm, Value) -> - add_at(DB, ID, ReadPerm, WritePerm, ataxia_lock:unlocked(), Value). +add_at (DB, ReadPerm, WritePerm, Value, ID) -> + add_at(DB, ReadPerm, WritePerm, ataxia_lock:unlocked(), Value, ID). -spec add ( @@ -173,14 +173,14 @@ reserve_at (DB, ReadPerm, WritePerm, ID) -> -spec add_at ( atom(), - ataxia_id:type(), ataxia_security:permission(), ataxia_security:permission(), ataxia_lock:type(), - any() + any(), + ataxia_id:type() ) -> ('ok' | ataxia_error:type()). -add_at (DB, ID, ReadPerm, WritePerm, Lock, Value) -> +add_at (DB, ReadPerm, WritePerm, Lock, Value, ID) -> DBNode = get_db_node_for(ID), Reply = @@ -189,7 +189,7 @@ add_at (DB, ID, ReadPerm, WritePerm, Lock, Value) -> DBNode, ataxia_server, add_at, - [DB, ID, ReadPerm, WritePerm, Lock, Value] + [DB, ReadPerm, WritePerm, Lock, Value, ID] ), io:format diff --git a/src/ataxia_server.erl b/src/ataxia_server.erl index 4453e63..717957b 100644 --- a/src/ataxia_server.erl +++ b/src/ataxia_server.erl @@ -202,14 +202,14 @@ fetch_if_internals (DB, User, ID, Cond) -> -spec add_at ( atom(), - ataxia_id:type(), ataxia_security:permission(), ataxia_security:permission(), ataxia_lock:type(), - any() + any(), + ataxia_id:type() ) -> ({'aborted', any()} | 'ok'). -add_at (DB, ID, ReadPerm, WritePerm, Lock, Value) -> +add_at (DB, ReadPerm, WritePerm, Lock, Value, ID) -> Item = ataxia_entry:new(ID, ReadPerm, WritePerm, Lock, Value), case mnesia:transaction(fun add_new_item/2, [DB, Item]) of {atomic, ok} -> ok; @@ -227,7 +227,7 @@ add_at (DB, ID, ReadPerm, WritePerm, Lock, Value) -> -> ({'aborted', any()} | {'ok', ataxia_id:type()}). add (DB, ReadPerm, WritePerm, Lock, Value) -> ID = ataxia_id_manager:allocate(DB), - case add_at(DB, ID, ReadPerm, WritePerm, Lock, Value) of + case add_at(DB, ReadPerm, WritePerm, Lock, Value, ID) of ok -> {ok, ID}; {aborted, Val} -> {aborted, Val} end. @@ -246,11 +246,11 @@ reserve_at (DB, ReadPerm, WritePerm, Lock, ID) -> add_at ( DB, - ID, ataxia_security:add_access(ataxia_security:janitor(), ReadPerm), ataxia_security:add_access(ataxia_security:janitor(), WritePerm), Lock, % TODO: allow the janitor there. - reserved + reserved, + ID ). -spec reserve |


