From 9e8feea52140222c689af1439eb7be63a9e121da Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Sun, 6 Apr 2025 18:26:13 -0500 Subject: T7321: add discard operation --- src/vyconfd.ml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/vyconfd.ml') diff --git a/src/vyconfd.ml b/src/vyconfd.ml index e531278..e37a6ae 100644 --- a/src/vyconfd.ml +++ b/src/vyconfd.ml @@ -163,6 +163,14 @@ let delete world token (req: request_delete) = response_tmpl with Session.Session_error msg -> {response_tmpl with status=Fail; error=(Some msg)} +let discard world token (_req: request_discard) = + try + let session = Session.discard world (find_session token) + in + Hashtbl.replace sessions token session; + response_tmpl + with Session.Session_error msg -> {response_tmpl with status=Fail; error=(Some msg)} + let load world token (req: request_load) = try let session = Session.load world (find_session token) req.location @@ -266,6 +274,7 @@ let rec handle_connection world ic oc () = | Some t, Validate r -> validate world t r | Some t, Set r -> set world t r | Some t, Delete r -> delete world t r + | Some t, Discard r -> discard world t r | Some t, Load r -> load world t r | Some t, Save r -> save world t r | _ -> failwith "Unimplemented" -- cgit v1.2.3