Packages

The goal of ResourcePool (rsrc_pool_ex) Elixir library is reduce the overhead of creating new resources by reusing of the same resources among multiple processes.

Current section

Files

Jump to
rsrc_pool_ex test factory.ex
Raw

test/factory.ex

defmodule Factory do
@behaviour ResourceFactory
@impl true
def create(_resource_metadata) do
TestResource.create()
end
@impl true
def destroy(_resource_metadata, resource) do
TestResource.stop(resource)
end
@impl true
def validate(_resource_metadata, resource) do
TestResource.valid?(resource)
end
@impl true
def activate(_resource_metadata, resource) do
TestResource.set_active(resource, true)
end
@impl true
def passivate(_resource_metadata, resource) do
TestResource.set_active(resource, false)
end
end