Sentix v1.0.3 Sentix.Bridge
This module provides the bridge between Sentix and fswatch
, via an Erlang
port. This is where any translation will be done in order to handle the types
of communication between the port and the program.
Summary
Functions
Converts an event name between the Sentix representation and the fswatch
representation
Similar to convert_name/1
but with the ability to enforce a type
Returns the separator for use when splitting fswatch events
Locates the port driver for the current toolchain
Opens a bridged port to fswatch
, using the provided paths and options
Functions
Converts an event name between the Sentix representation and the fswatch
representation.
The conversion technique used is determined by the type of the passed in event,
as atoms are converted to fswatch
style, and binaries are converted to Sentix
style.
convert_name(event :: atom | binary, style :: binary) :: event :: binary | atom
Similar to convert_name/1
but with the ability to enforce a type.
This means that we can safely no-op if we already have the style of name we want.
Locates the port driver for the current toolchain.
This is done via a wildcard search, as the name of the port is not deterministic due to the upstream naming incorrectly. We simply fetch a wildcard of ports and find the first one which contains the current osname in the directory name.
open(paths :: [binary], options :: Keyword.t) :: {:ok, pid, process :: number} | {:error, reason :: atom} | {:error, reason :: binary}
Opens a bridged port to fswatch
, using the provided paths and options.
We listen on stdout
from fswatch
so that we may forward the output to any
subscribers. In addition, we monitor the port to ensure that any host server
will crash if the port does, allowing Supervision trees to restart the ports.
The options available are described in Sentix.start_link/3
, so please view
documentation there for further information.