Increase power of ShardResolutionStrategy interface by passing the object itself ...

Description

Interface ShardResolutionStrategy has a single method to determine what the list of shard indexes where an object might be located. Unfortunately, the method is passed only the 1) entity name and 2) the object id that we need to be saved.

I find that this is too limiting. The method should pass the object itself that we need to determine the list of shards. Passing the object itself would give much more programming possibilities.

An example of that is the following: I am persisting a class called User. My shard strategy saves User objects according to their home state. The attribute home state in located in the object itself. We know that the US has 50 states. Some states are much bigger than others. My application has several shards for bigger states. In order to determine the set of shards where a User object might be located, it is critical that I have the home state where the User resides.

SOLUTION: Class ShardResolutionStrategyData should also have a new attribute with the instance of the object for which we want to determine the set of shards where the object might be located.

Environment

None

Status

Assignee

Max Ross

Reporter

Colbert Philippe

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Priority

Major
Configure