EctoDBScanner.RepoRef (EctoDBScanner v0.5.0)

Copy Markdown View Source

A reference to a running repo instance: the repo module plus the pid of a dynamically started (unnamed) instance.

EctoDBScanner.scan/1 starts EctoDBScanner.Repo with name: nil so that concurrent scans never collide on a registered process name. Because Ecto.Repo.put_dynamic_repo/1 is process-local, every process that runs queries — each Reactor step as well as any task it spawns — must call bind/1 before making module-style repo calls (repo.all/1, etc.).

Summary

Functions

Binds the referenced repo instance to the current process and returns the repo module, ready for module-style calls.

Builds a reference to the repo module backed by the instance at pid.

Types

t()

@type t() :: %EctoDBScanner.RepoRef{module: module(), pid: pid() | nil}

Functions

bind(module)

Binds the referenced repo instance to the current process and returns the repo module, ready for module-style calls.

A bare repo module is also accepted (and returned as-is) for callers that run the scanner against a conventionally named repo, such as the test suite's TestRepo.

new(module, pid \\ nil)

Builds a reference to the repo module backed by the instance at pid.