EctoSharding v0.0.6 EctoSharding View Source
EctoSharding ShardRegistry and Repo supervisor.
This is the supervisor that will supervise the internal shard registry and
build and supervise the ecto repo for each shard specified in the configuration.
Before start_link
is called all of the shard configuration must be present in
the ecto_sharding
application env. In otherwords,
Application.get_env(:ecto_sharding, Ecto.Sharding)
must return all of the
configured shards.
This also provides the only public API to the shard registry that consumers should need to interact with, which allows for setting the current shard and retriving the correct repo for the current shard.
Link to this section Summary
Functions
Get the repo based on the current shard
Get the currently set shard
Set the current shard to be used for all queries including sharded schemas
Get the repo corresponding to the give shard
Start the sharding supervisor
Link to this section Types
The identifier for a shard repo.
This will be used to store and lookup each shard repo. It currently only allows
integers or strings, but in the future it may support anything that implements
String.Chars
protocol.
Link to this section Functions
Get the repo based on the current shard.
Get the currently set shard.
Set the current shard to be used for all queries including sharded schemas.
repo_for_shard(shard) :: EctoSharding.Repo.t
Get the repo corresponding to the give shard.
Start the sharding supervisor.