Merge pull request #12000 from savonarola/1122-add-fdb-persistent-implementation
feat(ds): allow fdb implementation for durable storage
This commit is contained in:
commit
61246b4c78
|
@ -62,7 +62,11 @@ storage_backend(#{
|
||||||
storage => {emqx_ds_storage_bitfield_lts, #{}},
|
storage => {emqx_ds_storage_bitfield_lts, #{}},
|
||||||
n_shards => NShards,
|
n_shards => NShards,
|
||||||
replication_factor => ReplicationFactor
|
replication_factor => ReplicationFactor
|
||||||
}.
|
};
|
||||||
|
storage_backend(#{
|
||||||
|
fdb := #{enable := true} = FDBConfig
|
||||||
|
}) ->
|
||||||
|
FDBConfig#{backend => fdb}.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -1781,7 +1781,7 @@ fields("session_storage_backend") ->
|
||||||
desc => ?DESC(session_storage_backend_builtin),
|
desc => ?DESC(session_storage_backend_builtin),
|
||||||
required => {false, recursively}
|
required => {false, recursively}
|
||||||
})}
|
})}
|
||||||
];
|
] ++ emqx_schema_hooks:injection_point('session_persistence.storage_backends', []);
|
||||||
fields("session_storage_backend_builtin") ->
|
fields("session_storage_backend_builtin") ->
|
||||||
[
|
[
|
||||||
{"enable",
|
{"enable",
|
||||||
|
|
|
@ -86,8 +86,14 @@
|
||||||
|
|
||||||
-type message_store_opts() :: #{}.
|
-type message_store_opts() :: #{}.
|
||||||
|
|
||||||
|
-type generic_db_opts() ::
|
||||||
|
#{
|
||||||
|
backend := atom(),
|
||||||
|
_ => _
|
||||||
|
}.
|
||||||
|
|
||||||
-type create_db_opts() ::
|
-type create_db_opts() ::
|
||||||
emqx_ds_replication_layer:builtin_db_opts().
|
emqx_ds_replication_layer:builtin_db_opts() | generic_db_opts().
|
||||||
|
|
||||||
-type message_id() :: emqx_ds_replication_layer:message_id().
|
-type message_id() :: emqx_ds_replication_layer:message_id().
|
||||||
|
|
||||||
|
@ -120,10 +126,11 @@
|
||||||
%% @doc Different DBs are completely independent from each other. They
|
%% @doc Different DBs are completely independent from each other. They
|
||||||
%% could represent something like different tenants.
|
%% could represent something like different tenants.
|
||||||
-spec open_db(db(), create_db_opts()) -> ok.
|
-spec open_db(db(), create_db_opts()) -> ok.
|
||||||
open_db(DB, Opts = #{backend := Backend}) when Backend =:= builtin ->
|
open_db(DB, Opts = #{backend := Backend}) when Backend =:= builtin orelse Backend =:= fdb ->
|
||||||
Module =
|
Module =
|
||||||
case Backend of
|
case Backend of
|
||||||
builtin -> emqx_ds_replication_layer
|
builtin -> emqx_ds_replication_layer;
|
||||||
|
fdb -> emqx_fdb_ds
|
||||||
end,
|
end,
|
||||||
persistent_term:put(?persistent_term(DB), Module),
|
persistent_term:put(?persistent_term(DB), Module),
|
||||||
?module(DB):open_db(DB, Opts).
|
?module(DB):open_db(DB, Opts).
|
||||||
|
|
Loading…
Reference in New Issue