Sentix v1.0.1 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

Opens a bridged port to fswatch, using the provided paths and options

Functions

convert_name(event)

Specs

convert_name(event :: atom | binary) :: event :: binary | atom

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, arg2)

Specs

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.

open(paths, options \\ [])

Specs

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.