Separate v2 and v3 into dedicated directories
[khatus.git] / src / ocaml / lib / khatus_state.ml
diff --git a/src/ocaml/lib/khatus_state.ml b/src/ocaml/lib/khatus_state.ml
deleted file mode 100644 (file)
index 9a77bc6..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-module Cache = Khatus_cache
-module Msg   = Khatus_msg
-module Time  = Khatus_time
-
-type t =
-  { node  : string
-  ; modul : string
-  ; time  : Time.t
-  ; cache : Cache.t
-  }
-
-let init ~node ~modul =
-  { node
-  ; modul
-  ; time  = Time.init
-  ; cache = Cache.create ()
-  }
-
-(* TODO: Should probably wrap state update in result. *)
-let update ({node; modul = _; time; cache} as t) ~msg =
-  Msg.handle_data msg ~otherwise:t ~f:(fun ~node:src_node ~modul ~key ~value ->
-    let time =
-      match (modul, key) with
-      | ("khatus_sensor_datetime", ["epoch"]) when src_node = node ->
-          Time.of_string value  (* Raises if value is not a number *)
-      | (_, _) ->
-          time
-    in
-    Cache.update cache ~node:src_node ~modul ~key ~value ~time;
-    {t with time}
-  )
This page took 0.022296 seconds and 4 git commands to generate.