<commit_before>%%%-------------------------------------------------------------------
%%% @author <NAME> <<EMAIL>>
%%% @doc Stores all types in the schema.
%%%
%%% The module allows to access all types in uniform way by using
%%% their full names. After a type was successfully placed into
%%% the store all its name parts are resolved so that no further
%%% actions to work with names are needed.
%%%
%%% When type is added to the store all its children named types are
%%% extracted and stored as separate types as well. Their placeholders
%%% in the original type are replaced by their full names. The types
%%% itself keep their full names in 'name' field and empty strings
%%% in 'namespace'.
%%%
%%% Error will be thrown when name conflict is detected during type
%%% addition.
%%% @end
%%%-------------------------------------------------------------------
-module(avro_schema_store).

%% API
-export([ new/0
        , new/1
        , close/1
        , add_type/2
        , lookup_type/2
        , lookup_type_json/2
        , fold/3
        ]).

-include("erlavro.hrl").

-opaque store() :: ets:tid().

-define(ETS_TABLE_NAME, ?MODULE).

%%%===================================================================
%%% API
%%%===================================================================

-spec new() -> store().

new() ->
  new([]).

%% Options:
%%   {access, public|protected|private} - has same meaning as access
%%     mode in ets:new and defines what processes can have access to<commit_msg>fix compiler warning about unexported opaque type<commit_after>%%%-------------------------------------------------------------------
%%% @author <NAME> <<EMAIL>>
%%% @doc Stores all types in the schema.
%%%
%%% The module allows to access all types in uniform way by using
%%% their full names. After a type was successfully placed into
%%% the store all its name parts are resolved so that no further
%%% actions to work with names are needed.
%%%
%%% When type is added to the store all its children named types are
%%% extracted and stored as separate types as well. Their placeholders
%%% in the original type are replaced by their full names. The types
%%% itself keep their full names in 'name' field and empty strings
%%% in 'namespace'.
%%%
%%% Error will be thrown when name conflict is detected during type
%%% addition.
%%% @end
%%%-------------------------------------------------------------------
-module(avro_schema_store).

%% API
-export([ new/0
        , new/1
        , close/1
        , add_type/2
        , lookup_type/2
        , lookup_type_json/2
        , fold/3
        ]).

-include("erlavro.hrl").

-opaque store() :: ets:tid().

-export_type([store/0]).

-define(ETS_TABLE_NAME, ?MODULE).

%%%===================================================================
%%% API
%%%===================================================================

-spec new() -> store().

new() ->
  new([]).

%% Options:
%%   {access, public|protected|private} - has same meaning as access
%%     mode in ets:new and defines what processes can have access to
{'fraction_non_alphanumeric': 0.28566775244299675, 'fraction_numerical': 0.004885993485342019, 'mean_word_length': 2.5543981481481484, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5254587', 'n_tokens_mistral': 798, 'n_tokens_neox': 773, 'n_words': 314}