Exemplo n.º 1
0
 public EpochSSRecovery(SnapshotProvider snapshotProvider, String logPath) throws IOException {
   epochFile = new SingleNumberWriter(logPath, EPOCH_FILE_NAME);
   localId = ProcessDescriptor.getInstance().localId;
   numReplicas = ProcessDescriptor.getInstance().numReplicas;
   storage = createStorage();
   paxos = createPaxos(snapshotProvider, storage);
   dispatcher = paxos.getDispatcher();
 }
  @Before
  public void setUp() {
    List<PID> processes = new ArrayList<PID>();
    processes.add(mock(PID.class));
    processes.add(mock(PID.class));
    processes.add(mock(PID.class));
    Configuration configuration = new Configuration(processes);
    ProcessDescriptor.initialize(configuration, 0);

    storage = new InMemoryStorage();
  }
Exemplo n.º 3
0
  private Storage createStorage() throws IOException {
    ProcessDescriptor descriptor = ProcessDescriptor.getInstance();

    logger.info("Reading log from: " + logPath);
    FullSSDiscWriter writer = new FullSSDiscWriter(logPath);
    Storage storage = new SynchronousStorage(writer);
    if (storage.getView() % descriptor.numReplicas == descriptor.localId) {
      storage.setView(storage.getView() + 1);
    }
    return storage;
  }