ieQu1 2 лет назад
Родитель
Сommit
cfcd81e17b

+ 6 - 6
apps/emqx_durable_storage/src/emqx_ds.erl

@@ -73,7 +73,7 @@
     {ok, [message_id()]} | {error, _}.
 message_store(_Msg, _Opts) ->
     %% TODO
-    ok.
+    {error, not_implemented}.
 
 -spec message_store([emqx_types:message()]) -> {ok, [message_id()]} | {error, _}.
 message_store(Msg) ->
@@ -106,7 +106,7 @@ session_open(ClientID) ->
                         {false, ClientID, Iterators};
                     [] ->
                         Session = #session{id = ClientID, iterators = []},
-                        mnesia:write(?SESSION_TAB, Session),
+                        mnesia:write(?SESSION_TAB, Session, write),
                         {true, ClientID, []}
                 end
             end
@@ -117,10 +117,10 @@ session_open(ClientID) ->
 %% during session GC
 -spec session_drop(emqx_types:clientid()) -> ok.
 session_drop(ClientID) ->
-    {atomic, ok} = mnesia:transaction(
+    {atomic, ok} = mria:transaction(
         ?DS_SHARD,
         fun() ->
-            mnesia:delete(?SESSION_TAB, ClientID)
+            mnesia:delete({?SESSION_TAB, ClientID})
         end
     ),
     ok.
@@ -146,7 +146,7 @@ session_add_iterator(_SessionId, _TopicFilter) ->
     {ok, boolean()} | {error, session_not_found}.
 session_del_iterator(_SessionId, _TopicFilter) ->
     %% TODO
-    false.
+    {ok, false}.
 
 -spec session_stats() -> #{}.
 session_stats() ->
@@ -166,7 +166,7 @@ iterator_update(_IterId, _Iter) ->
 -spec iterator_next(iterator()) -> {value, emqx_types:message(), iterator()} | none | {error, _}.
 iterator_next(_Iter) ->
     %% TODO
-    ok.
+    none.
 
 -spec iterator_stats() -> #{}.
 iterator_stats() ->

+ 2 - 2
apps/emqx_durable_storage/src/emqx_durable_storage.app.src

@@ -1,11 +1,11 @@
 %% -*- mode: erlang -*-
-{application, emqx_ds, [
+{application, emqx_durable_storage, [
     {description, "Message persistence and subscription replays for EMQX"},
     % strict semver, bump manually!
     {vsn, "0.1.0"},
     {modules, []},
     {registered, []},
-    {applications, [kernel, stdlib, rocksdb, gproc]},
+    {applications, [kernel, stdlib, rocksdb, gproc, mria]},
     {mod, {emqx_ds_app, []}},
     {env, []}
 ]}.

+ 2 - 2
apps/emqx_durable_storage/test/emqx_ds_storage_layer_SUITE.erl

@@ -255,11 +255,11 @@ parse_topic(Topic) ->
 all() -> emqx_common_test_helpers:all(?MODULE).
 
 init_per_suite(Config) ->
-    {ok, _} = application:ensure_all_started(emqx_ds),
+    {ok, _} = application:ensure_all_started(emqx_durable_storage),
     Config.
 
 end_per_suite(_Config) ->
-    ok = application:stop(emqx_ds).
+    ok = application:stop(emqx_durable_storage).
 
 init_per_testcase(TC, Config) ->
     ok = set_shard_config(shard(TC), ?DEFAULT_CONFIG),

+ 1 - 1
scripts/check-elixir-applications.exs

@@ -1,4 +1,4 @@
-#! /usr/bin/env elixir
+#!/usr/bin/env elixir
 
 defmodule CheckElixirApplications do
   alias EMQXUmbrella.MixProject

+ 1 - 1
scripts/check-elixir-deps-discrepancies.exs

@@ -1,4 +1,4 @@
-#! /usr/bin/env elixir
+#!/usr/bin/env elixir
 
 # ensure we have a fresh rebar.lock
 

+ 1 - 1
scripts/check-elixir-emqx-machine-boot-discrepancies.exs

@@ -1,4 +1,4 @@
-#! /usr/bin/env elixir
+#!/usr/bin/env elixir
 
 defmodule CheckElixirEMQXMachineBootDiscrepancies do
   alias EMQXUmbrella.MixProject