Attached.Processors.MetadataExtractors.Behaviour behaviour (Attached v0.1.1)

Copy Markdown View Source

Behaviour contract for extractors that pull metadata from uploaded files.

Implementations are dispatched by Attached.Processors.MetadataExtractors.

Summary

Callbacks

Returns true if this extractor can handle the given content type.

Returns true if this extractor's runtime dependencies are present (NIF compiled, CLI tool on PATH, etc.). Unavailable extractors are skipped by the dispatcher, so the next one in the list can try.

Returns a short, actionable string explaining how to satisfy this extractor's runtime dependencies — hex deps to add, system packages to install, binaries to provide on PATH.

Extract metadata from the file at input_path. Returns a map of metadata to be merged into original.metadata.

Callbacks

accept?(content_type)

@callback accept?(content_type :: String.t()) :: boolean()

Returns true if this extractor can handle the given content type.

available?()

@callback available?() :: boolean()

Returns true if this extractor's runtime dependencies are present (NIF compiled, CLI tool on PATH, etc.). Unavailable extractors are skipped by the dispatcher, so the next one in the list can try.

install_hint()

@callback install_hint() :: String.t()

Returns a short, actionable string explaining how to satisfy this extractor's runtime dependencies — hex deps to add, system packages to install, binaries to provide on PATH.

Shown in the dashboard for every extractor (not only unavailable ones) so operators can use the list as an install checklist.

metadata(input_path)

@callback metadata(input_path :: String.t()) :: map()

Extract metadata from the file at input_path. Returns a map of metadata to be merged into original.metadata.