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

io.tarantool.driver.api.space.options.proxy.ProxyReplaceManyOptions 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.api.space.options.proxy;

import io.tarantool.driver.api.space.options.BaseOptions;
import io.tarantool.driver.api.space.options.ReplaceManyOptions;

import java.util.Optional;

/**
 * Represent options for replace_many cluster proxy operation
 *
 * @author Alexey Kuzin
 */
public final class ProxyReplaceManyOptions extends BaseOptions
    implements ReplaceManyOptions {

    public static final String ROLLBACK_ON_ERROR = "rollback_on_error";
    public static final String STOP_ON_ERROR = "stop_on_error";

    private ProxyReplaceManyOptions() {
    }

    /**
     * Create new instance.
     *
     * @return new options instance
     */
    public static ProxyReplaceManyOptions create() {
        return new ProxyReplaceManyOptions();
    }

    /**
     * Specifies whether to not save any changes in the space if any tuple replace operation
     * is unsuccesful. Default value is true.
     *
     * @param rollbackOnError should rollback batch on error
     * @return this options instance
     */
    public ProxyReplaceManyOptions withRollbackOnError(boolean rollbackOnError) {
        addOption(ROLLBACK_ON_ERROR, rollbackOnError);
        return self();
    }

    /**
     * Specifies whether to not try to replace more tuples into the space if any tuple replace
     * operation is unsuccesful. Default value is true.
     *
     * @param stopOnError should stop batch on error
     * @return this options instance
     */
    public ProxyReplaceManyOptions withStopOnError(boolean stopOnError) {
        addOption(STOP_ON_ERROR, stopOnError);
        return self();
    }

    @Override
    public ProxyReplaceManyOptions self() {
        return this;
    }

    @Override
    public Optional getRollbackOnError() {
        return getOption(ROLLBACK_ON_ERROR, Boolean.class);
    }

    @Override
    public Optional getStopOnError() {
        return getOption(STOP_ON_ERROR, Boolean.class);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy