emqx_schema_registry.hrl 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2023-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%--------------------------------------------------------------------
  4. -ifndef(EMQX_SCHEMA_REGISTRY_HRL).
  5. -define(EMQX_SCHEMA_REGISTRY_HRL, true).
  6. -define(CONF_KEY_ROOT, schema_registry).
  7. -define(CONF_KEY_PATH, [?CONF_KEY_ROOT]).
  8. %% Note: this has the `_ee_' segment for backwards compatibility.
  9. -define(SCHEMA_REGISTRY_SHARD, emqx_ee_schema_registry_shard).
  10. -define(PROTOBUF_CACHE_TAB, emqx_ee_schema_registry_protobuf_cache_tab).
  11. %% ETS table for serde build results.
  12. -define(SERDE_TAB, emqx_schema_registry_serde_tab).
  13. -define(EMQX_SCHEMA_REGISTRY_SPARKPLUGB_SCHEMA_NAME,
  14. <<"__CiYAWBja87PleCyKZ58h__SparkPlug_B_BUILT-IN">>
  15. ).
  16. -type schema_name() :: binary().
  17. -type schema_source() :: binary().
  18. -type serde_args() :: list().
  19. -type encoded_data() :: iodata().
  20. -type decoded_data() :: map().
  21. -type serde_type() :: avro | protobuf | json.
  22. -type serde_opts() :: map().
  23. -record(serde, {
  24. name :: schema_name(),
  25. type :: serde_type(),
  26. eval_context :: term(),
  27. %% for future use
  28. extra = []
  29. }).
  30. -type serde() :: #serde{}.
  31. -record(protobuf_cache, {
  32. fingerprint,
  33. module,
  34. module_binary
  35. }).
  36. -type protobuf_cache() :: #protobuf_cache{
  37. fingerprint :: binary(),
  38. module :: module(),
  39. module_binary :: binary()
  40. }.
  41. -endif.