Object.CoordinationService (object v0.1.2)

Distributed coordination service for multi-object operations. Uses consensus algorithms and conflict resolution for large-scale coordination.

Summary

Functions

Returns a specification to start this module under a supervisor.

Coordinates a task across multiple objects using consensus algorithms.

Gets the current status of a coordination session.

Gets performance metrics for the coordination service.

Adds an object to an existing coordination session.

Removes an object from a coordination session.

Resolves conflicts between objects using configured resolution strategies.

Starts the coordination service GenServer.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

coordinate_objects(object_ids, coordination_task)

Coordinates a task across multiple objects using consensus algorithms.

Parameters

  • object_ids: List of object IDs to coordinate
  • coordination_task: Task specification with type, objectives, and constraints

Returns

{:ok, session_id} with the coordination session identifier

Examples

iex> Object.CoordinationService.coordinate_objects(["obj1", "obj2"], %{type: :optimization})
{:ok, "session_abc123"}

get_coordination_status(session_id)

Gets the current status of a coordination session.

Parameters

  • session_id: ID of the coordination session

Returns

{:ok, status} where status is :voting, :in_progress, :completed, or :failed

get_metrics()

Gets performance metrics for the coordination service.

Returns

Map with metrics including active sessions, completed sessions, and uptime

join_coordination(session_id, object_id)

Adds an object to an existing coordination session.

Parameters

  • session_id: ID of the coordination session
  • object_id: ID of the object to add

Returns

:ok on success, {:error, reason} on failure

leave_coordination(session_id, object_id)

Removes an object from a coordination session.

Parameters

  • session_id: ID of the coordination session
  • object_id: ID of the object to remove

Returns

:ok on success, {:ok, :session_cancelled} if last participant left

resolve_conflict(conflict_context)

Resolves conflicts between objects using configured resolution strategies.

Parameters

  • conflict_context: Context describing the conflict and involved parties

Returns

Resolution result with method and outcome

start_link(_)

Starts the coordination service GenServer.

Returns

{:ok, pid} on successful startup