use of org.dcache.nfs.vfs.Inode in project dcache by dCache.
the class MonitoringVfs method mkdir.
@Override
public Inode mkdir(Inode parent, String name, Subject subject, int mode) throws IOException {
Inode dir = super.mkdir(parent, name, subject, mode);
toPnfsId(parent).ifPresent(id -> eventReceiver.notifyChildEvent(IN_CREATE, id, name, FileType.DIR));
return dir;
}
use of org.dcache.nfs.vfs.Inode in project dcache by dCache.
the class MonitoringVfs method create.
@Override
public Inode create(Inode parent, Stat.Type type, String name, Subject subject, int mode) throws IOException {
Inode target = super.create(parent, type, name, subject, mode);
toPnfsId(parent).ifPresent(id -> eventReceiver.notifyChildEvent(IN_CREATE, id, name, asFileType(type)));
return target;
}
use of org.dcache.nfs.vfs.Inode in project dcache by dCache.
the class MonitoringVfs method symlink.
@Override
public Inode symlink(Inode parent, String name, String target, Subject subject, int mode) throws IOException {
Inode symlink = super.symlink(parent, name, target, subject, mode);
toPnfsId(parent).ifPresent(id -> eventReceiver.notifyChildEvent(IN_CREATE, id, name, FileType.LINK));
return symlink;
}
use of org.dcache.nfs.vfs.Inode in project dcache by dCache.
the class ChimeraVfs method list.
@Override
public DirectoryStream list(Inode inode, byte[] verifier, long cookie) throws IOException {
FsInode parentFsInode = toFsInode(inode);
// ignore whatever is sent by client
byte[] currentVerifier = directoryVerifier(inode);
try (Stream<ChimeraDirectoryEntry> dirStream = DirectoryStreamHelper.streamOf(parentFsInode)) {
TreeSet<DirectoryEntry> list = dirStream.map(e -> new DirectoryEntry(e.getName(), toInode(e.getInode()), fromChimeraStat(e.getStat()), directoryCookieOf(e.getStat(), e.getName()))).collect(Collectors.toCollection(TreeSet::new));
return new DirectoryStream(currentVerifier, list);
}
}
use of org.dcache.nfs.vfs.Inode in project dcache by dCache.
the class MonitoringVfsTest method shouldNotNotifyOnUnsuccessfulSetAcl.
@Test
public void shouldNotNotifyOnUnsuccessfulSetAcl() throws Exception {
PnfsId parentId = new PnfsId("000000000000000000000000000000000001");
PnfsId targetId = new PnfsId("000000000000000000000000000000000002");
Inode parent = anInode().withId(1L).withPnfsId(parentId).build();
Inode target = anInode().withId(2L).withPnfsId(targetId).withLink(parent, "target").withStat(aStat().withMode(0644).withType(REGULAR)).build();
nfsace4[] acl = {};
willThrow(IOException.class).given(inner).setAcl(any(), any());
try {
monitor.setAcl(target, acl);
fail("setAcl unexpectedly succeeded");
} catch (IOException e) {
}
verify(inner).setAcl(target, acl);
verify(receiver, never()).notifyChildEvent(any(), any(), any(), any());
verify(receiver, never()).notifySelfEvent(any(), any(), any());
verify(receiver, never()).notifyMovedEvent(any(), any(), any(), any(), any());
}
Aggregations