[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MirageOS-devel] [Irmin] Listing keys at a path



I've tried to follow the tutorial, look at example Irmin usage, and experiment trial-and-error style, but haven't figured this out.

How can I retrieve a list of keys at a given path?

If I've created a Store/View/Config via e.g.:

```
module Store =
  Irmin_mem.Make (Irmin.Contents.String)(Irmin.Ref.String)(Irmin.Hash.SHA1)

module View =
  Irmin.View (Store)

let config =
  Irmin_mem.config ()

let empty =
  Store.Repo.create config
```

What is the relationship between View.db (which is the type required by e.g. View.of_path) and empty (which is a Store.Repo.t, ignoring Lwt)? I can't figure out how to get a View.db given a Store.Repo.t, except perhaps by creating a transaction. But transaction actions are only `Merge | `Rebase | `Update, none of which I want to do.

The example here https://github.com/mirage/irmin/wiki/Irmin-API#listing-sub-paths reference `v`, which is only defined inside of the transaction above, so perhaps reading from Irmin in this way requires a transaction? But transactions must return unit (again, ignore the wrapper types), and so if I want to list keys, should I allocate a ref outside of the transaction and then bash on it in place? But the transaction may be replayed if there was a conflict, so I'll need to first reset the ref?

The example in the API docs (https://mirage.github.io/irmin/Irmin.html#examples) is (presumably?) more up to date, but doesn't include this (ever so slightly) more advanced usage.

Thanks for any help!
_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.