mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-04-03 21:06:33 +00:00
Also, separate out RPC encoding from application logic. Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
20 lines
646 B
OCaml
20 lines
646 B
OCaml
(** The implementation of the store.
|
|
This just looks up the requested page in an Irmin database. *)
|
|
|
|
let src = Logs.Src.create "web.store" ~doc:"Datastore for web server"
|
|
module Log = (val Logs.src_log src: Logs.LOG)
|
|
|
|
module Irmin_store = Irmin_unix.Git.FS.KV(Irmin.Contents.String)
|
|
|
|
open Lwt.Infix
|
|
open Astring
|
|
|
|
let local () =
|
|
let config = Irmin_fs.config "www-data" in
|
|
Irmin_store.Repo.v config >>= fun repo ->
|
|
Irmin_store.of_branch repo Irmin_store.Branch.master >|= fun db ->
|
|
Rpc.Store.local (fun path ->
|
|
Log.info (fun f -> f "Handing request for %a" (Fmt.Dump.list String.dump) path);
|
|
Irmin_store.find db path
|
|
)
|