public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static String |
getFormatConversionPolicy(Properties props)
Extracts the value of the dbFormatConversion attribute.
|
static File |
getLogDir(Properties props)
Extracts transaction log directory property value from the container.
|
static File |
getSnapDir(Properties props)
Extracts snapshot directory property value from the container.
|
static long |
getZxidFromName(String name,
String prefix)
Extracts zxid from the file name.
|
static boolean |
isLogFileName(String fileName)
Returns true if fileName is a log file name.
|
static boolean |
isSnapshotFileName(String fileName)
Returns true if fileName is a snapshot file name.
|
static boolean |
isValidSnapshot(File f)
Verifies that the file is a valid snapshot.
|
static URI |
makeFileLoggerURL(File dataDir,
File dataLogDir)
Given two directory files the method returns a well-formed
logfile provider URI.
|
static URI |
makeFileLoggerURL(File dataDir,
File dataLogDir,
String convPolicy) |
static String |
makeLogName(long zxid)
Creates a valid transaction log file name.
|
static String |
makeSnapshotName(long zxid)
Creates a snapshot file name.
|
static String |
makeURIString(String dataDir,
String dataLogDir,
String convPolicy) |
static byte[] |
marshallTxnEntry(TxnHeader hdr,
Record txn)
Serializes transaction header and transaction data into a byte buffer.
|
static byte[] |
readTxnBytes(InputArchive ia)
Reads a transaction entry from the input archive.
|
static List<File> |
sortDataDir(File[] files,
String prefix,
boolean ascending)
Sort the list of files.
|
static void |
writeTxnBytes(OutputArchive oa,
byte[] bytes)
Write the serialized transaction record to the output archive.
|
public static String makeURIString(String dataDir, String dataLogDir, String convPolicy)
public static URI makeFileLoggerURL(File dataDir, File dataLogDir)
dataDir
- snapshot directorydataLogDir
- transaction log directorypublic static URI makeFileLoggerURL(File dataDir, File dataLogDir, String convPolicy)
public static String makeLogName(long zxid)
zxid
- used as a file name suffix (extension)public static String makeSnapshotName(long zxid)
zxid
- used as a suffixpublic static File getSnapDir(Properties props)
props
- properties containerpublic static File getLogDir(Properties props)
props
- properties containerpublic static String getFormatConversionPolicy(Properties props)
props
- properties containerpublic static long getZxidFromName(String name, String prefix)
makeLogName(long)
or makeSnapshotName(long)
.name
- the file name to parseprefix
- the file name prefix (snapshot or log)public static boolean isValidSnapshot(File f) throws IOException
f
- file to verifyIOException
public static byte[] readTxnBytes(InputArchive ia) throws IOException
ia
- archive to read fromIOException
public static byte[] marshallTxnEntry(TxnHeader hdr, Record txn) throws IOException
hdr
- transaction headertxn
- transaction dataIOException
public static void writeTxnBytes(OutputArchive oa, byte[] bytes) throws IOException
oa
- output archivebytes
- serialized transaction recordIOException
public static List<File> sortDataDir(File[] files, String prefix, boolean ascending)
files
- array of filesprefix
- files not matching this prefix are assumed to have a
version = -1)ascending
- true sorted in ascending order, false results in
descending orderpublic static boolean isLogFileName(String fileName)
fileName
- public static boolean isSnapshotFileName(String fileName)
fileName
- Copyright © 2008–2019 The Apache Software Foundation. All rights reserved.