# Directory Layer C++

**URL:** <https://forums.foundationdb.org/t/directory-layer-c/2866>\
**Category:** Development\
**Tags:** bindings\
**Created:** [August 26, 2021, 12:42pm UTC](https://forums.foundationdb.org/t/directory-layer-c/2866 "2021-08-26T12:42:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhasne](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/jhasne/32/1137_2.png) [@jhasne](https://forums.foundationdb.org/u/jhasne)\
**Post date:** [August 26, 2021, 12:42pm UTC](https://forums.foundationdb.org/t/directory-layer-c/2866/1 "2021-08-26T12:42:16Z")

</div>

Hi

I am curious why no directory layer was implemented for C++ bindings. And also if it is possible to implement a directory layer similar to Java api in C++. If yes, how would one go around it? Is there any design document for Directory Layer?

---

<div class="post-metadata">

**Author:** ![jkominek](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/jkominek/32/140_2.png) [@jkominek](https://forums.foundationdb.org/u/jkominek)\
**Post date:** [August 30, 2021, 10:11pm UTC](https://forums.foundationdb.org/t/directory-layer-c/2866/2 "2021-08-30T22:11:59Z")

</div>

If you wanted to use the directory layer in C, you’d also need at least some of the tuple layer in C, too.

You can have C code “cooperate” with the directory layer by allocating the directory with some Python code (or whatever), and then finding the subspace prefix that has been assigned, and feeding that to the C code for usage with all of its keys.

---

<div class="post-metadata">

**Author:** ![jhasne](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/jhasne/32/1137_2.png) [@jhasne](https://forums.foundationdb.org/u/jhasne)\
**Post date:** [August 31, 2021, 11:04am UTC](https://forums.foundationdb.org/t/directory-layer-c/2866/3 "2021-08-31T11:04:34Z")

</div>

I am actually planning to create the Tuple layer too for C++. I am mostly unsure about the mappings which fdb does to store directory and subspace prefix, how does it track them back while reading the key.

---

<div class="post-metadata">

**Author:** ![PierreZ](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/pierrez/32/866_2.png) [@PierreZ](https://forums.foundationdb.org/u/PierreZ)\
**Post date:** [September 1, 2021, 2:42pm UTC](https://forums.foundationdb.org/t/directory-layer-c/2866/4 "2021-09-01T14:42:51Z")

</div>

> [@jhasne](#):
>
> I am curious why no directory layer was implemented for C++ bindings

You can find the C++ implementation of the directory layer in the [Flow binding section](https://github.com/apple/foundationdb/tree/master/bindings/flow).

I’m not sure if there are other examples, but the [fdb-document-layer](https://github.com/FoundationDB/fdb-document-layer/search?q=directory) seems to be using the Directory.

> [@jhasne](#):
>
> I am mostly unsure about the mappings which fdb does to store directory and subspace prefix, how does it track them back while reading the key.

> [@jhasne](#):
>
> Is there any design document for Directory Layer?

Disclaimer: I wrote a proposal to the Directory-layer/Partition for the Rust-binding a few months ago.

There is not a lot of design documentation about the Directory {Layer,Partition}. Most(if not all) community bindings and official(go/java/python) have backported the flow code directly. Implementation can be checked with the [BindingTester](https://github.com/apple/foundationdb/tree/master/bindings/bindingtester/spec).
