View Source Playwright.SDK.Channel.Catalog (playwright v1.44.0-alpha.4)

Provides storage and management of ChannelOwner instances.

Catalog implements GenServer to maintain state, while domain logic is expected to be handled within caller modules such as Playwright.SDK.Channel.

Summary

Functions

Returns a specification to start this module under a supervisor.

Retrieves a resource from the Catalog by its param: guid.

Returns a List of resources matching the provided "filter".

Adds a resource to the Catalog, keyed on :guid.

Removes a resource from the Catalog, along with its legacy.

Starts a Playwright.SDK.Channel.Catalog linked to the current process with the given "root" resource.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get(catalog, guid, options \\ %{})

View Source
@spec get(pid(), binary(), map()) ::
  struct() | {:error, Playwright.SDK.Channel.Error.t()}

Retrieves a resource from the Catalog by its param: guid.

If the resource is already present in the Catalog that resource is returned directly. The desired resource might not yet be in the Catalog, in which case the request will be considered as "awaiting". An awaiting request will later receive a response, when the Catalog entry is made, or will time out.

Returns

  • resource
  • {:error, error}

Arguments

key/nametypedescription
catalogparampid()PID for the Catalog server
guidparambinary()GUID to look up
:timeoutoptionfloat()Maximum time to wait, in milliseconds. Defaults to 30_000 (30 seconds).
@spec list(pid(), map()) :: [struct()]

Returns a List of resources matching the provided "filter".

Returns

  • [resource]
  • []

Arguments

key/nametypedescription
catalogparampid()PID for the Catalog server
filterparammap()Attributes for filtering
@spec put(
  pid(),
  struct()
) :: struct()

Adds a resource to the Catalog, keyed on :guid.

Returns

  • resource (the same as provided)

Arguments

key/nametypedescription
catalogparampid()PID for the Catalog server
resourceparamstruct()The resource to store
@spec rm_r(pid(), binary()) :: :ok

Removes a resource from the Catalog, along with its legacy.

Returns

  • :ok

Arguments

key/nametypedescription
catalogparampid()PID for the Catalog server
guidparambinary()GUID for the "parent"
@spec start_link(map()) :: {:ok, pid()}

Starts a Playwright.SDK.Channel.Catalog linked to the current process with the given "root" resource.

Return Values

If the Catalog is successfully created and initialized, the function returns {:ok, pid}, where pid is the PID of the running Catalog server.

Arguments

key/nametypedescription
rootparammap()The root resource for items in the Catalog. Provides the Session for its descendants