├── .gitignore ├── README.md ├── index.cxx ├── index.hxx ├── package.json └── test ├── index └── index.cxx /.gitignore: -------------------------------------------------------------------------------- 1 | /deps 2 | /bin/* 3 | /test/index 4 | /lib/hypercore.so 5 | /lib/hypercore.a 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SYNOPSIS 2 | Hypercore is a secure, distributed append-only log. 3 | 4 | # OBJECTIVES 5 | - `datcxx` should ultimately output Static and Dynamic shared Libraries (so the 6 | internal structure of this project won't matter to the end consumer). 7 | 8 | - You should be able to do something like `[brew|apt] install libdat` and then 9 | `#include ` and use it like it was any other C++ library. 10 | 11 | - It will have a public interface that is at parity with other implementations 12 | (the JavaScript implementation being today's canonical implementation). 13 | 14 | # FAQ 15 | 16 | ``` 17 | Q: Will I need to use `build` if I want to use `datcxx`? 18 | A: No. 19 | ``` 20 | 21 | ``` 22 | Q: I tried brew or apt install but I cant install this. 23 | A: It's not ready yet. 24 | ``` 25 | 26 | # BUILD 27 | To generate a `shared library`, install the [`build`][0] tool and run the 28 | following command... 29 | 30 | Run install and then build. 31 | 32 | ```bash 33 | build i 34 | build test 35 | build run shared 36 | ``` 37 | 38 | If you want to produce a static library run 39 | 40 | ``` 41 | build run static 42 | ``` 43 | 44 | # SEE ALSO 45 | How [dat][1] works. 46 | 47 | [0]:https://github.com/datcxx/build 48 | [1]:https://datprotocol.github.io/how-dat-works/ 49 | -------------------------------------------------------------------------------- /index.cxx: -------------------------------------------------------------------------------- 1 | #include "index.hxx" 2 | #include "deps/datcxx/flat-tree/index.hxx" 3 | 4 | namespace Hypercore { 5 | size_t getIndex () { 6 | return flatTree::index(0, 0); 7 | } 8 | } // namespace Hypercore 9 | -------------------------------------------------------------------------------- /index.hxx: -------------------------------------------------------------------------------- 1 | #ifndef DAT_HYPERCORE_H 2 | #define DAT_HYPERCORE_H 3 | 4 | #include 5 | 6 | namespace Hypercore { 7 | size_t getIndex (); 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hypercore", 3 | "description": "Hypercore is a secure, distributed append-only log.", 4 | "repository": { 5 | "type": "git", 6 | "url": "git@github.com:datcxx/cxx-hypercore.git" 7 | }, 8 | "dependencies": { 9 | "git@github.com:datcxx/cxx-flat-tree": "c051eac4", 10 | "git@github.com:datcxx/cxx-eventemitter": "63d10af1", 11 | "git@github.com:datcxx/cxx-timers": "7d2ff2b7", 12 | "git@github.com:heapwolf/cxx-tap": "07821de0" 13 | }, 14 | "scripts": { 15 | "test": [ 16 | "clang++ -std=c++2a -stdlib=libc++", 17 | "test/index.cxx lib/hypercore.so", 18 | "-o test/index", 19 | "&& ./test/index" 20 | ], 21 | "shared": "", 22 | "static": "" 23 | }, 24 | "flags": [ 25 | "-shared", 26 | "-o ./lib/hypercore.so", 27 | "-std=c++2a", 28 | "-stdlib=libc++", 29 | "-ferror-limit=2" 30 | ], 31 | "files": [ 32 | "index.hxx", 33 | "index.cxx" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /test/index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypercore-cxx/hypercore/fd5b1a0883f8303d08501c99d6d563e4606623b6/test/index -------------------------------------------------------------------------------- /test/index.cxx: -------------------------------------------------------------------------------- 1 | #include "../index.hxx" 2 | #include "../deps/heapwolf/cxx-tap/index.hxx" 3 | 4 | #include 5 | #include 6 | 7 | int main() { 8 | TAP::Test t; 9 | 10 | t.test("sanity", [](auto t) { 11 | t->ok(true, "true is true"); 12 | t->end(); 13 | }); 14 | } 15 | --------------------------------------------------------------------------------