Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irmin-pack: compile-time and run-time configurations #2152

Open
adatario opened this issue Dec 9, 2022 · 0 comments
Open

irmin-pack: compile-time and run-time configurations #2152

adatario opened this issue Dec 9, 2022 · 0 comments

Comments

@adatario
Copy link
Contributor

adatario commented Dec 9, 2022

Currently when instantiating an irmin-pack.unix store there are two configuration objects that need to be passed in:

  1. When instantiating a Maker module using the Irmin_pack.Conf.S module.:
module Maker (Config : Irmin_pack.Conf.S) : Store_intf.Maker_persistent
module KV (Config : Irmin_pack.Conf.S) : Store_intf.KV
  1. When v'ing a Repo with a Irmin.Conf.t object:
let* repo = Store.Repo.v 
  (Irmin_pack.config  ~fresh ~index_log_size ~merge_throttle ~indexing_strategy
      ~dict_auto_flush_threshold ~suffix_auto_flush_threshold root)

I'll call the configurations passed to the functor the "compile-time" configurations and the configuration passed to Repo.v as "run-time" configuration.

This is a common pattern in at least one other Irmin backend (irmin-fs).

It seems understandable that there are compile-time configurations and run-time configurations and it makes sense to pack compile-time configurations into an OCaml module as it might contain entire modules (instead of just values).

However, currently compile-time configurations to irmin-pack (and irmin-fs) are just values and the decision what values are compile-time and what values are run-time values seems confusing. For example contents_length_header : length_header is a compile-time configuration whereas index_log_size : int is a run-time configuration.

Possible courses of actions:

  • Improve documentation with explanation of run-time and compile-time configurations and rationale why certain configurations are passed at which stage.
  • Rename the compile-time configurations to Irmin_pack.Schema. This would be like the Irmin.Schema but with backend specific compile-time configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant