-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
- Loading branch information
Showing
4 changed files
with
79 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1 @@ | ||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire. All rights reserved. | ||
Distributed under the ISC license, see terms at the end of the file. | ||
%%NAME%% %%VERSION%% | ||
---------------------------------------------------------------------------*) | ||
|
||
open Lwt.Infix | ||
|
||
let src = Logs.Src.create "irw-polling" ~doc:"Irmin watcher using using polling" | ||
module Log = (val Logs.src_log src : Logs.LOG) | ||
|
||
let with_delay delay = | ||
Log.info (fun l -> l "Polling mode"); | ||
let wait_for_changes () = Lwt_unix.sleep delay >|= fun () -> `Unknown in | ||
Core.create (fun dir -> Hook.v ~wait_for_changes ~dir) | ||
|
||
let mode = `Polling | ||
|
||
let v = | ||
Log.info (fun l -> l "Polling mode"); | ||
let wait_for_changes () = | ||
Lwt_unix.sleep !Core.default_polling_time >|= fun () -> `Unknown | ||
in | ||
Core.create (fun dir -> Hook.v ~wait_for_changes ~dir) | ||
|
||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
---------------------------------------------------------------------------*) | ||
include Polling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1 @@ | ||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire. All rights reserved. | ||
Distributed under the ISC license, see terms at the end of the file. | ||
%%NAME%% %%VERSION%% | ||
---------------------------------------------------------------------------*) | ||
|
||
(** Active polling backend for Irmin watchers. | ||
{e %%VERSION%% — {{:%%PKG_HOMEPAGE%% }homepage}} *) | ||
|
||
open Core | ||
|
||
val with_delay: float -> t | ||
(** [with_delay delay id p f] is the hook calling [f] everytime a | ||
sub-path of [p] is modified. Return a function to call to remove | ||
the hook. Active polling is done every [delay] seconds. *) | ||
|
||
val v: t | ||
(** [v] is [with_delay !default_polling_time]. *) | ||
|
||
val mode: [`Polling] | ||
|
||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
---------------------------------------------------------------------------*) | ||
include module type of struct include Polling end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire. All rights reserved. | ||
Distributed under the ISC license, see terms at the end of the file. | ||
%%NAME%% %%VERSION%% | ||
---------------------------------------------------------------------------*) | ||
|
||
open Lwt.Infix | ||
|
||
let src = Logs.Src.create "irw-polling" ~doc:"Irmin watcher using using polling" | ||
module Log = (val Logs.src_log src : Logs.LOG) | ||
|
||
let with_delay delay = | ||
Log.info (fun l -> l "Polling mode"); | ||
let wait_for_changes () = Lwt_unix.sleep delay >|= fun () -> `Unknown in | ||
Core.create (fun dir -> Hook.v ~wait_for_changes ~dir) | ||
|
||
let mode = `Polling | ||
|
||
let v = | ||
Log.info (fun l -> l "Polling mode"); | ||
let wait_for_changes () = | ||
Lwt_unix.sleep !Core.default_polling_time >|= fun () -> `Unknown | ||
in | ||
Core.create (fun dir -> Hook.v ~wait_for_changes ~dir) | ||
|
||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
---------------------------------------------------------------------------*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire. All rights reserved. | ||
Distributed under the ISC license, see terms at the end of the file. | ||
%%NAME%% %%VERSION%% | ||
---------------------------------------------------------------------------*) | ||
|
||
(** Active polling backend for Irmin watchers. | ||
{e %%VERSION%% — {{:%%PKG_HOMEPAGE%% }homepage}} *) | ||
|
||
open Core | ||
|
||
val with_delay: float -> t | ||
(** [with_delay delay id p f] is the hook calling [f] everytime a | ||
sub-path of [p] is modified. Return a function to call to remove | ||
the hook. Active polling is done every [delay] seconds. *) | ||
|
||
val v: t | ||
(** [v] is [with_delay !default_polling_time]. *) | ||
|
||
val mode: [`Polling] | ||
|
||
(*--------------------------------------------------------------------------- | ||
Copyright (c) 2016 Thomas Gazagnaire | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
---------------------------------------------------------------------------*) |