aboutsummaryrefslogtreecommitdiff
path: root/lib/rl.ml
diff options
context:
space:
mode:
authorAdelyn Breelove <[email protected]>2019-02-13 10:58:39 -0700
committerAdelyn Breelove <[email protected]>2019-02-13 10:58:39 -0700
commitafa6b297bd7bf9361727ae78794d9310d3678d13 (patch)
tree7b0a4cda613e07585e16a3bdf48135cecb3b5174 /lib/rl.ml
parentAdd docs to cache (diff)
downloaddisml-afa6b297bd7bf9361727ae78794d9310d3678d13.tar.xz
disml-afa6b297bd7bf9361727ae78794d9310d3678d13.zip
Re-arrange and whatnot
Diffstat (limited to 'lib/rl.ml')
-rw-r--r--lib/rl.ml30
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/rl.ml b/lib/rl.ml
deleted file mode 100644
index f0c15be..0000000
--- a/lib/rl.ml
+++ /dev/null
@@ -1,30 +0,0 @@
-open Core
-open Async
-
-module RouteMap = Map.Make(String)
-
-type rl = {
- limit: int;
- remaining: int;
- reset: int;
-}
-
-type t = ((rl, read_write) Mvar.t) RouteMap.t
-
-let rl_of_header h =
- let module C = Cohttp.Header in
- match C.get h "X-RateLimit-Limit", C.get h "X-RateLimit-Remaining", C.get h "X-RateLimit-Reset" with
- | Some lim, Some rem, Some re ->
- let limit = Int.of_string lim in
- let remaining = Int.of_string rem in
- let reset = Int.of_string re in
- Some { limit; remaining; reset; }
- | _ -> None
-
-let default = { limit = 1; remaining = 1; reset = 0; }
-let empty : t = RouteMap.empty
-let update = RouteMap.update
-let find = RouteMap.find
-let find_exn m s = match find m s with
- | Some r -> r
- | None -> raise (Not_found_s (String.sexp_of_t s)) \ No newline at end of file