Exemplo n.º 1
0
        public virtual KeyValue <K, V> Decode(byte[] Bytes, byte[] SchemaVersion)
        {
            if (_keyValueEncodingType == KeyValueEncodingType.SEPARATED)
            {
                throw new SchemaSerializationException("This method cannot be used under this SEPARATED encoding type");
            }

            return(KeyValue <K, V> .Decode(Bytes, (keyBytes, valueBytes) => Decode(keyBytes, valueBytes, SchemaVersion)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Decode the key/value schema info to get key schema info and value schema info.
        /// </summary>
        /// <param name="schemaInfo"> key/value schema info. </param>
        /// <returns> the pair of key schema info and value schema info </returns>
        public static KeyValue <ISchemaInfo, ISchemaInfo> DecodeKeyValueSchemaInfo(ISchemaInfo SchemaInfo)
        {
            Condition.CheckArgument(SchemaType.KeyValue == SchemaInfo.Type, "Not a KeyValue schema");

            return(KeyValue <ISchemaInfo, ISchemaInfo> .Decode(SchemaInfo.Schema, (keyBytes, valueBytes) =>
            {
                ISchemaInfo KeySchemaInfo = DecodeSubSchemaInfo(SchemaInfo, KEY_SCHEMA_NAME, KEY_SCHEMA_TYPE, KEY_SCHEMA_PROPS, keyBytes);
                ISchemaInfo ValueSchemaInfo = DecodeSubSchemaInfo(SchemaInfo, VALUE_SCHEMA_NAME, VALUE_SCHEMA_TYPE, VALUE_SCHEMA_PROPS, valueBytes);
                return new KeyValue <ISchemaInfo, ISchemaInfo>(KeySchemaInfo, ValueSchemaInfo);
            }));
        }