All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tarantool.driver.core.metadata.CRUDResponseToTarantoolSpaceMetadataConverter Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
package io.tarantool.driver.core.metadata;

import io.tarantool.driver.api.metadata.TarantoolSpaceMetadata;
import io.tarantool.driver.mappers.converters.ValueConverter;
import org.msgpack.value.ArrayValue;

/**
 * Populates crud response metadata format to {@link TarantoolSpaceMetadata}.
 * The input data must be consistent with the metadata format from tarantool/crud.
 * See
 * 
 * https://github.com/tarantool/crud#api
 * 
 *
 * @author Artyom Dubinin
 */
public final class CRUDResponseToTarantoolSpaceMetadataConverter
    implements ValueConverter {

    private static final CRUDResponseToTarantoolSpaceMetadataConverter instance =
        new CRUDResponseToTarantoolSpaceMetadataConverter();

    private static final ArrayValueToSpaceFormatConverter arrayValueToSpaceFormatConverter
        = ArrayValueToSpaceFormatConverter.getInstance();

    private CRUDResponseToTarantoolSpaceMetadataConverter() {
    }

    public TarantoolSpaceMetadata fromValue(ArrayValue metadata) {
        TarantoolSpaceMetadataImpl spaceMetadata = new TarantoolSpaceMetadataImpl();
        spaceMetadata.setSpaceFormatMetadata(arrayValueToSpaceFormatConverter.fromValue(metadata));
        return spaceMetadata;
    }

    public static CRUDResponseToTarantoolSpaceMetadataConverter getInstance() {
        return instance;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy