What's the purpose of the Directory layer?

Yeah, creating the directory instance (i.e., calling create, open, or create_or_open). Listing the directory layer also queries it.

Correct.

Yeah, that is loosely what I meant by a single “usage”, though there’s probably a better term for it. Though different collections might have their own directory (or different “database” where “database” is used to mean “a set of collections”.)

Your approach here looks solid enough to me. Depending on the application, you might be able to still create new subspaces on the fly (for certain definitions of “on the fly”). I’mg going to use your example of a document database with documents, indices, and meta-data about which indices exist. Lets say you wanted to add a new index. In the index meta-data, if you include the (short) subspace prefix, then you can effectively add to your enum on the fly. Now, um, you have to somehow solve the problem of how do you make sure all of your clients get word that the new index exists (but that shouldn’t be too hard, right?), but once you do, you get the subspace prefix virtually for free.

But yeah, a static approach would sound reasonable if you have some notion of what the subspaces might look like a priori, which you probably do.

1 Like