Added getShardIDs
and createMultiCursor
but left listWithMultiCursor
because the function became uglier with that :) But funlen
is fine with this function anyway
Why did you choose to add a method instead of extending a ListWithCursor then?
ListWithCursor
tells the client that shards won't be read concurrently wherever ListWithMultiCursor
tells…
If I say count=5, will it iterate over 5 random shards?
Yes, if len(shards) == 5
. But if count == 5
and len(shards) == 4
, then count
gets 4
. One cursor matches to one shard
As…
Briefly: no way
When I tried many ways to manage reading shards from the policer but nothing succeeded. If ListWithCursor
is used, then shards are re-read few times. We don't need it
Yes, it can. You can check ListWithCursor
implementation that has the same logic.
Also, you can check shardPolicyWorker
to understand the principle of cursor usage
I think it's more natural to return nil
instead &res
in the error case