Git Product home page Git Product logo

panoptes's Introduction

catch logo

Build Status

What is Panoptes?

Panoptes is a cross-platform file watcher library for C++17 using std::filesystem and native interfaces. It is tested on Linux, Windows and macOS platforms with the help of the test framework Catch2. The main target is to unify the APIs of Windows, Linux and macOS. In an earlier stage Panoptes was a fork of Axosoft nsfw.

What is supported?

Panoptes is observing all changes inside of a given directory. This includes add, modify or remove events. Even the changes inside of subdirectories (recursively) will be detected. Edge cases are covered too in case a file or directory will be moved in or out of the watched directory.

Which native APIs are used by Panoptes?

How to use it

  1. Include Panoptes to your project.
  2. Look into the small console example how to call and use the FileWatcher.

Conan

A conan package of the last release, can be created with the help of conanfile.py.

Wish list

Add rename/move support

Instead of detecting a rename/move event, Panoptes is detecting one add and one remove event. Under Linux in general and since Windows 10, it is possible to connect the add and remove event with each other to one rename/move event. But under MacOS (10.12) it seems to be not possible, because of the internal buffer system.

Direct return of the event in case it was detected

macOS buffers and stashes all detected events over a given time. This means that the callback of the native API is not returning immediately after a filesystem change happens. It waits for some time and then returns a batch of events. If the underlying filesystem is HFS+ (old filesystem of macOS) the buffering time has to be at least 1 second. To unify this experience Panoptes adds a buffer system to Linux and Windows, inspired by macOS. But it would be better if we find a way for macOS to return the results directly, instead of using for every platform a buffer system. With the new macOS filesystem APFS, it is possible to set the buffering time to some nanoseconds.

More

panoptes's People

Contributors

claudious96 avatar dacap avatar trafo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

panoptes's Issues

Issues including library as dependency with CMake

Hi! First of all, thanks for the great work!

I'm trying to include panoptes as a dependecy in a c++ project, I'm trying to include it using CMake (since could be a cross platform project I wanted to avoid the hustle of using conan on different platforms).

In order to include it automatically at configure time, in my CMakeLists.txt I've written

FetchContent_Declare(
        panoptes
        GIT_REPOSITORY https://github.com/neXenio/panoptes.git
        GIT_TAG        v1.0
)
FetchContent_MakeAvailable(panoptes)

However when it comes to building the library, CMake looks for src/ and console/ in the root project directory instead of the subdir inside the build dir.
Having a look at these lines in CMakeLists.txt (#40-45) and changing the CMake variables ${CMAKE_SOURCE_DIR} to ${CMAKE_CURRENT_SOURCE_DIR} builds correctly.

I'm not sure if that's the best way to include the project, I'm obviously open to any advice.
Here is my CMakeLists.txt that works with the fix mentioned above, the CMake version is 3.16.3.

Memory Leak in InotifyTree on Linux

It seems, that mInotifyNodeByWatchDescriptor, allocated with new at InotifyTree.cpp:12 was never freed.

`Direct leak of 3744 byte(s) in 78 object(s) allocated from:
#0 0x7f2324b7c947 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10f947)
#1 0x559aa1714153 in NSFW::InotifyTree::InotifyTree(int, boost::filesystem::path const&, std::shared_ptrNSFW::Collector) /home/templer/Devel/Libs/nsfw/src/linux/InotifyTree.cpp:12

`

Memory Leak in InotifyEventLoop on Linux

The usage of strdup() in InotifyEventLoop on Linux causes a memory leak.

The strdup() function returns a pointer to a new string which is a duplicate of the string s.
Memory for the new string is obtained with malloc, and have to be freed with free (see strdup(3).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.