Skip to content

proposal: file system notifications library #15406

Closed
@nathany

Description

@nathany

Propose new package(s) under golang.org/x/ that provide wrappers around x/sys (syscall) or cgo implementations for the following file notification systems:

  • inotify and/or fanotify on Linux/Android
  • FSEvents on OS X
  • ReadDirectoryChangesW and/or USN Journals on Windows
  • kqueue on *BSD, OS X, and iOS
  • FEN on Solaris
  • (optionally) an efficient polling library intended for watching file shares and for Plan 9

Compared to syscall:

  • Provide a slightly higher level API.
    For example, using EpollCreate1 with the file descriptor returned by InotifyInit.
  • Specifically for file system notifications.
    For example, only supporting EVFILT_VNODE for kqueue.
  • Rigorous test suite.
    Checks for compatibility across architectures (Go builders).
  • Go-friendly APIs.
    Write or NoteWrite rather than NOTE_WRITE.

Compared to fsnotify:

  • No attempt to provide common behaviour across notification systems.
  • Expose the full underlying API. For example InCloseWrite and InMoveTo for inotify.
  • Not a common API. Each notification system would have a slightly different API.
  • High quality reviewed code. The Windows code in fsnotify is particularly difficult to follow.

The intent is that libraries such as fsnotify and @rjeczalik's notify could then depend on fsn instead of depending on syscall directly. Such libraries could offer common APIs and behaviour, including user-space recursive watching, filtering, etc. Various APIs could be explored in this space, while relying on the same solid underpinnings.

related: #4068

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions