/** * @file * @brief * @author Willem Thiart himself@willemthiart.com * @version 0.1 * * @section LICENSE * Copyright (c) 2011, Willem-Hendrik Thiart All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WILLEM-HENDRIK THIART BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include "raft.h" typedef struct { /* Array: For each server, index of the next log entry to send to * that server (initialized to leader last log index +1) */ int *nextIndex; /* Array: for each server, index of highest log entry known to be * replicated on server (initialized to 0, increases monotonically) */ int *matchIndex; #if 0 /* The latest entry that each follower has acknowledged is the same as * the leader's. This is used to calculate commitIndex on the leader. */ int last_agree_index; #endif } leader_t; void raft_leader_periodic(raft_server_t* me) { // leader(me)-> } /** * Client sends command to leader to be added to log */ void raft_leader_recv_command(raft_server_t* me) { }