Skip to content

Commit

Permalink
fixed network deserializer for avoid to mark records dirty during des…
Browse files Browse the repository at this point in the history
…erialization
  • Loading branch information
tglman committed Jul 9, 2019
1 parent 2c8e016 commit 55820bb
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void deserialize(final ODocument document, final BytesContainer bytes) {
if (ODocumentInternal.rawContainsField(document, fieldName)) {
continue;
}
document.setProperty(fieldName,value,type);
ODocumentInternal.rawField(document, fieldName, value, type);
}

ORecordInternal.clearSource(document);
Expand Down Expand Up @@ -421,7 +421,8 @@ private byte[] readBinary(BytesContainer bytes) {

private Map<Object, OIdentifiable> readLinkMap(final BytesContainer bytes, final ODocument document) {
int size = OVarIntSerializer.readAsInteger(bytes);
Map<Object, OIdentifiable> result = new ORecordLazyMap(document);
ORecordLazyMap result = new ORecordLazyMap(document);
result.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING);
while ((size--) > 0) {
OType keyType = readOType(bytes);
Object key = deserializeValue(bytes, keyType, document);
Expand All @@ -431,12 +432,15 @@ private Map<Object, OIdentifiable> readLinkMap(final BytesContainer bytes, final
else
result.put(key, value);
}
result.setInternalStatus(ORecordElement.STATUS.LOADED);

return result;
}

private Object readEmbeddedMap(final BytesContainer bytes, final ODocument document) {
int size = OVarIntSerializer.readAsInteger(bytes);
final Map<Object, Object> result = new OTrackedMap<Object>(document);
final OTrackedMap result = new OTrackedMap<Object>(document);
result.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING);
while ((size--) > 0) {
String key = readString(bytes);
OType valType = readOType(bytes);
Expand All @@ -446,10 +450,12 @@ private Object readEmbeddedMap(final BytesContainer bytes, final ODocument docum
}
result.put(key, value);
}
result.setInternalStatus(ORecordElement.STATUS.LOADED);
return result;
}

private Collection<OIdentifiable> readLinkCollection(BytesContainer bytes, Collection<OIdentifiable> found) {
((ORecordElement) found).setInternalStatus(ORecordElement.STATUS.UNMARSHALLING);
final int items = OVarIntSerializer.readAsInteger(bytes);
for (int i = 0; i < items; i++) {
OIdentifiable id = readOptimizedLink(bytes);
Expand All @@ -458,6 +464,7 @@ private Collection<OIdentifiable> readLinkCollection(BytesContainer bytes, Colle
else
found.add(id);
}
((ORecordElement) found).setInternalStatus(ORecordElement.STATUS.LOADED);
return found;
}

Expand All @@ -473,17 +480,17 @@ private OIdentifiable readOptimizedLink(final BytesContainer bytes) {

private Collection<?> readEmbeddedCollection(final BytesContainer bytes, final Collection<Object> found,
final ODocument document) {
((ORecordElement) found).setInternalStatus(ORecordElement.STATUS.UNMARSHALLING);
final int items = OVarIntSerializer.readAsInteger(bytes);

for (int i = 0; i < items; i++) {
OType itemType = readOType(bytes);
if (itemType == null)
found.add(null);
else
found.add(deserializeValue(bytes, itemType, document));
}
((ORecordElement) found).setInternalStatus(ORecordElement.STATUS.LOADED);
return found;

}

private OType getLinkedType(ODocument document, OType type, String key) {
Expand Down

0 comments on commit 55820bb

Please sign in to comment.