cboettig / contentid

:package: R package for working with Content Identifiers
http://cboettig.github.io/contentid
Other
46 stars 2 forks source link

language for working with multiple registries? #7

Closed cboettig closed 4 years ago

cboettig commented 4 years ago

I'm on the fence as to whether this should really be part of the package API in the first place.

Our Registry interface, register() and query(), support the ability to work across multiple registries at once, i.e.

query("https://example.com/data", registries = c("remote", "local"))

with remote being hash-archive.org and local being the local database. Technically one could have multiple local registries, and perhaps other remote registries as well. But then it's not clear what the syntax should be for this.

One might imagine that you call a generic constructor function registry("hash-archive") or registry(dir = "/some/local/path") and then pass those as a list (like a list of connections in the DBI interface) to these functions.

jhpoelen commented 4 years ago

:+1:

cboettig commented 4 years ago

This is done in #9. Rather than define object classes though, I've merely allowed local registries to defined by local paths and remote registries by urls. So you can pass a collection of an arbitrary number/mix of registries to query() and other functions just as registry = c("/path/to/local1", /path/to/local/2") etc (though I'm not sure why you'd maintain two local registries on the same machine). The only remote registry that actually has methods associated with it is https://hash-archive.org, but presumably it would be straight forward to extend this. in any event, I think this provides the cleaner semantics.