emqx_plugins.hrl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. -define(fresh_install, fresh_install).
  25. -define(normal, normal).
  26. -type schema_name() :: binary().
  27. -type avsc_path() :: string().
  28. -type encoded_data() :: iodata().
  29. -type decoded_data() :: map().
  30. %% "my_plugin-0.1.0"
  31. -type name_vsn() :: binary() | string().
  32. %% the parse result of the JSON info file
  33. -type plugin_info() :: map().
  34. -type schema_json_map() :: map().
  35. -type i18n_json_map() :: map().
  36. -type raw_plugin_config_content() :: binary().
  37. -type plugin_config_map() :: map().
  38. -type position() :: no_move | front | rear | {before, name_vsn()} | {behind, name_vsn()}.
  39. -record(plugin_schema_serde, {
  40. name :: schema_name(),
  41. eval_context :: term(),
  42. %% TODO: fields to mark schema import status
  43. %% scheam_imported :: boolean(),
  44. %% for future use
  45. extra = []
  46. }).
  47. -type plugin_schema_serde() :: #plugin_schema_serde{}.
  48. -endif.