Resource pool v1.0.3 ResourceFactory behaviour View Source

The module defines a behaviour of resource factory.

Link to this section Summary

Callbacks

Some action during activation of a resource before moving the resource from pool to client.

Creates new resource.

Destroyes a resource.

Some action during passivation of a resource after returning the resource from use to pool.

Validate resource: if resource is alive and valid then returns true, otherwise - false.

Link to this section Callbacks

Link to this callback

activate(resource_metadata, resource)

View Source

Specs

activate(resource_metadata :: list(), resource :: pid()) :: :ok

Some action during activation of a resource before moving the resource from pool to client.

Link to this callback

create(resource_metadata)

View Source

Specs

create(resource_metadata :: list()) :: {:ok, term()}

Creates new resource.

Link to this callback

destroy(resource_metadata, resource)

View Source

Specs

destroy(resource_metadata :: list(), resource :: pid()) :: :ok

Destroyes a resource.

Link to this callback

passivate(resource_metadata, resource)

View Source

Specs

passivate(resource_metadata :: list(), resource :: pid()) :: :ok

Some action during passivation of a resource after returning the resource from use to pool.

Link to this callback

validate(resource_metadata, resource)

View Source

Specs

validate(resource_metadata :: list(), resource :: pid()) :: boolean()

Validate resource: if resource is alive and valid then returns true, otherwise - false.