Package journal.io.api

Examples of journal.io.api.Journal.redo()


            journal.write(new String("DATA" + i).getBytes("UTF-8"), writeType);
        }

        // Replay the journal forward by redoing:
        int i = 0;
        for (Location location : journal.redo()) {
            byte[] record = journal.read(location, Journal.ReadType.ASYNC);
            assertEquals("DATA" + i++, new String(record, "UTF-8"));
        }

        // Replay the journal backward by undoing:
View Full Code Here


            byte[] record = journal.read(location, Journal.ReadType.ASYNC);
            assertEquals("DATA" + --i, new String(record, "UTF-8"));
        }

        // Delete locations:
        for (Location location : journal.redo()) {
            journal.delete(location);
        }

        // Compact logs:
        journal.compact();
View Full Code Here

    long committed = 0;
    List<String> membership = Collections.emptyList();
    Optional<String> lastVotedFor = Optional.absent();
    Type lastEntryType = Type.EMPTY;

    for (Location loc : journal.redo()) {

      byte[] rawEntry = journal.read(loc, Journal.ReadType.ASYNC);
      JournalEntry entry = JournalEntry.parseFrom(rawEntry);

      if (entry.hasAppend()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.