Skip to content

Commit

Permalink
MC: Add protocol definitions for CP subsystem mgmt operations (hazelc…
Browse files Browse the repository at this point in the history
…ast#276)

* Add CP subsystem mgmt operations for MC client

* Convert response type of MC.getCPMembers into EntryList_UUID_Address
  • Loading branch information
puzpuzpuz authored and sancar committed Dec 12, 2019
1 parent 5c99661 commit f87a77f
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 1 deletion.
1 change: 1 addition & 0 deletions binary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'EntryList_UUID_Long',
'EntryList_Integer_Long',
'EntryList_Long_byteArray',
'EntryList_UUID_Address',
]

FixedMapTypes = [
Expand Down
9 changes: 9 additions & 0 deletions binary/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ def encode_long_byte_array_entry_list(client_message):
client_message.add_frame(END_FRAME)
FixSizedEncoder.encode_fix_sized_list_frame(client_message, 'long')

@staticmethod
def encode_uuid_address_entry_list(client_message):
client_message.add_frame(BEGIN_FRAME)
CustomTypeEncoder.encode_custom_type(client_message, 'Address')
client_message.add_frame(END_FRAME)
FixSizedEncoder.encode_fix_sized_list_frame(client_message, 'UUID')

@staticmethod
def encoder_for(type):
encoder = VarSizedEncoder.encoders.get(type, None)
Expand All @@ -319,6 +326,7 @@ def encoder_for(type):
'EntryList_Integer_Long': functools.partial(FixSizedEncoder.encode_fix_sized_entry_list_frame,
key_type='int', value_type='long'),
'EntryList_Long_byteArray': VarSizedEncoder.encode_long_byte_array_entry_list,
'EntryList_UUID_Address': VarSizedEncoder.encode_uuid_address_entry_list,
'List_Integer': functools.partial(FixSizedEncoder.encode_fix_sized_list_frame, item_type='int'),
'List_Long': functools.partial(FixSizedEncoder.encode_fix_sized_list_frame, item_type='long'),
'List_UUID': functools.partial(FixSizedEncoder.encode_fix_sized_list_frame, item_type='UUID'),
Expand Down Expand Up @@ -396,6 +404,7 @@ def encoder_for(type):
'EntryList_Long_byteArray': 'aListOfLongToByteArray',
'EntryList_String_EntryList_Integer_Long': 'aListOfStringToListOfIntegerToLong',
'EntryList_Address_List_Integer': 'aListOfAddressToListOfIntegers',
'EntryList_UUID_Address': 'aListOfUUIDToAddress',
'EntryList_Data_Data': 'aListOfDataToData',
'EntryList_Member_List_ScheduledTaskHandler': 'aListOfMemberToListOfScheduledTaskHandlers',
'Map_String_String': 'aMapOfStringToString',
Expand Down
2 changes: 2 additions & 0 deletions java/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def java_types_decode(key):
"EntryList_UUID_Long": "java.util.Collection<java.util.Map.Entry<java.util.UUID, java.lang.Long>>",
"EntryList_String_EntryList_Integer_Long": "java.util.Collection<java.util.Map.Entry<java.lang.String, java.util.List<java.util.Map.Entry<java.lang.Integer, java.lang.Long>>>>",
"EntryList_Address_List_Integer": "java.util.Collection<java.util.Map.Entry<com.hazelcast.cluster.Address, java.util.List<java.lang.Integer>>>",
"EntryList_UUID_Address": "java.util.Collection<java.util.Map.Entry<java.util.UUID, com.hazelcast.cluster.Address>>",
"EntryList_Data_Data": "java.util.Collection<java.util.Map.Entry<com.hazelcast.internal.serialization.Data, com.hazelcast.internal.serialization.Data>>",
"EntryList_Member_List_ScheduledTaskHandler": "java.util.Collection<java.util.Map.Entry<com.hazelcast.cluster.Member, java.util.List<com.hazelcast.scheduledexecutor.ScheduledTaskHandler>>>"
}
Expand Down Expand Up @@ -138,6 +139,7 @@ def java_types_decode(key):
"EntryList_UUID_Long": "java.util.List<java.util.Map.Entry<java.util.UUID, java.lang.Long>>",
"EntryList_String_EntryList_Integer_Long": "java.util.List<java.util.Map.Entry<java.lang.String, java.util.List<java.util.Map.Entry<java.lang.Integer, java.lang.Long>>>>",
"EntryList_Address_List_Integer": "java.util.List<java.util.Map.Entry<com.hazelcast.cluster.Address, java.util.List<java.lang.Integer>>>",
"EntryList_UUID_Address": "java.util.List<java.util.Map.Entry<java.util.UUID, com.hazelcast.cluster.Address>>",
"EntryList_Data_Data": "java.util.List<java.util.Map.Entry<com.hazelcast.internal.serialization.Data, com.hazelcast.internal.serialization.Data>>",
"EntryList_Member_List_ScheduledTaskHandler": "java.util.List<java.util.Map.Entry<com.hazelcast.cluster.Member, java.util.List<com.hazelcast.scheduledexecutor.ScheduledTaskHandler>>>"
}
55 changes: 54 additions & 1 deletion protocol-definitions/MC.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,8 @@ methods:
name: pollMCEvents
since: 2.0
doc: |
Polls events available on member. Once read, events are removed from member's internal queue.
Polls events available on member. Once read, events are removed from
member's internal queue.
request:
retryable: false
partitionIdentifier: -1
Expand All @@ -741,3 +742,55 @@ methods:
since: 2.0
doc: |
List of events.
- id: 25
name: getCPMembers
since: 2.0
doc: |
Returns the current list of CP members.
request:
retryable: true
partitionIdentifier: -1
response:
params:
- name: cpMembers
type: EntryList_UUID_Address
nullable: false
since: 2.0
doc: |
List of CP members
- id: 26
name: promoteToCPMember
since: 2.0
doc: |
Promotes the local member to the CP role.
request:
retryable: false
partitionIdentifier: -1
response: {}
- id: 27
name: removeCPMember
since: 2.0
doc: |
Removes the given unreachable CP member from the active CP members
list and all CP groups it belongs to.
request:
retryable: false
partitionIdentifier: -1
params:
- name: cpMemberUuid
type: UUID
nullable: false
since: 2.0
doc: |
UUID of the unreachable CP member
response: {}
- id: 28
name: resetCPSubsystem
since: 2.0
doc: |
Wipes and resets the whole CP Subsystem state and initializes it
as if the Hazelcast cluster is starting up initially.
request:
retryable: false
partitionIdentifier: -1
response: {}
1 change: 1 addition & 0 deletions schema/custom-codec-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"EntryList_String_EntryList_Integer_Long",
"EntryList_UUID_Long",
"EntryList_Address_List_Integer",
"EntryList_UUID_Address",
"EntryList_Data_Data",
"EntryList_Member_List_ScheduledTaskHandler",
"List_Address",
Expand Down
1 change: 1 addition & 0 deletions schema/protocol-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"EntryList_String_EntryList_Integer_Long",
"EntryList_UUID_Long",
"EntryList_Address_List_Integer",
"EntryList_UUID_Address",
"EntryList_Data_Data",
"EntryList_Member_List_ScheduledTaskHandler",
"List_Address",
Expand Down

0 comments on commit f87a77f

Please sign in to comment.