ID | IEP-122 |
Author | |
Sponsor | |
Created |
|
Status | COMPLETED |
Thin clients should be able to call invoke
/invokeAll
cache operations, which now available only for thick clients.
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.
For thin client we can apply the same approach to pass EntryProcessor
as we use for continuous query server-side filters (see IEP-50):
EntryProcessor
should be serialized to BinaryObject
EntryProcessor
's class should be already deployed to the cluster (Deployment of entry processors code to the cluster is out of scope of this IEP)Two new client cache operations are required:
Name | Code |
---|---|
OP_CACHE_INVOKE | 1024 |
OP_CACHE_INVOKE_ALL | 1025 |
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.
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 |
|
The new methods should be added to ClientCache interface:
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; // ... }
// Describe project risks, such as API or binary compatibility issues, major protocol changes, etc.
https://lists.apache.org/thread/qrxmzcg5tvgot1tl2ko5x4qk08t51slf
Key | Summary | T | Created | Updated | Due | Assignee | Reporter | Priority | Priority | Priority | Priority | P | Status | Resolution |
---|