package mnet
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
An implementation of TCP (Transmission Control Protocol) in OCaml for Miou & Solo5
Install
dune-project
Dependency
Authors
Maintainers
Sources
mnet-0.0.4.tbz
sha256=154c3b18bbb019535a4f37d1fefa3c6131b636e53316a63b395d030b186f2a59
sha512=894d12ff3140b294de1129f76893b295e73093101edec137ba2b2106059081f94385e3e3420c48cde14df6aefbef333bec12f5772c1b85c7ecc73dcde9e5bb8c
doc/src/mnet.arpv4/table.ml.html
Source file table.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46module type V = sig type t val is_disposable : t -> bool end module Make (K : Hashtbl.HashedType) (V : V) = struct module W = struct type t = Weight let weight Weight = 1 end module Lru = Lru.M.Make (K) (W) type key = K.t type value = V.t type t = { entries: (key, value) Hashtbl.t; disposables: Lru.t } let create size = { entries= Hashtbl.create size; disposables= Lru.create size } let add t key value = Hashtbl.replace t.entries key value; if V.is_disposable value then Lru.add key Weight t.disposables else Lru.remove key t.disposables; while Lru.weight t.disposables > Lru.capacity t.disposables do match Lru.lru t.disposables with | None -> () | Some (key', Weight) -> Hashtbl.remove t.entries key'; Lru.remove key' t.disposables done let find t key = Lru.promote key t.disposables; Hashtbl.find t.entries key let remove t key = Hashtbl.remove t.entries key; Lru.remove key t.disposables let fold fn t acc = Hashtbl.fold fn t.entries acc let reset t = Hashtbl.reset t.entries let iter fn t = Hashtbl.iter fn t.entries end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>