diff --git a/src/lib_shell/http_cache_headers.ml b/src/lib_shell/http_cache_headers.ml new file mode 100644 index 0000000000000000000000000000000000000000..8242cf895e3c71dfa23641bed4185ceaee8c8ff5 --- /dev/null +++ b/src/lib_shell/http_cache_headers.ml @@ -0,0 +1,40 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 TriliTech *) +(* *) +(*****************************************************************************) + +type tools = { + get_estimated_time_to_next_level : unit -> Ptime.span option Lwt.t; +} + +(** [get_estimated_time_to_next_level chain_store] gets the estimated time + to the next level of the main chain *) +let get_estimated_time_to_next_level chain_store = + let open Lwt_option_syntax in + let*! block = Store.Chain.current_head chain_store in + let header = Store.Block.shell_header block in + let*! proto_hash = Store.Block.protocol_hash_exn chain_store block in + let*? (module Http_cache_headers) = + Protocol_plugin.find_http_cache_headers proto_hash + in + let* round_end = + Http_cache_headers.get_round_end_time + ~get_context:(fun () -> Store.Block.context_exn chain_store block) + header + in + let now = Time.System.now () in + if round_end < now then + (* If the round has ended, then the next level block is late. + We cannot be sure when it will arrive. *) + Lwt.return_none + else + let timespan = Ptime.diff round_end now in + return timespan + +let make_tools chain_store = + { + get_estimated_time_to_next_level = + (fun () -> get_estimated_time_to_next_level chain_store); + } diff --git a/src/lib_shell/http_cache_headers.mli b/src/lib_shell/http_cache_headers.mli new file mode 100644 index 0000000000000000000000000000000000000000..634885207287b390bf3e4f5b95015add994792a7 --- /dev/null +++ b/src/lib_shell/http_cache_headers.mli @@ -0,0 +1,16 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 TriliTech *) +(* *) +(*****************************************************************************) + +(** Expose helper tools used for Http cache header middleware. *) + +type tools = { + (* [get_estimated_time_to_next_level ()] gets the estimated time + to the next level of the main chain *) + get_estimated_time_to_next_level : unit -> Ptime.span option Lwt.t; +} + +val make_tools : Store.chain_store -> tools diff --git a/src/lib_shell/node.ml b/src/lib_shell/node.ml index f0d9248e408911bf6785383306956324d34f0c5e..411ce38ffe413bdbbbef2316d86a9c5a096a1625 100644 --- a/src/lib_shell/node.ml +++ b/src/lib_shell/node.ml @@ -1,26 +1,9 @@ (*****************************************************************************) (* *) -(* Open Source License *) -(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) (* Copyright (c) 2018-2024 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) +(* Copyright (c) 2024 TriliTech *) (* *) (*****************************************************************************) @@ -369,6 +352,11 @@ let create ?(sandboxed = false) ?sandbox_parameters ~singleprocess ~version let shutdown node = node.shutdown () +let http_cache_header_tools node = + let store = node.store in + let chain_store = Store.main_chain_store store in + Http_cache_headers.make_tools chain_store + let build_rpc_directory ~node_version ~commit_info node = let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let merge d = dir := Tezos_rpc.Directory.merge !dir d in diff --git a/src/lib_shell/node.mli b/src/lib_shell/node.mli index 4a2f46366478e2eb7907520bba009fdaa9189807..3b32053c8e1cdaa2238be6a70c974abf19bd9b1c 100644 --- a/src/lib_shell/node.mli +++ b/src/lib_shell/node.mli @@ -1,26 +1,9 @@ (*****************************************************************************) (* *) -(* Open Source License *) -(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) -(* Copyright (c) 2018-2021 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2018-2024 Nomadic Labs, *) +(* Copyright (c) 2024 TriliTech *) (* *) (*****************************************************************************) @@ -78,3 +61,7 @@ val build_rpc_directory : commit_info:Octez_node_version.commit_info -> t -> unit Tezos_rpc.Directory.t + +(** [http_cache_header_tools] builds the tools required to expose the node + internals in an abstract way to the http cache header middleware. *) +val http_cache_header_tools : t -> Http_cache_headers.tools diff --git a/src/lib_validation/protocol_plugin.ml b/src/lib_validation/protocol_plugin.ml index b4753e8d57ae7df68e57881b2d56e4c20348abc6..7b7d392aeb3618797c1e6ee675780c990b3e6451 100644 --- a/src/lib_validation/protocol_plugin.ml +++ b/src/lib_validation/protocol_plugin.ml @@ -1,26 +1,9 @@ (*****************************************************************************) (* *) -(* Open Source License *) +(* SPDX-License-Identifier: MIT *) (* Copyright (c) 2018 Nomadic Development. *) (* Copyright (c) 2018-2022 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) +(* Copyright (c) 2024 TriliTech *) (* *) (*****************************************************************************) @@ -153,6 +136,15 @@ module type METRICS = sig unit Lwt.t end +module type HTTP_CACHE_HEADERS = sig + val hash : Protocol_hash.t + + val get_round_end_time : + get_context:(unit -> Tezos_protocol_environment.Context.t Lwt.t) -> + Tezos_base.Block_header.shell_header -> + Time.System.t option Lwt.t +end + module Undefined_metrics_plugin (Proto : sig val hash : Protocol_hash.t end) = @@ -168,6 +160,10 @@ let rpc_table : (module RPC) Protocol_hash.Table.t = let metrics_table : (module METRICS) Protocol_hash.Table.t = Protocol_hash.Table.create 5 +let http_cache_headers_table : (module HTTP_CACHE_HEADERS) Protocol_hash.Table.t + = + Protocol_hash.Table.create 5 + let register_rpc (module Rpc : RPC) = assert (not (Protocol_hash.Table.mem rpc_table Rpc.Proto.hash)) ; Protocol_hash.Table.add rpc_table Rpc.Proto.hash (module Rpc) @@ -175,10 +171,22 @@ let register_rpc (module Rpc : RPC) = let register_metrics (module Metrics : METRICS) = Protocol_hash.Table.replace metrics_table Metrics.hash (module Metrics) +let register_http_cache_headers_plugin + (module Http_cache_headers : HTTP_CACHE_HEADERS) = + assert ( + not + (Protocol_hash.Table.mem http_cache_headers_table Http_cache_headers.hash)) ; + Protocol_hash.Table.add + http_cache_headers_table + Http_cache_headers.hash + (module Http_cache_headers) + let find_rpc = Protocol_hash.Table.find rpc_table let find_metrics = Protocol_hash.Table.find metrics_table +let find_http_cache_headers = Protocol_hash.Table.find http_cache_headers_table + let safe_find_metrics hash = match find_metrics hash with | Some proto_metrics -> Lwt.return proto_metrics diff --git a/src/lib_validation/protocol_plugin.mli b/src/lib_validation/protocol_plugin.mli index 5e7cf56c6c7591d047f546ffee0eaf869bd2a0b8..a9f223cc1b3ade649737a78cf30415f8070ef096 100644 --- a/src/lib_validation/protocol_plugin.mli +++ b/src/lib_validation/protocol_plugin.mli @@ -1,26 +1,9 @@ (*****************************************************************************) (* *) -(* Open Source License *) +(* SPDX-License-Identifier: MIT *) (* Copyright (c) 2018 Nomadic Development. *) (* Copyright (c) 2018-2022 Nomadic Labs, *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) +(* Copyright (c) 2024 TriliTech *) (* *) (*****************************************************************************) @@ -193,6 +176,21 @@ module type METRICS = sig unit Lwt.t end +(** Protocol specific plugin to expose helper functions in the + implementation of Http cache headers RPC middleware. *) +module type HTTP_CACHE_HEADERS = sig + val hash : Protocol_hash.t + + (** [get_round_end_time ctx curr_header] gets the time at which the + current round ends which is the time at which the next round starts. + Useful to get an estimate of when the next block should arrive. +*) + val get_round_end_time : + get_context:(unit -> Tezos_protocol_environment.Context.t Lwt.t) -> + Tezos_base.Block_header.shell_header -> + Time.System.t option Lwt.t +end + (** Emtpy metrics module. All metrics are -1. *) module Undefined_metrics_plugin (P : sig val hash : Protocol_hash.t @@ -208,6 +206,8 @@ val register_rpc : (module RPC) -> unit (** Register a metrics plugin module *) val register_metrics : (module METRICS) -> unit +val register_http_cache_headers_plugin : (module HTTP_CACHE_HEADERS) -> unit + (** Retrieves the registered protocol with the provided hash and wraps it together with its validation plugin. @@ -231,3 +231,7 @@ val find_metrics : Protocol_hash.t -> (module METRICS) option (** Same as [find_metrics] but returns [Undefined_metrics_plugin] if not found *) val safe_find_metrics : Protocol_hash.t -> (module METRICS) Lwt.t + +(** Looks for a http cache headers plugin module for a specific protocol *) +val find_http_cache_headers : + Protocol_hash.t -> (module HTTP_CACHE_HEADERS) option diff --git a/src/proto_019_PtParisB/lib_plugin/http_cache_headers.ml b/src/proto_019_PtParisB/lib_plugin/http_cache_headers.ml new file mode 100644 index 0000000000000000000000000000000000000000..120d687a5419448d883614c16d25fe4f976d602b --- /dev/null +++ b/src/proto_019_PtParisB/lib_plugin/http_cache_headers.ml @@ -0,0 +1,61 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 TriliTech *) +(* *) +(*****************************************************************************) + +open Protocol + +let constants_key = [Constants_repr.version; "constants"] + +let durations : Round_repr.Durations.t option ref = ref None + +let get_constants ctxt = + let open Lwt_syntax in + let* bytes_opt = Tezos_protocol_environment.Context.find ctxt constants_key in + match bytes_opt with + | Some bytes -> + return + @@ Data_encoding.Binary.of_bytes_opt + Constants_parametric_repr.encoding + bytes + | None -> return_none + +let get_durations ctx = + let open Lwt_option_syntax in + match !durations with + | Some durations -> return durations + | None -> + let* {minimal_block_delay; delay_increment_per_round; _} = + get_constants ctx + in + Lwt.return + @@ Result.to_option + (Round_repr.Durations.create + ~first_round_duration:minimal_block_delay + ~delay_increment_per_round) + +let get_round_end_time ~get_context + (curr_header : Tezos_base.Block_header.shell_header) = + let open Lwt_option_syntax in + let* durations = + match !durations with + | Some durations -> return durations + | None -> + let* ctx = Lwt.map Option.some (get_context ()) in + get_durations ctx + in + let* round_duration = + let+ round = + Lwt.return + @@ Result.to_option (Fitness_repr.round_from_raw curr_header.fitness) + in + Round_repr.Durations.round_duration durations round + in + let round_end_timestamp = + Time.Protocol.add + curr_header.timestamp + (Period_repr.to_seconds round_duration) + in + return (Time.System.of_protocol_exn round_end_timestamp) diff --git a/src/proto_019_PtParisB/lib_plugin/http_cache_headers.mli b/src/proto_019_PtParisB/lib_plugin/http_cache_headers.mli new file mode 100644 index 0000000000000000000000000000000000000000..4d0108ab1f0702dcc5710e8ac8b062f4c38e8f64 --- /dev/null +++ b/src/proto_019_PtParisB/lib_plugin/http_cache_headers.mli @@ -0,0 +1,16 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 TriliTech *) +(* *) +(*****************************************************************************) + +(** [get_round_end_time get_context header] gets the time at which the + current round ends which is the time at which the next round starts. + Useful to get an estimate of when the next block should arrive. + [get_context] is called the first time this function is called to + get the current constants. *) +val get_round_end_time : + get_context:(unit -> Tezos_protocol_environment.Context.t Lwt.t) -> + Block_header.shell_header -> + Time.System.t option Lwt.t diff --git a/src/proto_019_PtParisB/lib_plugin/plugin.ml b/src/proto_019_PtParisB/lib_plugin/plugin.ml index 8fb75ce08aad3a915365d8a83f19269a66b33790..2e1a4e4ce954bb020863d2f53abdfaeaaf084c05 100644 --- a/src/proto_019_PtParisB/lib_plugin/plugin.ml +++ b/src/proto_019_PtParisB/lib_plugin/plugin.ml @@ -30,3 +30,4 @@ module View_helpers = View_helpers module RPC = RPC module Metrics = Metrics_plugin module Script_interpreter_logging = Script_interpreter_logging +module Http_cache_headers = Http_cache_headers diff --git a/src/proto_019_PtParisB/lib_plugin/plugin_registerer.ml b/src/proto_019_PtParisB/lib_plugin/plugin_registerer.ml index a34184865ed402c825ac1ac7c95cd6f6af7f5c8f..bc4f1d895d73234c252aca0c24398364e1c22656 100644 --- a/src/proto_019_PtParisB/lib_plugin/plugin_registerer.ml +++ b/src/proto_019_PtParisB/lib_plugin/plugin_registerer.ml @@ -39,8 +39,17 @@ module Metrics = struct let hash = Registerer.Registered.hash end +module Http_cache_headers = struct + include Plugin.Http_cache_headers + + let hash = Registerer.Registered.hash +end + let () = Protocol_plugin.register_validation_plugin (module Validation) let () = Protocol_plugin.register_rpc (module RPC) let () = Protocol_plugin.register_metrics (module Metrics) + +let () = + Protocol_plugin.register_http_cache_headers_plugin (module Http_cache_headers) diff --git a/src/proto_alpha/lib_plugin/http_cache_headers.ml b/src/proto_alpha/lib_plugin/http_cache_headers.ml new file mode 100644 index 0000000000000000000000000000000000000000..120d687a5419448d883614c16d25fe4f976d602b --- /dev/null +++ b/src/proto_alpha/lib_plugin/http_cache_headers.ml @@ -0,0 +1,61 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 TriliTech *) +(* *) +(*****************************************************************************) + +open Protocol + +let constants_key = [Constants_repr.version; "constants"] + +let durations : Round_repr.Durations.t option ref = ref None + +let get_constants ctxt = + let open Lwt_syntax in + let* bytes_opt = Tezos_protocol_environment.Context.find ctxt constants_key in + match bytes_opt with + | Some bytes -> + return + @@ Data_encoding.Binary.of_bytes_opt + Constants_parametric_repr.encoding + bytes + | None -> return_none + +let get_durations ctx = + let open Lwt_option_syntax in + match !durations with + | Some durations -> return durations + | None -> + let* {minimal_block_delay; delay_increment_per_round; _} = + get_constants ctx + in + Lwt.return + @@ Result.to_option + (Round_repr.Durations.create + ~first_round_duration:minimal_block_delay + ~delay_increment_per_round) + +let get_round_end_time ~get_context + (curr_header : Tezos_base.Block_header.shell_header) = + let open Lwt_option_syntax in + let* durations = + match !durations with + | Some durations -> return durations + | None -> + let* ctx = Lwt.map Option.some (get_context ()) in + get_durations ctx + in + let* round_duration = + let+ round = + Lwt.return + @@ Result.to_option (Fitness_repr.round_from_raw curr_header.fitness) + in + Round_repr.Durations.round_duration durations round + in + let round_end_timestamp = + Time.Protocol.add + curr_header.timestamp + (Period_repr.to_seconds round_duration) + in + return (Time.System.of_protocol_exn round_end_timestamp) diff --git a/src/proto_alpha/lib_plugin/http_cache_headers.mli b/src/proto_alpha/lib_plugin/http_cache_headers.mli new file mode 100644 index 0000000000000000000000000000000000000000..4d0108ab1f0702dcc5710e8ac8b062f4c38e8f64 --- /dev/null +++ b/src/proto_alpha/lib_plugin/http_cache_headers.mli @@ -0,0 +1,16 @@ +(*****************************************************************************) +(* *) +(* SPDX-License-Identifier: MIT *) +(* Copyright (c) 2024 TriliTech *) +(* *) +(*****************************************************************************) + +(** [get_round_end_time get_context header] gets the time at which the + current round ends which is the time at which the next round starts. + Useful to get an estimate of when the next block should arrive. + [get_context] is called the first time this function is called to + get the current constants. *) +val get_round_end_time : + get_context:(unit -> Tezos_protocol_environment.Context.t Lwt.t) -> + Block_header.shell_header -> + Time.System.t option Lwt.t diff --git a/src/proto_alpha/lib_plugin/plugin.ml b/src/proto_alpha/lib_plugin/plugin.ml index 8fb75ce08aad3a915365d8a83f19269a66b33790..a43e98f0dd76fbec074f57452963fb3b30211602 100644 --- a/src/proto_alpha/lib_plugin/plugin.ml +++ b/src/proto_alpha/lib_plugin/plugin.ml @@ -3,7 +3,7 @@ (* Open Source License *) (* Copyright (c) 2018 Nomadic Development. *) (* Copyright (c) 2021-2022 Nomadic Labs, *) -(* Copyright (c) 2022 TriliTech *) +(* Copyright (c) 2022-2024 TriliTech *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -30,3 +30,4 @@ module View_helpers = View_helpers module RPC = RPC module Metrics = Metrics_plugin module Script_interpreter_logging = Script_interpreter_logging +module Http_cache_headers = Http_cache_headers diff --git a/src/proto_alpha/lib_plugin/plugin_registerer.ml b/src/proto_alpha/lib_plugin/plugin_registerer.ml index a34184865ed402c825ac1ac7c95cd6f6af7f5c8f..8ca19d8ba80f86f3969196f2cc70db88ef6e5fb3 100644 --- a/src/proto_alpha/lib_plugin/plugin_registerer.ml +++ b/src/proto_alpha/lib_plugin/plugin_registerer.ml @@ -1,25 +1,8 @@ (*****************************************************************************) (* *) -(* Open Source License *) +(* SPDX-License-Identifier: MIT *) (* Copyright (c) 2021 Nomadic Development. *) -(* *) -(* Permission is hereby granted, free of charge, to any person obtaining a *) -(* copy of this software and associated documentation files (the "Software"),*) -(* to deal in the Software without restriction, including without limitation *) -(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) -(* and/or sell copies of the Software, and to permit persons to whom the *) -(* Software is furnished to do so, subject to the following conditions: *) -(* *) -(* The above copyright notice and this permission notice shall be included *) -(* in all copies or substantial portions of the Software. *) -(* *) -(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) -(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) -(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) -(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) -(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) -(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) -(* DEALINGS IN THE SOFTWARE. *) +(* Copyright (c) 2024 TriliTech *) (* *) (*****************************************************************************) @@ -39,8 +22,17 @@ module Metrics = struct let hash = Registerer.Registered.hash end +module Http_cache_headers = struct + include Plugin.Http_cache_headers + + let hash = Registerer.Registered.hash +end + let () = Protocol_plugin.register_validation_plugin (module Validation) let () = Protocol_plugin.register_rpc (module RPC) let () = Protocol_plugin.register_metrics (module Metrics) + +let () = + Protocol_plugin.register_http_cache_headers_plugin (module Http_cache_headers)