summaryrefslogtreecommitdiff
path: root/lib/polyjuice/client/storage
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2019-10-06 09:21:43 -0400
committerHubert Chathi <hubert@uhoreg.ca>2019-10-06 09:22:10 -0400
commitb1ac9384a8c84e72bd42f30893b7c523f22b2049 (patch)
tree8b982d4234337c742efabcd1d48c87fe7af822cd /lib/polyjuice/client/storage
parentadd support for filters (diff)
add test for Ets storage (and fix some issues)
Diffstat (limited to 'lib/polyjuice/client/storage')
-rw-r--r--lib/polyjuice/client/storage/ets.ex8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/polyjuice/client/storage/ets.ex b/lib/polyjuice/client/storage/ets.ex
index e3a6e0c..f8a2b03 100644
--- a/lib/polyjuice/client/storage/ets.ex
+++ b/lib/polyjuice/client/storage/ets.ex
@@ -49,25 +49,25 @@ defmodule Polyjuice.Client.Storage.Ets do
def set_filter_id(%{table: table}, filter, id) when is_map(filter) and is_binary(id) do
{:ok, json} = Polyjuice.Util.JSON.canonical_json(filter)
hash = :crypto.hash(:sha256, json)
- :dets.insert(table, {"filter_" <> hash, id})
+ :ets.insert(table, {"filter_" <> hash, id})
end
def get_filter_id(%{table: table}, filter) do
{:ok, json} = Polyjuice.Util.JSON.canonical_json(filter)
hash = :crypto.hash(:sha256, json)
- case :dets.lookup(table, "filter_" <> hash) do
+ case :ets.lookup(table, "filter_" <> hash) do
[{_, id}] -> id
_ -> nil
end
end
def kv_put(%{table: table}, key, value) when is_binary(key) do
- :dets.insert(table, {"kv_" <> key, value})
+ :ets.insert(table, {"kv_" <> key, value})
end
def kv_get(%{table: table}, key, default \\ nil) when is_binary(key) do
- case :dets.lookup(table, "kv_" <> key) do
+ case :ets.lookup(table, "kv_" <> key) do
[{_, value}] -> value
_ -> default
end