parent
6e2bec2e20
commit
19af21189a
@ -1,26 +0,0 @@ |
||||
defmodule Explorer.Chain.Import.Stage.AddressReferencing do |
||||
@moduledoc """ |
||||
Imports any tables that reference `t:Explorer.Chain.Address.t/0` and that were imported by |
||||
`Explorer.Chain.Import.Stage.Addresses`. |
||||
""" |
||||
|
||||
alias Explorer.Chain.Import.{Runner, Stage} |
||||
|
||||
@behaviour Stage |
||||
|
||||
@impl Stage |
||||
def runners, |
||||
do: [ |
||||
Runner.Address.CoinBalances, |
||||
Runner.Blocks, |
||||
Runner.Address.CoinBalancesDaily |
||||
] |
||||
|
||||
@impl Stage |
||||
def multis(runner_to_changes_list, options) do |
||||
{final_multi, final_remaining_runner_to_changes_list} = |
||||
Stage.single_multi(runners(), runner_to_changes_list, options) |
||||
|
||||
{[final_multi], final_remaining_runner_to_changes_list} |
||||
end |
||||
end |
@ -1,22 +0,0 @@ |
||||
defmodule Explorer.Chain.Import.Stage.Addresses do |
||||
@moduledoc """ |
||||
Imports addresses before anything else that references them because an unused address is still valid and recoverable |
||||
if the other stage(s) don't commit. |
||||
""" |
||||
|
||||
alias Explorer.Chain.Import.{Runner, Stage} |
||||
|
||||
@behaviour Stage |
||||
|
||||
@runner Runner.Addresses |
||||
|
||||
@impl Stage |
||||
def runners, do: [@runner] |
||||
|
||||
@chunk_size 50 |
||||
|
||||
@impl Stage |
||||
def multis(runner_to_changes_list, options) do |
||||
Stage.chunk_every(runner_to_changes_list, @runner, @chunk_size, options) |
||||
end |
||||
end |
@ -0,0 +1,34 @@ |
||||
defmodule Explorer.Chain.Import.Stage.AddressesBlocksCoinBalances do |
||||
@moduledoc """ |
||||
Import addresses, blocks and balances. |
||||
No tables have foreign key to addresses anymore, so it's possible to import addresses along with them. |
||||
""" |
||||
|
||||
alias Explorer.Chain.Import.{Runner, Stage} |
||||
|
||||
@behaviour Stage |
||||
|
||||
@addresses_runner Runner.Addresses |
||||
|
||||
@rest_runners [ |
||||
Runner.Address.CoinBalances, |
||||
Runner.Blocks, |
||||
Runner.Address.CoinBalancesDaily |
||||
] |
||||
|
||||
@impl Stage |
||||
def runners, do: [@addresses_runner | @rest_runners] |
||||
|
||||
@addresses_chunk_size 50 |
||||
|
||||
@impl Stage |
||||
def multis(runner_to_changes_list, options) do |
||||
{addresses_multis, remaining_runner_to_changes_list} = |
||||
Stage.chunk_every(runner_to_changes_list, Runner.Addresses, @addresses_chunk_size, options) |
||||
|
||||
{final_multi, final_remaining_runner_to_changes_list} = |
||||
Stage.single_multi(@rest_runners, remaining_runner_to_changes_list, options) |
||||
|
||||
{[final_multi | addresses_multis], final_remaining_runner_to_changes_list} |
||||
end |
||||
end |
Loading…
Reference in new issue