org.craft.atom.redis.api.MasterSlaveRedis Maven / Gradle / Ivy
package org.craft.atom.redis.api;
import java.util.List;
/**
* The master-slave redis client.
*
* The master slave should be in chain structure, for example
*
* MASTER --- SLAVE1 --- SLAVE2 ... --- ... SLAVEn
* index 0 1 2 n
*
* All commands would be sent to master node, if switch master would trigger rebuild chain structure as follows:
*
* SLAVE0 --> SLAVE1 MASTER2 ... --- ... SLAVEn
* | |
* |-----------------------------------------|
*
*
* @author mindwind
* @version 1.0, Jun 25, 2013
*/
public interface MasterSlaveRedis extends RedisCommand {
/**
* Set master node by index and rebuild chain.
*
* @param index
*/
void master(int index);
/**
* @return master redis node.
*/
Redis master();
/**
* @return master node index.
*/
int index();
/**
* @return master-slave redis chain list.
*/
List chain();
/**
* Reset master-slave chain, using zero-index node as the master.
*/
void reset();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy