Search in sources :

Example 6 with FileHeader

use of org.apache.zookeeper_voltpatches.server.persistence.FileHeader in project voltdb by VoltDB.

the class FileTxnLog method getDbId.

/**
     * the dbid of this transaction database
     * @return the dbid of this database
     */
public long getDbId() throws IOException {
    FileTxnIterator itr = new FileTxnIterator(logDir, 0);
    FileHeader fh = readHeader(itr.logFile);
    itr.close();
    if (fh == null)
        throw new IOException("Unsupported Format.");
    return fh.getDbid();
}
Also used : IOException(java.io.IOException) FileHeader(org.apache.zookeeper_voltpatches.server.persistence.FileHeader)

Example 7 with FileHeader

use of org.apache.zookeeper_voltpatches.server.persistence.FileHeader in project voltdb by VoltDB.

the class FileHeader method equals.

@Override
public boolean equals(Object peer_) {
    if (!(peer_ instanceof 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;
    ret = (dbid == peer.dbid);
    if (!ret)
        return ret;
    return ret;
}
Also used : FileHeader(org.apache.zookeeper_voltpatches.server.persistence.FileHeader)

Example 8 with FileHeader

use of org.apache.zookeeper_voltpatches.server.persistence.FileHeader in project voltdb by VoltDB.

the class FileSnap method deserialize.

/**
     * deserialize the datatree from an inputarchive
     * @param dt the datatree to be serialized into
     * @param sessions the sessions to be filled up
     * @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);
}
Also used : IOException(java.io.IOException) FileHeader(org.apache.zookeeper_voltpatches.server.persistence.FileHeader)

Aggregations

FileHeader (org.apache.zookeeper_voltpatches.server.persistence.FileHeader)8 IOException (java.io.IOException)5 BufferedOutputStream (java.io.BufferedOutputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 Adler32 (java.util.zip.Adler32)2 Checksum (java.util.zip.Checksum)2 BinaryInputArchive (org.apache.jute_voltpatches.BinaryInputArchive)2 InputArchive (org.apache.jute_voltpatches.InputArchive)2 BufferedInputStream (java.io.BufferedInputStream)1 EOFException (java.io.EOFException)1 File (java.io.File)1 FilterInputStream (java.io.FilterInputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 RandomAccessFile (java.io.RandomAccessFile)1 Date (java.util.Date)1 CheckedOutputStream (java.util.zip.CheckedOutputStream)1 BinaryOutputArchive (org.apache.jute_voltpatches.BinaryOutputArchive)1