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

com.palantir.atlasdb.schema.generated.SweepTableFactory Maven / Gradle / Ivy

There is a newer version: 0.1152.0
Show newest version
package com.palantir.atlasdb.schema.generated;

import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.palantir.atlasdb.keyvalue.api.Namespace;
import com.palantir.atlasdb.table.generation.Triggers;
import com.palantir.atlasdb.transaction.api.Transaction;
import java.util.List;
import javax.annotation.processing.Generated;

@Generated("com.palantir.atlasdb.table.description.render.TableFactoryRenderer")
public final class SweepTableFactory {
    private static final Namespace defaultNamespace = Namespace.create("sweep", Namespace.UNCHECKED_NAME);

    private static final SweepTableFactory defaultTableFactory = of(defaultNamespace);

    private final List> sharedTriggers;

    private final Namespace namespace;

    private SweepTableFactory(List> sharedTriggers, Namespace namespace) {
        this.sharedTriggers = sharedTriggers;
        this.namespace = namespace;
    }

    public static SweepTableFactory of(
            List> sharedTriggers, Namespace namespace) {
        return new SweepTableFactory(sharedTriggers, namespace);
    }

    public static SweepTableFactory of(List> sharedTriggers) {
        return new SweepTableFactory(sharedTriggers, defaultNamespace);
    }

    public static SweepTableFactory of(Namespace namespace) {
        return of(ImmutableList.of(), namespace);
    }

    public static SweepTableFactory of() {
        return defaultTableFactory;
    }

    public SweepPriorityTable getSweepPriorityTable(
            Transaction t, SweepPriorityTable.SweepPriorityTrigger... triggers) {
        return SweepPriorityTable.of(t, namespace, Triggers.getAllTriggers(t, sharedTriggers, triggers));
    }

    public interface SharedTriggers extends SweepPriorityTable.SweepPriorityTrigger {}

    public abstract static class NullSharedTriggers implements SharedTriggers {
        @Override
        public void putSweepPriority(
                Multimap<
                                SweepPriorityTable.SweepPriorityRow,
                                ? extends SweepPriorityTable.SweepPriorityNamedColumnValue>
                        newRows) {
            // do nothing
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy