-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
map.remove_all is implemented
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import hazelcast | ||
|
||
from hazelcast.predicate import between | ||
|
||
client = hazelcast.HazelcastClient() | ||
|
||
predicate_map = client.get_map("predicate-map").blocking() | ||
|
||
for i in range(10): | ||
predicate_map.put("key" + str(i), i) | ||
|
||
predicate = between("this", 3, 5) | ||
|
||
predicate_map.remove_all(predicate) | ||
|
||
print(predicate_map.values()) | ||
|
||
client.shutdown() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer | ||
from hazelcast.protocol.builtin import StringCodec | ||
from hazelcast.protocol.builtin import DataCodec | ||
|
||
# hex: 0x013E00 | ||
_REQUEST_MESSAGE_TYPE = 81408 | ||
# hex: 0x013E01 | ||
_RESPONSE_MESSAGE_TYPE = 81409 | ||
|
||
_REQUEST_INITIAL_FRAME_SIZE = REQUEST_HEADER_SIZE | ||
|
||
|
||
def encode_request(name, predicate): | ||
buf = create_initial_buffer(_REQUEST_INITIAL_FRAME_SIZE, _REQUEST_MESSAGE_TYPE) | ||
StringCodec.encode(buf, name) | ||
DataCodec.encode(buf, predicate, True) | ||
return OutboundMessage(buf, False) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,6 +495,15 @@ def test_remove(self): | |
self.assertEqual(0, self.map.size()) | ||
self.assertFalse(self.map.contains_key("key")) | ||
|
||
def test_remove_all_with_none_predicate(self): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mdumandag
Contributor
|
||
with self.assertRaises(AssertionError): | ||
self.map.remove_all(None) | ||
|
||
def test_remove_all(self): | ||
self.fill_map() | ||
self.map.remove_all(predicate=sql("__key > 'key-7'")) | ||
self.assertEqual(self.map.size(), 8) | ||
|
||
def test_remove_if_same_when_same(self): | ||
self.map.put("key", "value") | ||
|
||
|
@mdumandag These tests are failing in server compatibility tests. https://github.com/hazelcast/client-compatibility-suites/runs/8247095922?check_suite_focus=true
can you add a version check here in this test ?