Fact.Seam.FileReader behaviour (Fact v0.2.1)
View SourceBehaviour defining the contract for reading files within the Fact system.
Implementations of this seam are responsible for reading file contents from a specified path. Different reading strategies or formats can be implemented and swapped transparently (watch out for implicit coupling, it can bite).
Callback
read/3– Reads data from the given path using the configured implementation and options. Returns{:ok, enumerable}on success or{:error, reason}on failure.
Summary
Types
@type t() :: struct()
Callbacks
@callback default_options() :: map()
@callback family() :: atom()
@callback id() :: {atom(), non_neg_integer()}
@callback read(impl :: t(), path :: Path.t(), opts :: keyword()) :: {:ok, Enumerable.t()} | {:error, term()}
@callback version() :: non_neg_integer()