Skip to content

Commit

Permalink
[maintenance]: drop internal functions from interface
Browse files Browse the repository at this point in the history
These functions are never used outside of the module

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Jun 13, 2023
1 parent 4098aa2 commit aed3f8c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
32 changes: 0 additions & 32 deletions ocaml/database/redo_log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -367,34 +367,6 @@ let rec read_read_response sock fn_db fn_delta expected_gen_count
raise
(CommunicationsProblem ("unrecognised read response prefix [" ^ e ^ "]"))

let action_empty sock _datasockpath =
R.debug "Performing empty" ;
(* Compute desired response time *)
let latest_response_time =
get_latest_response_time !Db_globs.redo_log_max_block_time_empty
in
(* Empty *)
let str = Bytes.of_string "empty_____" in
Unixext.time_limited_write sock (Bytes.length str) str latest_response_time ;
(* Read response *)
let response_length = 10 in
let response =
Unixext.time_limited_read sock response_length latest_response_time
in
match response with
| "empty|ack_" ->
()
| "empty|nack" ->
(* Read the error message *)
let error = read_length_and_string sock latest_response_time in
R.warn "Emptying was unsuccessful: [%s]" error ;
if error = Block_device_io_errors.timeout_error_msg then
raise Unixext.Timeout
else
raise (RedoLogFailure error)
| e ->
raise (CommunicationsProblem ("unrecognised empty response [" ^ e ^ "]"))

let action_read fn_db fn_delta sock datasockpath =
R.debug "Performing read" ;
(* Compute desired response time *)
Expand Down Expand Up @@ -877,10 +849,6 @@ let apply fn_db fn_delta log =
(fun () -> ready_to_write := true)
)

let empty log =
if is_enabled log then
connect_and_perform_action action_empty "invalidate the redo log" log

(** ------------------------------------------------ *)

(** Functions which operate on all active redo_logs. *)
Expand Down
18 changes: 0 additions & 18 deletions ocaml/database/redo_log.mli
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,6 @@ type t =
(** [WriteField (tblname, objref, fldname, newval)]
represents the write to the field with name [fldname] of a row in table [tblname] with key [objref], overwriting its value with [newval]. *)

val write_db :
Generation.t -> (Unix.file_descr -> unit) -> [< `Write] redo_log -> unit
(** Write a database.
This function is best-effort only and does not raise any exceptions in the case of error.
[write_db gen_count f] is used to write a database with generation count [gen_count] to the block device.
A file descriptor is passed to [f] which is expected to write the contents of the database to it. *)

val write_delta :
Generation.t -> t -> (unit -> unit) -> [< `Write] redo_log -> unit
(** Write a database delta.
This function is best-effort only and does not raise any exceptions in the case of error.
[write_delta gen_count delta db_flush_fn] writes a delta [delta] with generation count [gen_count] to the block device.
If the redo log wishes to flush the database before writing the delta, it will invoke [db_flush_fn]. It is expected that this function implicitly attempts to reconnect to the block device I/O process if not already connected. *)

val apply :
(Generation.t -> Unix.file_descr -> int -> float -> unit)
-> (Generation.t -> t -> unit)
Expand All @@ -127,10 +113,6 @@ val apply :
For each database, [db_fn] is invoked with the database's generation count, a file descriptor from which to read the database's contents, the length of the database in bytes and the latest response time. The [db_fn] function may raise {!Unixext.Timeout} if the transfer is not complete by the latest response time.
For each database delta, [delta_fn] is invoked with the delta's generation count and the value of the delta. *)

val empty : [< `RW] redo_log -> unit
(** Invalidate the block device. This means that subsequent attempts to read from the block device will not find anything.
This function is best-effort only and does not raise any exceptions in the case of error. *)

val flush_db_to_redo_log : Db_cache_types.Database.t -> [< `RW] redo_log -> bool
(** Immediately write the given database to the given redo_log instance *)

Expand Down

0 comments on commit aed3f8c

Please sign in to comment.