ptupitsyn commented on a change in pull request #577: URL: https://github.com/apache/ignite-3/pull/577#discussion_r790449461
########## File path: modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/RecordSerializer.cs ########## @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Internal.Table.Serialization +{ + using System; + using System.Collections.Generic; + using Buffers; + using MessagePack; + + /// <summary> + /// Generic record serializer. + /// Works for tuples and user objects, any differences are handled by the underlying <see cref="IRecordSerializerHandler{T}"/>. + /// </summary> + /// <typeparam name="T">Record type.</typeparam> + internal class RecordSerializer<T> + where T : class + { + /** Table. */ + private readonly Table _table; + + /** Serialization handler. */ + private readonly IRecordSerializerHandler<T> _handler; + + /// <summary> + /// Initializes a new instance of the <see cref="RecordSerializer{T}"/> class. + /// </summary> + /// <param name="table">Table.</param> + /// <param name="handler">Handler.</param> + public RecordSerializer(Table table, IRecordSerializerHandler<T> handler) + { + _table = table; + _handler = handler; + } + + /// <summary> + /// Reads the value part. + /// </summary> + /// <param name="buf">Buffer.</param> + /// <param name="schema">Schema.</param> + /// <param name="key">Key part.</param> + /// <returns>Resulting record with key and value parts.</returns> + public T? ReadValue(PooledBuffer buf, Schema? schema, T key) + { + if (schema == null) + { + return null; + } Review comment: Null schema means null record in our protocol (e.g. key does not exist in `table.get`). I've added comments to clarify this. There is no case of "missing schema". -- 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]
