use of org.apache.ignite.internal.processors.igfs.IgfsEntryInfo in project ignite by apache.
the class IgfsFragmentizerAbstractSelfTest method awaitFileFragmenting.
/**
* @param gridIdx Grid index.
* @param path Path to await.
* @throws Exception If failed.
*/
protected void awaitFileFragmenting(int gridIdx, IgfsPath path) throws Exception {
IgfsEx igfs = (IgfsEx) grid(gridIdx).fileSystem("igfs");
IgfsMetaManager meta = igfs.context().meta();
IgniteUuid fileId = meta.fileId(path);
if (fileId == null)
throw new IgfsPathNotFoundException("File not found: " + path);
IgfsEntryInfo fileInfo = meta.info(fileId);
do {
if (fileInfo == null)
throw new IgfsPathNotFoundException("File not found: " + path);
if (fileInfo.fileMap().ranges().isEmpty())
return;
U.sleep(100);
fileInfo = meta.info(fileId);
} while (true);
}
use of org.apache.ignite.internal.processors.igfs.IgfsEntryInfo in project ignite by apache.
the class IgfsMetaDirectoryCreateProcessor method process.
/** {@inheritDoc} */
@Override
public IgfsEntryInfo process(MutableEntry<IgniteUuid, IgfsEntryInfo> entry, Object... args) throws EntryProcessorException {
IgfsEntryInfo info = IgfsUtils.createDirectory(entry.getKey(), null, props, accessTime, modificationTime);
if (childName != null)
info = info.listing(Collections.singletonMap(childName, childEntry));
entry.setValue(info);
return info;
}
use of org.apache.ignite.internal.processors.igfs.IgfsEntryInfo in project ignite by apache.
the class IgfsMetaDirectoryListingAddProcessor method process.
/** {@inheritDoc} */
@Override
public Void process(MutableEntry<IgniteUuid, IgfsEntryInfo> e, Object... args) {
IgfsEntryInfo fileInfo = e.getValue();
assert fileInfo != null && fileInfo.isDirectory() : fileInfo;
Map<String, IgfsListingEntry> listing = new HashMap<>(fileInfo.listing());
// Modify listing in-place.
IgfsListingEntry oldEntry = listing.put(fileName, entry);
if (oldEntry != null && !oldEntry.fileId().equals(entry.fileId())) {
throw new IgniteException("Directory listing contains unexpected file" + " [listing=" + listing + ", fileName=" + fileName + ", entry=" + entry + ", oldEntry=" + oldEntry + ']');
}
e.setValue(fileInfo.listing(listing));
return null;
}
use of org.apache.ignite.internal.processors.igfs.IgfsEntryInfo in project ignite by apache.
the class IgfsMetaDirectoryListingRemoveProcessor method process.
/** {@inheritDoc} */
@Override
public Void process(MutableEntry<IgniteUuid, IgfsEntryInfo> e, Object... args) throws EntryProcessorException {
IgfsEntryInfo fileInfo = e.getValue();
assert fileInfo != null;
assert fileInfo.isDirectory();
Map<String, IgfsListingEntry> listing = new HashMap<>(fileInfo.listing());
IgfsListingEntry oldEntry = listing.get(fileName);
if (oldEntry == null || !oldEntry.fileId().equals(fileId))
throw new IgniteException("Directory listing doesn't contain expected file" + " [listing=" + listing + ", fileName=" + fileName + "]");
// Modify listing in-place.
listing.remove(fileName);
e.setValue(fileInfo.listing(listing));
return null;
}
use of org.apache.ignite.internal.processors.igfs.IgfsEntryInfo in project ignite by apache.
the class IgfsMetaDirectoryListingRenameProcessor method process.
/** {@inheritDoc} */
@Override
public Void process(MutableEntry<IgniteUuid, IgfsEntryInfo> e, Object... args) throws EntryProcessorException {
IgfsEntryInfo fileInfo = e.getValue();
assert fileInfo.isDirectory();
Map<String, IgfsListingEntry> listing = new HashMap<>(fileInfo.listing());
// Modify listing in-place.
IgfsListingEntry entry = listing.remove(oldName);
if (entry == null)
throw new IgniteException("Directory listing doesn't contain expected entry: " + oldName);
IgfsListingEntry replacedEntry = listing.put(newName, entry);
if (replacedEntry != null)
throw new IgniteException("Entry with new name already exists [name=" + newName + ", entry=" + replacedEntry + ']');
e.setValue(fileInfo.listing(listing));
return null;
}
Aggregations