You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the module shards_dist uses rpc to run distributed calls, and in the specs the case whet rpc returns {badrpc, Reason} is not being considered.
I see two ways to handle this:
Just fix the specs considering this case (specs have to be fixed not only in shards_dist but also in shards, since it is a wrapper on top of it). In this case we can create a type like:
-type rpc_res(R) :: R | {badrpc, Reason :: term()}
In my opinion, I rather receive the {:bad_rpc, error} so I can pattern match against it and handle the different outcomes, such as the example I referenced in #42.
So I vote for solution 1.
I'll close this issue since it doesn't apply anymore, with shards v1 the distributed module shards_dist will be in a separate repo, so by the time there is a first implementation ready, we will keep this in mind.
Currently, the module
shards_dist
usesrpc
to run distributed calls, and in the specs the case whetrpc
returns{badrpc, Reason}
is not being considered.I see two ways to handle this:
shards_dist
but also inshards
, since it is a wrapper on top of it). In this case we can create a type like:And re use it from the the specs, like so:
{badrpc, Reason}
internally and raise an exception with the corresponding error.And reuse the private function
rpc_call/4
internally.Evaluate both alternatives and come up with the best approach.
The text was updated successfully, but these errors were encountered: