shishkovilja commented on code in PR #12424:
URL: https://github.com/apache/ignite/pull/12424#discussion_r2456294243


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateAdapter.java:
##########
@@ -50,37 +75,122 @@ public abstract class CacheEntryPredicateAdapter 
implements CacheEntryPredicate
 
     /** {@inheritDoc} */
     @Override public short directType() {
-        assert false : this;
+        return 98;
+    }
 
-        return 0;
+    /** */
+    public PredicateType type() {
+        return type;
+    }
+
+    /**
+     * @param entry Entry.
+     * @return Value.
+     */
+    @Nullable protected CacheObject peekVisibleValue(GridCacheEntryEx entry) {
+        return locked ? entry.rawGet() : entry.peekVisibleValue();
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
+    @Override public boolean apply(GridCacheEntryEx e) {
+        switch (type) {
+            case VALUE: {
+                CacheObject val = peekVisibleValue(e);
+
+                if (this.val == null && val == null)
+                    return true;
+
+                if (this.val == null || val == null)
+                    return false;
+
+                GridCacheContext<?, ?> cctx = e.context();
 
-        return true;
+                if (this.val instanceof BinaryObject && val instanceof 
BinaryObject)
+                    return Objects.equals(val, this.val);
+
+                Object thisVal = CU.value(this.val, cctx, false);
+                Object cacheVal = CU.value(val, cctx, false);
+
+                if (thisVal.getClass().isArray())
+                    return Objects.deepEquals(thisVal, cacheVal);
+
+                return Objects.equals(thisVal, cacheVal);
+            }
+
+            case HAS_VALUE:
+                return peekVisibleValue(e) != null;
+
+            case HAS_NO_VALUE:
+                return peekVisibleValue(e) == null;
+
+            case ALWAYS_FALSE:
+                return false;
+        }
+
+        throw new IllegalStateException("Unknown cache entry predicate type: " 
+ type);
     }
 
     /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
+    @Override public void finishUnmarshal(GridCacheContext ctx, ClassLoader 
ldr) throws IgniteCheckedException {
+        if (type == PredicateType.VALUE)
+            val.finishUnmarshal(ctx.cacheObjectContext(), ldr);
+    }
 
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType()))
-                return false;
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheContext ctx) throws 
IgniteCheckedException {
+        if (type == PredicateType.VALUE)
+            val.prepareMarshal(ctx.cacheObjectContext());
+    }
+
+    /** */
+    public @Nullable CacheObject val() {

Review Comment:
   ```suggestion
       public @Nullable CacheObject value() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to