VMware GemFire Native Client C++ API Reference
|
VMware VMware GemFire Native C++ Reference 10.4.3
|
Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.
More...
#include <PartitionResolver.hpp>
Inherited by apache::geode::client::FixedPartitionResolver, and apache::geode::client::StringPrefixPartitionResolver.
Public Member Functions | |
| virtual const std::string & | getName () |
| Returns the name of the PartitionResolver. | |
| virtual std::shared_ptr< CacheableKey > | getRoutingObject (const EntryEvent &opDetails)=0 |
| virtual | ~PartitionResolver () |
| public methods | |
Protected Member Functions | |
| PartitionResolver () | |
| constructors | |
Detailed Description
Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.
The Key class or callback arg can implement the PartitionResolver interface to enable custom partitioning, or you can configure your own PartitionResolver class in partition attributes (for instance when the Key is a primitive type or String):
- Implement the appropriate equals. For all implementations, you need to be sure to code the class equals method so it properly verifies equality for the PartitionResolver implementation. This might mean verifying that class names are the same or that the returned routing objects are the same etc. When you initiate the partitioned region on multiple nodes, Geode uses the equals method to ensure you are using the same PartitionResolver implementation for all of the nodes for the region.
- Geode uses the routing object's hashCode to determine where the data is being managed. Say, for example, you want to colocate all Trades by month and year. The key is implemented by a TradeKey class which also implements the PartitionResolver interface:
In the example above, all trade entries with the same month and year are guaranteed to be colocated.
Constructor & Destructor Documentation
◆ ~PartitionResolver()
|
virtual |
public methods
destructor
◆ PartitionResolver()
|
protected |
constructors
Member Function Documentation
◆ getName()
|
virtual |
Returns the name of the PartitionResolver.
- Returns
- String name
Reimplemented in apache::geode::client::StringPrefixPartitionResolver.
◆ getRoutingObject()
|
pure virtual |
- Parameters
-
opDetails the detail of the entry event
- Exceptions
-
RuntimeException - any exception thrown will terminate the operation and the exception will be passed to the calling thread.
- Returns
- object associated with entry event which allows the Partitioned Region to store associated data together
Implemented in apache::geode::client::StringPrefixPartitionResolver.
Apache Geode C++ Cache API Documentation