Package journal.io.api

Examples of journal.io.api.Location


    @BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 1)
    public void testRandomRead() throws Exception {
        Random generator = new Random();
        for (int i = 0; i < 1000; i++) {
            int n = generator.nextInt(inserts);
            Location read = locations.get(n);
            String expected = "" + n;
            assertEquals(expected, new String(journal.read(read, Journal.ReadType.ASYNC), "UTF-8").substring(0, expected.length()));
        }
    }
View Full Code Here


  }

  public void truncateTail(Mark mark) {
    try {

      Location location = mark.getLocation();
      Iterable<Location> locations = FluentIterable
          .from(journal.redo(location))
          .skip(1);

      for (Location loc : locations) {
View Full Code Here

          .setEntry(entry)
          .setIndex(index)
          .build())
        .build();

    Location location = write(je);
    return new Mark(location);
  }
View Full Code Here

    Location location = write(je);
    return new Mark(location);
  }

  public Mark appendTerm(long term) {
    Location location =
      write(JournalEntry.newBuilder()
        .setTerm(Term.newBuilder()
          .setTerm(term)
          .build())
        .build());
View Full Code Here

        .build());
    return new Mark(location);
  }

  public Mark appendCommit(long commit) {
    Location location =
      write(JournalEntry.newBuilder()
        .setCommit(Commit.newBuilder()
          .setIndex(commit)
          .build())
        .build());
View Full Code Here

        .build());
    return new Mark(location);
  }

  public Mark appendVote(Optional<Replica> vote) {
    Location location =
      write(JournalEntry.newBuilder()
        .setVote(Vote.newBuilder()
          .setVotedFor(vote.transform(toStringFunction()).or(""))
          .build())
        .build());
View Full Code Here

        .build());
    return new Mark(location);
  }

  public Mark appendSnapshot(File file, long index, long term) {
    Location location =
      write(JournalEntry.newBuilder()
        .setSnapshot(Snapshot.newBuilder()
          .setLastIncludedIndex(index)
          .setLastIncludedTerm(term)
          .setSnapshotFile(file.getName())
View Full Code Here

TOP

Related Classes of journal.io.api.Location

Copyright © 2018 www.massapicom. 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.