FileConfig.Loader (file_config v0.7.1)

Copy Markdown View Source

Load files

Summary

Functions

Get just changed files or all based on config

Check for changes to configured files

Returns a specification to start this module under a supervisor.

Get format from extension

Determine if files have changed since last run

Collect multiple files for the same name

Set config defaults

Get latest file or all based on config

List files in dir matching configured file extensions.

Create table if new/update

Whether files have been modified/created since last run

Notify subscribers about updates

Sort files by modification time and set overall latest time

Types

file_config()

@type file_config() :: map()

files()

@type files() :: map()

name()

@type name() :: atom()

state()

@type state() :: map()

table_state()

@type table_state() :: map()

update()

@type update() :: map()

Functions

changed_files?(update, prev)

@spec changed_files?(map(), map()) :: map()

Get just changed files or all based on config

check_files(old_files, state, init \\ false)

Check for changes to configured files

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

create_ets_table(map)

@spec create_ets_table(map()) :: :ets.tab()

delete_tables(tables)

@spec delete_tables([:ets.tab()]) :: :ok

ext_to_format(ext)

@spec ext_to_format(Path.t()) :: atom()

Get format from extension

format_to_handler(ext)

@spec format_to_handler(atom()) :: module()

free_binary_memory()

get_changed_files(new_files, old_files)

@spec get_changed_files(files(), files()) :: files()

Determine if files have changed since last run

get_files(data_dirs, file_configs, init \\ false)

Find files matching pattern.

group_by_name(arg, acc)

@spec group_by_name({Path.t(), map(), map()}, map()) :: map()

Collect multiple files for the same name

init_config(args)

@spec init_config(Keyword.t()) :: {:ok, [file_config()]}

Set config defaults

latest_file?(update)

@spec latest_file?(map()) :: [{Path.t(), map()}]

Get latest file or all based on config

list_files(dir)

@spec list_files(Path.t()) :: [Path.t()]

List files in dir matching configured file extensions.

list_index()

make_table_state(handler, name, update, tab)

@spec make_table_state(module(), name(), map(), :ets.tab()) :: table_state()

maybe_create_table(update)

Create table if new/update

maybe_create_table(mod, config)

@spec maybe_create_table(:calendar.datetime(), map()) :: :ets.tab()

modified?(map)

@spec modified?(map()) :: boolean()

Whether files have been modified/created since last run

modified?(name, update, prev)

@spec modified?(name(), map(), map()) :: boolean()

notify_update(tables)

@spec notify_update([map()]) :: :ok

Notify subscribers about updates

sort_by_mod(arg, acc)

@spec sort_by_mod(
  {name(), update()},
  map()
) :: map()

Sort files by modification time and set overall latest time

start_link(state)

update_table_index(new_tables)

@spec update_table_index([table_state()]) :: [:ets.tab()]