emqx_plugins.hrl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2021-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. -ifndef(EMQX_PLUGINS_HRL).
  17. -define(EMQX_PLUGINS_HRL, true).
  18. -define(CONF_ROOT, plugins).
  19. -define(PLUGIN_SERDE_TAB, emqx_plugins_schema_serde_tab).
  20. -define(CONFIG_FORMAT_BIN, config_format_bin).
  21. -define(CONFIG_FORMAT_MAP, config_format_map).
  22. -define(plugin_conf_not_found, plugin_conf_not_found).
  23. -define(plugin_without_config_schema, plugin_without_config_schema).
  24. -type schema_name() :: binary().
  25. -type avsc_path() :: string().
  26. -type encoded_data() :: iodata().
  27. -type decoded_data() :: map().
  28. %% "my_plugin-0.1.0"
  29. -type name_vsn() :: binary() | string().
  30. %% the parse result of the JSON info file
  31. -type plugin_info() :: map().
  32. -type schema_json_map() :: map().
  33. -type i18n_json_map() :: map().
  34. -type raw_plugin_config_content() :: binary().
  35. -type plugin_config_map() :: map().
  36. -type position() :: no_move | front | rear | {before, name_vsn()} | {behind, name_vsn()}.
  37. -record(plugin_schema_serde, {
  38. name :: schema_name(),
  39. eval_context :: term(),
  40. %% TODO: fields to mark schema import status
  41. %% scheam_imported :: boolean(),
  42. %% for future use
  43. extra = []
  44. }).
  45. -type plugin_schema_serde() :: #plugin_schema_serde{}.
  46. -endif.