Class Utils
- java.lang.Object
-
- org.apache.accumulo.master.tableOps.Utils
-
public class Utils extends Object
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkNamespaceDoesNotExist(ServerContext context, String namespace, NamespaceId namespaceId, TableOperation operation)
static void
checkTableDoesNotExist(ServerContext context, String tableName, TableId tableId, TableOperation operation)
static Lock
getIdLock()
static <T extends AbstractId<T>>
TgetNextId(String name, ServerContext context, Function<String,T> newIdFunction)
static Lock
getReadLock(Master env, AbstractId<?> id, long tid)
static SortedSet<org.apache.hadoop.io.Text>
getSortedSetFromFile(org.apache.hadoop.fs.FSDataInputStream inputStream, boolean encoded)
Given an input stream and a flag indicating if the file info is base64 encoded or not, retrieve the data from a file on the file system.static Lock
getTableNameLock()
static long
reserveHdfsDirectory(Master env, String directory, long tid)
static long
reserveNamespace(Master env, NamespaceId namespaceId, long id, boolean writeLock, boolean mustExist, TableOperation op)
static long
reserveTable(Master env, TableId tableId, long tid, boolean writeLock, boolean tableMustExist, TableOperation op)
static void
unreserveHdfsDirectory(Master env, String directory, long tid)
static void
unreserveNamespace(Master env, NamespaceId namespaceId, long id, boolean writeLock)
static void
unreserveTable(Master env, TableId tableId, long tid, boolean writeLock)
-
-
-
Method Detail
-
checkTableDoesNotExist
public static void checkTableDoesNotExist(ServerContext context, String tableName, TableId tableId, TableOperation operation) throws AcceptableThriftTableOperationException
-
getNextId
public static <T extends AbstractId<T>> T getNextId(String name, ServerContext context, Function<String,T> newIdFunction) throws AcceptableThriftTableOperationException
-
reserveTable
public static long reserveTable(Master env, TableId tableId, long tid, boolean writeLock, boolean tableMustExist, TableOperation op) throws Exception
- Throws:
Exception
-
unreserveTable
public static void unreserveTable(Master env, TableId tableId, long tid, boolean writeLock)
-
unreserveNamespace
public static void unreserveNamespace(Master env, NamespaceId namespaceId, long id, boolean writeLock)
-
reserveNamespace
public static long reserveNamespace(Master env, NamespaceId namespaceId, long id, boolean writeLock, boolean mustExist, TableOperation op) throws Exception
- Throws:
Exception
-
reserveHdfsDirectory
public static long reserveHdfsDirectory(Master env, String directory, long tid) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
unreserveHdfsDirectory
public static void unreserveHdfsDirectory(Master env, String directory, long tid) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getIdLock
public static Lock getIdLock()
-
getTableNameLock
public static Lock getTableNameLock()
-
getReadLock
public static Lock getReadLock(Master env, AbstractId<?> id, long tid)
-
checkNamespaceDoesNotExist
public static void checkNamespaceDoesNotExist(ServerContext context, String namespace, NamespaceId namespaceId, TableOperation operation) throws AcceptableThriftTableOperationException
-
getSortedSetFromFile
public static SortedSet<org.apache.hadoop.io.Text> getSortedSetFromFile(org.apache.hadoop.fs.FSDataInputStream inputStream, boolean encoded) throws IOException
Given an input stream and a flag indicating if the file info is base64 encoded or not, retrieve the data from a file on the file system. It is assumed that the file is textual and not binary data.- Throws:
IOException
-
-