|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectorg.apache.zookeeper.server.persistence.Util
public class Util
A collection of utility methods for dealing with file name parsing, low level I/O file operations and marshalling/unmarshalling.
构造方法摘要 | |
---|---|
Util()
|
方法摘要 | |
---|---|
static java.lang.String |
getFormatConversionPolicy(java.util.Properties props)
Extracts the value of the dbFormatConversion attribute. |
static java.io.File |
getLogDir(java.util.Properties props)
Extracts transaction log directory property value from the container. |
static java.io.File |
getSnapDir(java.util.Properties props)
Extracts snapshot directory property value from the container. |
static long |
getZxidFromName(java.lang.String name,
java.lang.String prefix)
Extracts zxid from the file name. |
static boolean |
isValidSnapshot(java.io.File f)
Verifies that the file is a valid snapshot. |
static java.net.URI |
makeFileLoggerURL(java.io.File dataDir,
java.io.File dataLogDir)
Given two directory files the method returns a well-formed logfile provider URI. |
static java.net.URI |
makeFileLoggerURL(java.io.File dataDir,
java.io.File dataLogDir,
java.lang.String convPolicy)
|
static java.lang.String |
makeLogName(long zxid)
Creates a valid transaction log file name. |
static java.lang.String |
makeSnapshotName(long zxid)
Creates a snapshot file name. |
static java.lang.String |
makeURIString(java.lang.String dataDir,
java.lang.String dataLogDir,
java.lang.String convPolicy)
|
static byte[] |
marshallTxnEntry(org.apache.zookeeper.txn.TxnHeader hdr,
Record txn)
Serializes transaction header and transaction data into a byte buffer. |
static long |
padLogFile(java.io.FileOutputStream f,
long currentSize,
long preAllocSize)
Grows the file to the specified number of bytes. |
static byte[] |
readTxnBytes(InputArchive ia)
Reads a transaction entry from the input archive. |
static java.util.List<java.io.File> |
sortDataDir(java.io.File[] files,
java.lang.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. |
从类 java.lang.Object 继承的方法 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public Util()
方法详细信息 |
---|
public static java.lang.String makeURIString(java.lang.String dataDir, java.lang.String dataLogDir, java.lang.String convPolicy)
public static java.net.URI makeFileLoggerURL(java.io.File dataDir, java.io.File dataLogDir)
dataDir
- snapshot directorydataLogDir
- transaction log directory
public static java.net.URI makeFileLoggerURL(java.io.File dataDir, java.io.File dataLogDir, java.lang.String convPolicy)
public static java.lang.String makeLogName(long zxid)
zxid
- used as a file name suffix (extention)
public static java.lang.String makeSnapshotName(long zxid)
zxid
- used as a suffix
public static java.io.File getSnapDir(java.util.Properties props)
props
- properties container
public static java.io.File getLogDir(java.util.Properties props)
props
- properties container
public static java.lang.String getFormatConversionPolicy(java.util.Properties props)
props
- properties container
public static long getZxidFromName(java.lang.String name, java.lang.String prefix)
makeLogName
or makeSnapshotName
.
name
- the file name to parseprefix
- the file name prefix (snapshot or log)
public static boolean isValidSnapshot(java.io.File f) throws java.io.IOException
f
- file to verify
java.io.IOException
public static long padLogFile(java.io.FileOutputStream f, long currentSize, long preAllocSize) throws java.io.IOException
f
- output stream to padcurrentSize
- application keeps track of the cuurent file sizepreAllocSize
- how many bytes to pad
java.io.IOException
public static byte[] readTxnBytes(InputArchive ia) throws java.io.IOException
ia
- archive to read from
java.io.IOException
public static byte[] marshallTxnEntry(org.apache.zookeeper.txn.TxnHeader hdr, Record txn) throws java.io.IOException
hdr
- transaction headertxn
- transaction data
java.io.IOException
public static void writeTxnBytes(OutputArchive oa, byte[] bytes) throws java.io.IOException
oa
- output archivebytes
- serialized trasnaction record
java.io.IOException
public static java.util.List<java.io.File> sortDataDir(java.io.File[] files, java.lang.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 order
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |