Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Is there a way that inotify createEvent can capture the name of the created file?

avatar
New Member

Hi Guys, I am writing a hdfs hook works with the apache atlas, but the atlas hdfs_path type requires the name of the hdfs file, I am currently working with the inotify api but cannot find a way to capture the name of the created file, do you guys have any idea about this?

1 ACCEPTED SOLUTION

avatar
Rising Star

Not sure if I got your question right,

the CreateEvent will contain the HDFS path. The name of the file is part of the HDFS path (comes after the last '/'). I hope this answers your question.

see the inotify patch here, https://issues.apache.org/jira/secure/attachment/12665452/HDFS-6634.9.patch#file-8

/**
* Sent when a new file is created (including overwrite).
*/
public static class CreateEvent extends Event {


public static enum INodeType {
  FILE, DIRECTORY, SYMLINK;
}


private INodeType iNodeType;
private String path;
private long ctime;
private int replication;
private String ownerName;
private String groupName;
private FsPermission perms;
private String symlinkTarget;

View solution in original post

2 REPLIES 2

avatar
Rising Star

Not sure if I got your question right,

the CreateEvent will contain the HDFS path. The name of the file is part of the HDFS path (comes after the last '/'). I hope this answers your question.

see the inotify patch here, https://issues.apache.org/jira/secure/attachment/12665452/HDFS-6634.9.patch#file-8

/**
* Sent when a new file is created (including overwrite).
*/
public static class CreateEvent extends Event {


public static enum INodeType {
  FILE, DIRECTORY, SYMLINK;
}


private INodeType iNodeType;
private String path;
private long ctime;
private int replication;
private String ownerName;
private String groupName;
private FsPermission perms;
private String symlinkTarget;

avatar
New Member

Thanks for your reply, I just realize this is a stupid question lol