use of org.apache.ignite.internal.processors.igfs.IgfsListingEntry in project ignite by apache.
the class IgfsMetaDirectoryListingReplaceProcessor 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 oldEntry = listing.get(name);
if (oldEntry == null)
throw new IgniteException("Directory listing doesn't contain expected entry: " + name);
listing.put(name, new IgfsListingEntry(id, oldEntry.isDirectory()));
e.setValue(fileInfo.listing(listing));
return null;
}
use of org.apache.ignite.internal.processors.igfs.IgfsListingEntry 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.IgfsListingEntry 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.IgfsListingEntry 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