Doxense / foundationdb-dotnet-client

C#/.NET Binding for FoundationDB Client API
BSD 3-Clause "New" or "Revised" License
149 stars 33 forks source link

Directory Layer v1.1 #99

Closed KrzysFR closed 4 years ago

KrzysFR commented 4 years ago

Placeholder before the full commentary on this huge pull request!

Change required to the Directory Layer, and the subspace APIs in general, to allow safe caching of directory subspaces, even if the underlying metadata is mutated.

The goals that this PR wants to achieve are the following:

The recently introduced \xFF/metadataVersion key helps in building a metadata cache that is "safe".

We could use this key to keep a cache for the prefix of the different directories, but:

The changes to the DL API have some repercussions on the global API:

This is PR is very large, but unfortunately all these changes have to be done together in order to have a working build.

Most of the changes needed to update existing code:

The most common issue is that there is a lot of code that would run in a non-async handler to Set or Clear some keys, and would used a globally cached Directory subspace instance. This code cannot work anymore, and has to be converted to async in order to call Resolve(..) on the subspace location.

KrzysFR commented 4 years ago

I know that there are still probably some bugs and changes needed to the DL API, but this PR is so big already and require other changes that are not directly related to the DL. We will have to deal with it with other PRs.