<commit_before>(*
 * Copyright (C) Citrix Systems Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; version 2.1 only. with the special
 * exception on linking described in file LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *)
open Xenops_utils

module D = Debug.Make(struct let name = "xenstore" end)
open D

module Client = Xs_client_unix.Client(Xs_transport_unix_client)
let client = Client.make ()

type domid = int

module Xs = struct
	type domid = int

	type xsh = {
(*
        debug: string list -> string;
*)
        directory : string -> string list;
        read : string -> string;
(*
        readv : string -> string list -> string list;
*)
        write : string -> string -> unit;
(*
        writev : string -> (string * string) list -> unit;
        mkdir : string -> unit;
*)
        rm : string -> unit;
(*
        getperms : string -> perms;
        setpermsv : string -> string list -> perms -> unit;
        introduce : domid -> nativeint -> int -> unit;
        release : domid -> unit;
        resume : domid -> unit;
*)
        setperms : string -> Xs_protocol.ACL.t -> unit;

        getdomainpath : domid -> string;
        watch : string -> string -> unit;
        unwatch : string -> string -> unit;
}

    let ops h = {
        read = Client.read h;
		directory = Client.directory h;
        write = Client.write h;
        rm = Client.rm h;
        setperms = Client.setperms h;
        getdomainpath = Client.getdomainpath h;
        watch = Client.watch h;
        unwatch = Client.unwatch h;
    }
    let with_xs f = Client.with_xs client (fun h -> f (ops h))
    let wait f = Client.wait client (fun h -> f (ops h))

	let daemon_open _ = failwith "daemon_open"

	let close _ = failwith "close"

	let getdomainpath _ _ = failwith "getdomainpath"
end
<commit_msg>Add compatability shim for Xs.transaction<commit_after>(*
 * Copyright (C) Citrix Systems Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; version 2.1 only. with the special
 * exception on linking described in file LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *)
open Xenops_utils

module D = Debug.Make(struct let name = "xenstore" end)
open D

module Client = Xs_client_unix.Client(Xs_transport_unix_client)
let client = Client.make ()

type domid = int

module Xs = struct
	type domid = int

	type xsh = {
(*
        debug: string list -> string;
*)
        directory : string -> string list;
        read : string -> string;
(*
        readv : string -> string list -> string list;
*)
        write : string -> string -> unit;
(*
        writev : string -> (string * string) list -> unit;
        mkdir : string -> unit;
*)
        rm : string -> unit;
(*
        getperms : string -> perms;
        setpermsv : string -> string list -> perms -> unit;
        introduce : domid -> nativeint -> int -> unit;
        release : domid -> unit;
        resume : domid -> unit;
*)
        setperms : string -> Xs_protocol.ACL.t -> unit;

        getdomainpath : domid -> string;
        watch : string -> string -> unit;
        unwatch : string -> string -> unit;
}

    let ops h = {
        read = Client.read h;
		directory = Client.directory h;
        write = Client.write h;
        rm = Client.rm h;
        setperms = Client.setperms h;
        getdomainpath = Client.getdomainpath h;
        watch = Client.watch h;
        unwatch = Client.unwatch h;
    }
    let with_xs f = Client.with_xs client (fun h -> f (ops h))
    let wait f = Client.wait client (fun h -> f (ops h))
	let transaction _ f = Client.with_xst client (fun h -> f (ops h))

	let daemon_open _ = failwith "daemon_open"

	let close _ = failwith "close"

	let getdomainpath _ _ = failwith "getdomainpath"
end

module Xst = Xs

{'fraction_non_alphanumeric': 0.09855334538878843, 'fraction_numerical': 0.0009041591320072332, 'mean_word_length': 2.443579766536965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 62, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4463439', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1280, 'n_words': 503}