Raxol.Terminal.Sync.UnifiedSync (Raxol v0.5.0)

View Source

Unified synchronization system for the Raxol terminal emulator. This module provides centralized synchronization mechanisms for:

  • State synchronization between windows
  • Event synchronization
  • Resource synchronization

Summary

Functions

Returns a specification to start this module under a supervisor.

Cleans up a synchronization context.

Creates a new synchronization context.

Gets the current state of a synchronization context.

Resolves conflicts between synchronized data.

Starts the unified synchronization manager.

Synchronizes data between windows.

Types

sync_config()

@type sync_config() :: %{
  consistency: :strong | :eventual,
  conflict_resolution: :last_write_wins | :version_based | :custom,
  timeout: non_neg_integer(),
  retry_count: non_neg_integer()
}

sync_id()

@type sync_id() :: term()

sync_state()

@type sync_state() :: %{
  id: sync_id(),
  type: :state | :event | :resource,
  data: term(),
  version: non_neg_integer(),
  timestamp: integer(),
  metadata: map()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup(sync_id)

Cleans up a synchronization context.

Parameters

  • sync_id - The synchronization context ID

create_sync(type, opts \\ [])

Creates a new synchronization context.

Parameters

  • type - Type of synchronization (:state, :event, or :resource)
  • opts - Creation options
    • :consistency - Consistency level
    • :conflict_resolution - Conflict resolution strategy
    • :timeout - Synchronization timeout
    • :retry_count - Number of retry attempts

get_sync_state(sync_id)

Gets the current state of a synchronization context.

Parameters

  • sync_id - The synchronization context ID

resolve_conflicts(sync_id, conflicts, opts \\ [])

Resolves conflicts between synchronized data.

Parameters

  • sync_id - The synchronization context ID
  • conflicts - List of conflicting versions
  • opts - Resolution options
    • :strategy - Override the default conflict resolution strategy

start_link(opts \\ [])

Starts the unified synchronization manager.

Options

  • :consistency - Default consistency level (:strong or :eventual)
  • :conflict_resolution - Default conflict resolution strategy
  • :timeout - Default synchronization timeout in milliseconds
  • :retry_count - Default number of retry attempts

sync(sync_id, data, opts \\ [])

Synchronizes data between windows.

Parameters

  • sync_id - The synchronization context ID
  • data - The data to synchronize
  • opts - Synchronization options
    • :version - Current version of the data
    • :metadata - Additional metadata