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

org.voltdb.iv2.InitiatorMessageHandler Maven / Gradle / Ivy

There is a newer version: 10.1.1
Show newest version
/* This file is part of VoltDB.
 * Copyright (C) 2008-2018 VoltDB Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with VoltDB.  If not, see .
 */

package org.voltdb.iv2;

import java.util.List;
import java.util.Map;

import org.voltcore.messaging.Mailbox;
import org.voltcore.messaging.VoltMessage;
import org.voltdb.CommandLog;

/**
 * InitiatorMessageHandler delivers messages to internal Initiator components.
 * Different roles (multi/single-part initiator/replica) should extend this
 * class to provide routing appropriate to the role.
 * IZZY: I think this could merge with Scheduler pretty cleanly.
 */
public interface InitiatorMessageHandler
{
    long[] updateReplicas(List replicas, Map partitionMasters, long mpTxnId);

    void setCommandLog(CommandLog cl);
    void setMailbox(Mailbox mailbox);
        /*
           if (replica):
               if (sp procedure):
                   log it
                   make a SP-task cfg'd with respond-to-remote
                if (mp fragment):
                   log it
                   make a MP-fragtask cfg'd with respond-to-master

            if (master):
                if (sp procedure):
                    log it
                    replicate
                    make a SP-task cfg'd with respond-to-local
                if (mp fragment)
                    log it
                    replicate
                    make a MP-fragtask cfg'd with respond-to-local
                if (sp-response):
                    log it?
                    if replicate.dedupe() says complete:
                       send response to creator
                if (mp fragment response)
                    log it?
                    if replicate.dedupe() says complete:
                       send response to creator (must be MPI)
                if (complete transaction)
                    log it
                    replicate
                    make a complete-transaction task

            if (mpi):
                if (mp procedure):
                    log it
                    make a mp procedure task
                if (mp fragment response):
                    offer to txnstate
                if (every-site):
                    log it
                    send sp procedure to every master
                if (every-site-response):
                    if all-responses-collected? respond to creator

       */

    // deliver a message for handling in normal operation.
    void deliver(VoltMessage message);

    // deliver a repair request to a leader starting a new Term.
    void handleMessageRepair(List needsRepair, VoltMessage message);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy