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

io.tarantool.driver.api.space.options.proxy.ProxyInsertManyOptions 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.InsertManyOptions;
import io.tarantool.driver.api.space.options.BaseOptions;

import java.util.Optional;

/**
 * Represent options for insert_many cluster proxy operation
 *
 * @author Alexey Kuzin
 */
public final class ProxyInsertManyOptions extends BaseOptions
    implements InsertManyOptions {

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

    private ProxyInsertManyOptions() {
    }

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

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

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

    @Override
    public ProxyInsertManyOptions 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