...
| ID | IEP-122 |
| Author | |
| Sponsor | |
| Created | |
| Status | |
Motivation
Thin clients should be able to call invoke/invokeAll cache operations, which now available only for thick clients.
Description
Operations invoke [1] and invokeAll [2] are specified by JCache (JSR-107), these operations Invoke an EntryProcessor against Cache.Entry's specified by the provided key/keys.
...
EntryProcessor should be serialized to BinaryObjectEntryProcessor's class should be already deployed to the cluster (Deployment of entry processors code to the cluster is out of scope of this IEP)
Protocol changes
Operation codes
Two new client cache operations are required:
Name | Code |
|---|
| OP_CACHE_INVOKE | 1024 |
| OP_CACHE_INVOKE_ALL | 1025 |
OP_CACHE_INVOKE message format
| Request |
|---|
| int | Cache Id |
| byte | Flags: standard cache flags, see ClientCacheRequest. Only KEEP_BINARY is applicable. When KEEP_BINARY is set, the entry processor should receive key/val in binary form. |
| BinaryObject | Entry processor |
| byte | Entry processor platform (see ClientPlatform class, 1 = Java) |
| int | Entry processor argument count |
| (Object) * count | Entry processor arguments |
| Response |
|---|
| Object | Result, returned by entry processor |
In case of such response we need some new error code to distinguish entry processor exceptions and and general client/server exceptions.
Alternatively, we can slightly extend response format (also for similarity with OP_CACHE_INVOKE_ALL response):
| Response |
|---|
| boolean | Success flag |
| Object | Result, returned by entry processor, or error message in case of failure |
In this case introduction of the new error code is not required, entry processor exceptions will be indicated by success flag = false, and general client/server exceptions will be handled by response header flag and error code.
OP_CACHE_INVOKE_ALL message format
| Request |
|---|
| int | Cache Id |
| byte | Flags: standard cache flags, see ClientCacheRequest. Only KEEP_BINARY is applicable. When KEEP_BINARY is set, the entry processor should receive key/val in binary form. |
| int | Keys count |
| (Object) * count | Keys |
| BinaryObject | Entry processor |
| byte | Entry processor platform (see ClientPlatform class, 1 = Java) |
| int | Entry processor argument count |
| (Object) * count | Entry processor arguments |
| Response |
|---|
| int | Count of entry processor results |
| (EntryProcessorResult) * count |
| Object | Key | | boolean | Success flag | | Object | Result, returned by entry processor, or error message in case of failure |
|
Client-side API (java thin client)
The new methods should be added to ClientCache interface:
| Code Block |
|---|
| language | java |
|---|
| title | ClientCache |
|---|
|
public interface ClientCache<K, V> {
// ...
public <T> T invoke(
K key,
EntryProcessor<K, V, T> entryProc,
Object... arguments
) throws EntryProcessorException, ClientException;
public <T> IgniteClientFuture<T> invokeAsync(
K key,
EntryProcessor<K, V, T> entryProc,
Object... arguments
) throws ClientException;
public <T> Map<K, EntryProcessorResult<T>> invokeAll(
Set<? extends K> keys,
EntryProcessor<K, V, T> entryProc,
Object... args
) throws ClientException;
public <T> IgniteClientFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(
Set<? extends K> keys,
EntryProcessor<K, V, T> entryProc,
Object... args
) throws ClientException;
// ...
} |
Risks and Assumptions
// Describe project risks, such as API or binary compatibility issues, major protocol changes, etc.
Discussion Links
https:// Links to discussions on the devlist, if applicable.lists.apache.org/thread/qrxmzcg5tvgot1tl2ko5x4qk08t51slf
Reference Links
[1]
JCache invoke javadoc[2]
JCache invokeAll javadocTickets
| Jira |
|---|
| server | ASF JIRA |
|---|
| columnIds | issuekey,summary,issuetype,created,updated,duedate,assignee,reporter,customfield_12311032,customfield_12311037,customfield_12311022,customfield_12311027,priority,status,resolution |
|---|
| columns | key,summary,type,created,updated,due,assignee,reporter,Priority,Priority,Priority,Priority,priority,status,resolution |
|---|
| maximumIssues | 20 |
|---|
| jqlQuery | project = Ignite AND labels IN (iep-122) ORDER BY status |
|---|
| serverId | 5aa69414-a9e9-3523-82ec-879b028fb15b |
|---|
|