Raxol.Core.Runtime.Plugins.FileWatcher.Behaviour behaviour (Raxol v0.3.0)

View Source

Defines the behaviour for file watching functionality in the plugin system.

This behaviour is responsible for:

  • Setting up file system watchers
  • Handling file change events
  • Managing file paths and reverse mappings
  • Debouncing file events
  • Triggering plugin reloads

Summary

Callbacks

Cleans up file watching resources.

Handles debounced file events. Returns updated state after processing events.

Handles file system events. Returns updated state with debounced reload timer if needed.

Sets up file watching for plugin source files. Returns the updated state with the file watcher PID.

Updates the reverse path mapping for file watching.

Callbacks

cleanup_file_watching(state)

@callback cleanup_file_watching(state :: map()) :: map()

Cleans up file watching resources.

handle_debounced_events(state)

@callback handle_debounced_events(state :: map()) :: {:ok, map()} | {:error, any()}

Handles debounced file events. Returns updated state after processing events.

handle_file_event(path, state)

@callback handle_file_event(path :: String.t(), state :: map()) ::
  {:ok, map()} | {:error, any()}

Handles file system events. Returns updated state with debounced reload timer if needed.

setup_file_watching(state)

@callback setup_file_watching(state :: map()) :: {pid() | nil, boolean()}

Sets up file watching for plugin source files. Returns the updated state with the file watcher PID.

update_file_watcher(state)

@callback update_file_watcher(state :: map()) :: map()

Updates the reverse path mapping for file watching.