Raxol.Terminal.Sync.SyncServer (Raxol v2.0.1)

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.

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, process \\ __MODULE__)

Cleans up a synchronization context.

Parameters

  • sync_id - The synchronization context ID

create_sync(type, opts \\ [], process \\ __MODULE__)

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, process \\ __MODULE__)

Gets the current state of a synchronization context.

Parameters

  • sync_id - The synchronization context ID

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

handle_manager_info(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.

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

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(init_opts \\ [])

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

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