Deployment

The user-mode library comes in two pieces, both of which must be deployed with the application:

  • A Python module named cbfssync.py.
  • A native dynamic library (unmanaged), named as follows:
    • Windows: pycbfssync26.dll (available for x64 and x86 processor architectures)
    • Linux: libpycbfssync.so.26.0 (available for x64 and x86 processor architectures)
    • macOS: libpycbfssync26.0.dylib (available for x64 and ARM64 processor architectures)

Both the module and the native library are included in the product's Python package, <install_dir>\cbfssync-26.0.xxxx.tar.gz, which should be installed using pip: cd C:\path\to\install_dir python -m pip install cbfssync-26.0.xxxx.tar.gz

Once the product's Python package has been installed, the module can be imported and used: from cbfssync import *. Nothing else is required to deploy the application.

As an alternative to installing the module using pip, you can utilize the built-in setuptools module to package the module for deployment or install it to the machine. python setup.py build --build-lib=<app_dir> The above setup command packages the module and native library for deployment. A folder is created in the app_dir directory with the module and the native library packaged inside.

Threading and Concurrency

The class utilizes different underlying technologies on different operating systems. Because of that, the threading model exposed to applications depends in part on the platform class runs on.

NOTE: Even when configured for minimal concurrency, the class always fires events in the context of some worker thread, and not in the thread the class was originally created on. Therefore, applications must be sure to synchronize operations between event handlers and other threads as necessary (including, but not limited to, calls to the class instance, unless a method is explicitly documented as callable within events).

Configuring Event Concurrency

The serialize_events property controls whether events relating to different files should be allowed to fire in parallel on several worker threads, or serialized on a single worker thread. By default, this property is set to seOnMultipleThreads, and events for different files are allowed to fire in parallel.

Windows: Generally speaking, the class always enforces per-file event serialization; that is, events relating to the same file are always fired in sequence regardless of the property value. With per-file event serialization already ensured, the most important concurrency-related consideration is whether to enforce multifile event serialization as well, which is what serialize_events controls. When serialize_events is set to seOnMultipleThreads, the MinWorkerThreadCount, MaxWorkerThreadCount, and WorkerInitialStackSize configuration settings let the application tune the worker thread pool. These settings are ignored when serialize_events is set to seOnOneWorkerThread.

Linux: When serialize_events is set to seOnMultipleThreads, the class may fire events related to the same file concurrently in several threads. If the application is not prepared for that, it should use seOnOneWorkerThread mode.

macOS: The events always fire on a single worker thread, and the serialize_events property has no effect.