Lux.Company.Hub behaviour (Lux v0.5.0)

View Source

Defines the behaviour for company hubs.

Company hubs manage the registration and discovery of companies. They provide:

  • Company registration and lookup
  • Search functionality
  • Basic company lifecycle management

Summary

Callbacks

Deregisters a company from the hub.

Gets a company by its ID.

Lists all registered companies.

Registers a company in the hub. Accepts either a module implementing the company behavior or a company struct. Returns the unique company ID on success.

Searches for companies based on criteria. Supports searching by name, mission, or other attributes.

Types

company_id()

@type company_id() :: String.t()

company_module()

@type company_module() :: module()

search_opts()

@type search_opts() :: keyword()

Callbacks

deregister_company(company_id, hub)

@callback deregister_company(company_id(), hub :: GenServer.server()) ::
  :ok | {:error, term()}

Deregisters a company from the hub.

get_company(company_id, hub)

@callback get_company(company_id(), hub :: GenServer.server()) ::
  {:ok, Lux.Company.t()} | {:error, term()}

Gets a company by its ID.

list_companies(hub)

@callback list_companies(hub :: GenServer.server()) ::
  {:ok, [Lux.Company.t()]} | {:error, term()}

Lists all registered companies.

register_company(arg1, hub)

@callback register_company(company_module() | Lux.Company.t(), hub :: GenServer.server()) ::
  {:ok, company_id()} | {:error, term()}

Registers a company in the hub. Accepts either a module implementing the company behavior or a company struct. Returns the unique company ID on success.

search_companies(query, hub, opts)

@callback search_companies(
  query :: String.t(),
  hub :: GenServer.server(),
  opts :: search_opts()
) :: {:ok, [Lux.Company.t()]} | {:error, term()}

Searches for companies based on criteria. Supports searching by name, mission, or other attributes.