Package org.tarantool.snapshot.XLogReader

Examples of org.tarantool.snapshot.XLogReader.XLogEntry


public class TestReplication {
  // @Test
  public void testReplication() throws IOException {
    ReplicationClient client = new ReplicationClient(SocketChannel.open(new InetSocketAddress("localhost", 33316)), 1L);
    for (int i = 0; i < 10; i++) {
      XLogEntry r = client.nextEntry();
    }
    client.close();
  }
View Full Code Here


    });
    boolean hasLogs = xlogs != null && xlogs.length > 0;
    if (hasLogs) {
      Arrays.sort(xlogs);
      XLogReader reader = new XLogReader(new FileInputStream(folder + "/" + xlogs[xlogs.length - 1]).getChannel());
      XLogEntry xlogEntry = null;
      while ((xlogEntry = reader.nextEntry()) != null) {
        lsn = xlogEntry.header.lsn;
      }
      reader.close();
    }
View Full Code Here

    };

  }

  public XLogEntry nextEntry() throws IOException {
    XLogEntry entry = client.nextEntry();
    lsn = entry.header.lsn;
    if (++row >= limit) {
      close();
      xlogChannel = nextFile(folder);
      row = 0;
View Full Code Here

  }

  public static void main(String[] args) throws IOException {
    final Backup backup = new Backup("/home/dgreen/backup", "localhost", 33016);
    backup.start();
    XLogEntry entry = null;
    while ((entry = backup.nextEntry()) != null) {
      StringBuilder pk = new StringBuilder();
      for (int i = 0; i < entry.tuple.size(); i++) {
        if (pk.length() > 0) {
          pk.append(" - ");
View Full Code Here

    ReadableByteChannel readableByteChannel = createReadableByteChannel(closed, ar);
    TupleSupport ts = new TupleSupport();
    XLogReader xlogReader = new XLogReader(readableByteChannel);
    for (int i = 0; i < 10; i++) {
      Tuple tuple = ts.create(i, Long.parseLong("98765432" + i), "Hello world " + i + "!");
      XLogEntry entry = xlogReader.nextEntry();
      Assert.assertTrue(Arrays.equals(tuple.pack(), entry.tuple.pack()));
    }
    xlogReader.close();
    Assert.assertTrue(closed.get());
View Full Code Here

TOP

Related Classes of org.tarantool.snapshot.XLogReader.XLogEntry

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.