Examples of FileHeader


Examples of org.apache.zookeeper.server.persistence.FileHeader

        Record txn = new CreateTxn("/Test", new byte[0], null, false, 1);
        txnLog.append(txnHeader, txn);
        FileInputStream in = new FileInputStream(tmpDir.getPath() + "/log." +
              Long.toHexString(txnHeader.getZxid()));
        BinaryInputArchive ia  = BinaryInputArchive.getArchive(in);
        FileHeader header = new FileHeader();
        header.deserialize(ia, "fileheader");
        LOG.info("Received magic : " + header.getMagic() +
              " Expected : " + FileTxnLog.TXNLOG_MAGIC);
        Assert.assertTrue("Missing magic number ",
              header.getMagic() == FileTxnLog.TXNLOG_MAGIC);
    }
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

        Record txn = new CreateTxn("/Test", new byte[0], null, false, 1);
        txnLog.append(txnHeader, txn);
        FileInputStream in = new FileInputStream(tmpDir.getPath() + "/log." +
              Long.toHexString(txnHeader.getZxid()));
        BinaryInputArchive ia  = BinaryInputArchive.getArchive(in);
        FileHeader header = new FileHeader();
        header.deserialize(ia, "fileheader");
        LOG.info("Received magic : " + header.getMagic() +
              " Expected : " + FileTxnLog.TXNLOG_MAGIC);
        Assert.assertTrue("Missing magic number ",
              header.getMagic() == FileTxnLog.TXNLOG_MAGIC);
    }
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

    public LogSkipList getSkipList() { return skiplist; }

    public static boolean isTransactionFile(String file) throws IOException {
        RandomAccessFileReader reader = new RandomAccessFileReader(new File(file));
        BinaryInputArchive logStream = new BinaryInputArchive(reader);
        FileHeader fhdr = new FileHeader();
        fhdr.deserialize(logStream, "fileheader");
  reader.close();

        return fhdr.getMagic() == FileTxnLog.TXNLOG_MAGIC;
    }
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

  skiplist = new LogSkipList();

  RandomAccessFileReader reader = new RandomAccessFileReader(new File(file));
  try {
      BinaryInputArchive logStream = new BinaryInputArchive(reader);
      FileHeader fhdr = new FileHeader();
      fhdr.deserialize(logStream, "fileheader");
     
      byte[] bytes = null;
      while (true) {
    long lastFp = reader.getPosition();
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

    this.src = src;
    this.starttime = starttime;
    this.endtime = endtime;
    reader = new RandomAccessFileReader(new File(src.file));
    logStream = new BinaryInputArchive(reader);
    FileHeader fhdr = new FileHeader();
    fhdr.deserialize(logStream, "fileheader");
      } catch (Exception e) {
    throw new IllegalArgumentException("Cannot open transaction log ("+src.file+") :" + e);
      }
     
      LogSkipList.Mark start = src.getSkipList().findMarkBefore(starttime);
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

        Record txn = new CreateTxn("/Test", new byte[0], null, false, 1);
        txnLog.append(txnHeader, txn);
        FileInputStream in = new FileInputStream(tmpDir.getPath() + "/log." +
              Long.toHexString(txnHeader.getZxid()));
        BinaryInputArchive ia  = BinaryInputArchive.getArchive(in);
        FileHeader header = new FileHeader();
        header.deserialize(ia, "fileheader");
        LOG.info("Received magic : " + header.getMagic() +
              " Expected : " + FileTxnLog.TXNLOG_MAGIC);
        Assert.assertTrue("Missing magic number ",
              header.getMagic() == FileTxnLog.TXNLOG_MAGIC);
    }
View Full Code Here

Examples of org.apache.zookeeper.server.persistence.FileHeader

            System.err.println("USAGE: LogFormatter log_file");
            System.exit(2);
        }
        FileInputStream fis = new FileInputStream(args[0]);
        BinaryInputArchive logStream = BinaryInputArchive.getArchive(fis);
        FileHeader fhdr = new FileHeader();
        fhdr.deserialize(logStream, "fileheader");

        if (fhdr.getMagic() != FileTxnLog.TXNLOG_MAGIC) {
            System.err.println("Invalid magic number for " + args[0]);
            System.exit(2);
        }
        System.out.println("ZooKeeper Transactional Log File with dbid "
                + fhdr.getDbid() + " txnlog format version "
                + fhdr.getVersion());

        int count = 0;
        while (true) {
            long crcValue;
            byte[] bytes;
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.server.persistence.FileHeader

  }
  public int compareTo (Object peer_) throws ClassCastException {
    if (!(peer_ instanceof FileHeader)) {
      throw new ClassCastException("Comparing different types of records.");
    }
    FileHeader peer = (FileHeader) peer_;
    int ret = 0;
    ret = (magic == peer.magic)? 0 :((magic<peer.magic)?-1:1);
    if (ret != 0) return ret;
    ret = (version == peer.version)? 0 :((version<peer.version)?-1:1);
    if (ret != 0) return ret;
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.server.persistence.FileHeader

      return false;
    }
    if (peer_ == this) {
      return true;
    }
    FileHeader peer = (FileHeader) peer_;
    boolean ret = false;
    ret = (magic==peer.magic);
    if (!ret) return ret;
    ret = (version==peer.version);
    if (!ret) return ret;
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.server.persistence.FileHeader

     * @param ia the input archive to restore from
     * @throws IOException
     */
    public void deserialize(DataTree dt, Map<Long, Long> sessions,
            InputArchive ia) throws IOException {
        FileHeader header = new FileHeader();
        header.deserialize(ia, "fileheader");
        if (header.getMagic() != SNAP_MAGIC) {
            throw new IOException("mismatching magic headers "
                    + header.getMagic() +
                    " !=  " + FileSnap.SNAP_MAGIC);
        }
        SerializeUtils.deserializeSnapshot(dt,ia,sessions);
    }
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.