hazelcast / hazelcast/hazelcast-python-client

Update Serializers (ArrayListSerializer, LinkedListSerializer and others) [API-1114]

Aperta
#522 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Estimation: M Source: Internal to-jira Type: Defect
Lingua principale
Python
Stelle
116
Fork
78
Merge medio
10g 22h
PR unite (30g)
1

Descrizione

Right now some serializers like ArrayListSerializer and LinkedListSerializer(maybe even more) are out of date. We were using NULL_ARRAY_LENGTH in serialization of these before 2019. It is changed in this pr: https://github.com/hazelcast/hazelcast/pull/15371/files

The ArrayListSerializer for example, never encounters with "None" input, since null has its own serializer. So there is an unnecessary check in the serializer.

```py
class ArrayListSerializer(BaseSerializer):
def read(self, inp):
size = inp.read_int()
if size > NULL_ARRAY_LENGTH:
return [inp.read_object() for _ in range(0, size)]
return None

def write(self, out, obj):
size = NULL_ARRAY_LENGTH if obj is None else len(obj)
out.write_int(size)
for i in range(0, size):
out.write_object(obj[i])

def get_type_id(self):
return JAVA_DEFAULT_TYPE_ARRAY_LIST
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by locating ArrayListSerializer, LinkedListSerializer, and other collection serializers, then compare their NULL_ARRAY_LENGTH handling with the changes in PR #15371. Determine which serializers are outdated and update them consistently; done means their serialization behavior matches the newer protocol expectations and the unnecessary None handling is removed where applicable.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
distributed-systems
Tipo di issue
Refactoring
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.