public class IgfsUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static IgniteUuid |
DELETE_LOCK_ID
Lock Id used to lock files being deleted from TRASH.
|
static String |
PROP_GROUP_NAME
File property: group name.
|
static String |
PROP_PERMISSION
File property: permission.
|
static String |
PROP_PREFER_LOCAL_WRITES
File property: prefer writes to local node.
|
static String |
PROP_USER_NAME
File property: user name.
|
static IgniteUuid |
ROOT_ID
ID for the root directory.
|
static int |
TRASH_CONCURRENCY
Constant trash concurrency level.
|
| Modifier and Type | Method and Description |
|---|---|
static IgfsDirectoryInfo |
createDirectory(IgniteUuid id)
Create empty directory with the given ID.
|
static IgfsDirectoryInfo |
createDirectory(IgniteUuid id,
Map<String,IgfsListingEntry> listing,
Map<String,String> props)
Create directory.
|
static IgfsDirectoryInfo |
createDirectory(IgniteUuid id,
Map<String,IgfsListingEntry> listing,
Map<String,String> props,
long createTime,
long modificationTime)
Create directory.
|
static IgfsFileInfo |
createFile(IgniteUuid id,
int blockSize,
long len,
IgniteUuid affKey,
IgniteUuid lockId,
boolean evictExclude,
Map<String,String> props,
long accessTime,
long modificationTime)
Create file.
|
static <T> T |
doInTransactionWithRetries(IgniteInternalCache cache,
IgniteOutClosureX<T> clo)
Performs an operation with transaction with retries.
|
static IgfsPath |
extractOriginalPathFromTrash(String name)
Parses the TRASH file name to extract the original path.
|
static String |
fixUserName(String user)
Provides non-null user name.
|
static boolean |
isIgfsCache(IgniteConfiguration cfg,
String cacheName) |
static boolean |
isRootId(IgniteUuid id)
Check whether provided ID is root ID.
|
static boolean |
isRootOrTrashId(IgniteUuid id)
Check whether provided ID is either root ID or trash ID.
|
static IgfsException |
newIgfsException(Class<? extends IgfsException> cls,
String msg,
Throwable cause)
Construct new IGFS exception passing specified message and cause.
|
static void |
prepareCacheConfiguration(IgniteConfiguration cfg,
CacheConfiguration ccfg)
Prepare cache configuration if this is IGFS meta or data cache.
|
static IgniteUuid |
randomTrashId()
Get random trash ID.
|
static IgfsListingEntry |
readListingEntry(BinaryRawReader in)
Read listing entry.
|
static IgfsListingEntry |
readListingEntry(DataInput in)
Read listing entry.
|
static Map<String,String> |
readProperties(BinaryRawReader in)
Read entry properties.
|
static Map<String,String> |
readProperties(DataInput in)
Read entry properties.
|
static void |
sendEvents(GridKernalContext kernalCtx,
IgfsPath path,
IgfsPath newPath,
int type)
Sends a series of event.
|
static void |
sendEvents(GridKernalContext kernalCtx,
IgfsPath path,
int type)
Sends a series of event.
|
static IgfsException |
toIgfsException(Exception err)
Converts any passed exception to IGFS exception.
|
static IgniteUuid |
trashId(int idx)
Get trash ID for the given index.
|
static void |
writeListingEntry(BinaryRawWriter out,
IgfsListingEntry entry)
Write listing entry.
|
static void |
writeListingEntry(DataOutput out,
IgfsListingEntry entry)
Write listing entry.
|
static void |
writeProperties(BinaryRawWriter out,
Map<String,String> props)
Write entry properties.
|
static void |
writeProperties(DataOutput out,
Map<String,String> props)
Write entry properties.
|
public static final IgniteUuid ROOT_ID
public static final IgniteUuid DELETE_LOCK_ID
public static final int TRASH_CONCURRENCY
public static final String PROP_USER_NAME
public static final String PROP_GROUP_NAME
public static final String PROP_PERMISSION
public static final String PROP_PREFER_LOCAL_WRITES
public static IgniteUuid randomTrashId()
public static IgniteUuid trashId(int idx)
idx - Index.public static boolean isRootOrTrashId(@Nullable IgniteUuid id)
id - ID.True if this is root ID or trash ID.public static boolean isRootId(@Nullable IgniteUuid id)
id - ID.True if this is root ID.public static IgfsException toIgfsException(Exception err)
err - Initial exception.public static IgfsException newIgfsException(Class<? extends IgfsException> cls, String msg, Throwable cause)
cls - Class.msg - Message.cause - Cause.public static String fixUserName(@Nullable String user)
FileSystemConfiguration.DFLT_USER_NAME,
which is the current process owner user.user - a user name to be fixed.public static <T> T doInTransactionWithRetries(IgniteInternalCache cache, IgniteOutClosureX<T> clo) throws IgniteCheckedException
cache - Cache to do the transaction on.clo - Closure.IgniteCheckedException - If failed.public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, int type)
path - The path of the created file.type - The type of event to send.public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, IgfsPath newPath, int type)
path - The path of the created file.newPath - New path.type - The type of event to send.public static boolean isIgfsCache(IgniteConfiguration cfg, @Nullable String cacheName)
cfg - Grid configuration.cacheName - Cache name.True in this is IGFS data or meta cache.public static void prepareCacheConfiguration(IgniteConfiguration cfg, CacheConfiguration ccfg)
cfg - Configuration.ccfg - Cache configuration.public static IgfsDirectoryInfo createDirectory(IgniteUuid id)
id - ID.public static IgfsDirectoryInfo createDirectory(IgniteUuid id, @Nullable Map<String,IgfsListingEntry> listing, @Nullable Map<String,String> props)
id - ID.listing - Listing.props - Properties.public static IgfsDirectoryInfo createDirectory(IgniteUuid id, @Nullable Map<String,IgfsListingEntry> listing, @Nullable Map<String,String> props, long createTime, long modificationTime)
id - ID.listing - Listing.props - Properties.createTime - Create time.modificationTime - Modification time.public static IgfsFileInfo createFile(IgniteUuid id, int blockSize, long len, @Nullable IgniteUuid affKey, @Nullable IgniteUuid lockId, boolean evictExclude, @Nullable Map<String,String> props, long accessTime, long modificationTime)
id - File ID.blockSize - Block size.len - Length.affKey - Affinity key.lockId - Lock ID.evictExclude - Evict exclude flag.props - Properties.accessTime - Access time.modificationTime - Modification time.public static void writeListingEntry(BinaryRawWriter out, @Nullable IgfsListingEntry entry)
out - Writer.entry - Entry.@Nullable public static IgfsListingEntry readListingEntry(BinaryRawReader in)
in - Reader.public static void writeListingEntry(DataOutput out, @Nullable IgfsListingEntry entry) throws IOException
out - Writer.entry - Entry.IOException - If failed.@Nullable public static IgfsListingEntry readListingEntry(DataInput in) throws IOException
in - Reader.IOExceptionpublic static void writeProperties(BinaryRawWriter out, @Nullable Map<String,String> props)
out - Writer.props - Properties.@Nullable public static Map<String,String> readProperties(BinaryRawReader in)
in - Reader.public static void writeProperties(DataOutput out, @Nullable Map<String,String> props) throws IOException
out - Writer.props - Properties.IOException - If failed.@Nullable public static Map<String,String> readProperties(DataInput in) throws IOException
in - Reader.IOException - If failed.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.6.0 Release Date : May 18 2016