Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 8cf83e9

Browse files
committed
fix(doc): Improve codebase into Doxygen-friendly
Some files and parameters are missing from doxygen-generated documentation. The version name in Dockerfile is bumped. Some documents under tangle-accelerator didn't meet the standard of Markdown. However, fenced code block for bash commands, we are always starting with a `$` which doesn't meet the standard of Markdown.
1 parent f4e18be commit 8cf83e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+583
-391
lines changed

CONTRIBUTING.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
# Contributing to Tangle-accelerator
22

33
When contributing to this repository, please first discuss the change you wish to make via issue,
4-
email, or any other method with the owners of this repository before making a change.
4+
email, or any other method with the owners of this repository before making a change.
55

66
Please note we have a code of conduct, please follow it in all your interactions with the project.
77

88
## Pull Request Process
99

10-
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11-
build.
10+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
1211
2. Create a new branch for fixing or developing the changes.
1312
3. Run test with `bazel test //tests/...`, after finishing the changes.
14-
4. Update the README.md with details of changes to the interface, which includes new environment
15-
variables, exposed ports, useful file locations and container parameters.
13+
4. Update the README.md with details of changes to the interface, which includes new environment variables, exposed ports, useful file locations and container parameters.
1614
5. Run `hooks/formatter` before committing the changes.
1715
6. Rebase to the latest `develop` branch.
1816

1917
## Git Commit Message Guidelines
18+
2019
Read this [blog article](https://chris.beams.io/posts/git-commit/) and [this article](https://www.conventionalcommits.org/en/v1.0.0-beta.2/) and follow the instructions in these articles.
2120
The subject line of git commit message should follow this pattern
2221
`<type>[optional scope]: <description>`
@@ -28,6 +27,21 @@ The `type` includes the following 5 words depending on the content of the commit
2827
* test
2928
* doc
3029

30+
## Doxygen-friendly Representation
31+
32+
Function parameters should be in the following style or [doxygen official example](https://www.doxygen.nl/manual/commands.html#cmdparam) which allows the generating doxygen documentation.
33+
34+
```c
35+
/**
36+
* Copies bytes from a source memory area to a destination memory area,
37+
* where both areas may not overlap.
38+
* @param[out] dest The memory area to copy to.
39+
* @param[in] src The memory area to copy from.
40+
* @param[in] n The number of bytes to copy
41+
*/
42+
void memcpy(void *dest, const void *src, size_t n);
43+
```
44+
3145
## Code of Conduct
3246
3347
### Our Pledge

Doxyfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
DOXYFILE_ENCODING = UTF-8
22
PROJECT_NAME = "tangle-accelerator"
3-
PROJECT_NUMBER = 0.1.0
3+
PROJECT_NUMBER = 0.9.2
44
OUTPUT_DIRECTORY = docs/
55
OPTIMIZE_OUTPUT_FOR_C = YES
66
INPUT = . \
@@ -9,13 +9,19 @@ INPUT = . \
99
accelerator/core/request \
1010
accelerator/core/response \
1111
accelerator/core/serializer \
12+
endpoint \
13+
endpoint/endpointComp \
14+
endpoint/hal \
15+
endpoint \
1216
utils \
17+
utils/cache \
1318
common \
1419
storage \
1520
connectivity/mqtt \
1621
connectivity/http
1722
FILE_PATTERNS = *.h \
18-
*.md
23+
*.md \
24+
*.c
1925
EXAMPLE_PATH = tests
2026
EXAMPLE_PATTERNS = test_*
2127
USE_MDFILE_AS_MAINPAGE = README.md

README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ both footprint and startup time are behaved pretty well.
2828

2929
```
3030
+-------------------------------------------+
31-
+----------+ | +-----------------+ +-----------+ |
31+
+----------+ | +-----------------+ +-----------+ |
3232
| | | | Service | | Cache | |
3333
| Client <-----> | | <---> | | |
3434
| | | | -Explorer | | -Trytes | |
@@ -37,7 +37,7 @@ both footprint and startup time are behaved pretty well.
3737
| | -Proxy | | | |
3838
| +-----------------+ +-----------+ |
3939
| ^ |
40-
+---------|---------------------------------+
40+
+---------|---------------------------------+
4141
v
4242
+-------------------------------------------+
4343
| Full Node |
@@ -52,7 +52,7 @@ both footprint and startup time are behaved pretty well.
5252

5353
`Tangle-accelerator` helps to reattach pending transactions were attached from `Tangle-accelerator`.
5454
Reattachment increases chances of confirmation and prevents messages being pruned when full nodes perform snapshot.
55-
Clients should provide a unique ID as the identifier to each message and it's corresponding transaction hash since a new transaction hash will be generated after reattachment.
55+
Clients should provide a unique ID as the identifier to each message and it's corresponding transaction hash since a new transaction hash will be generated after reattachment.
5656

5757
`Tangle-accelerator` uses ScyllaDB to store each transaction's ID, hash and status(Pending or confirmed). `Tangle-accelerator` will periodically check the status of pending transactions and reattach transactions which have been pended too long. Confirmed transactions will be stored into permanodes.
5858

@@ -61,20 +61,23 @@ Clients can find the transaction alone with wanted message by using the ID to qu
6161
## Connectivity
6262

6363
`Tangle-accelerator`, at this moment, supports the following TCP/IP derived protocols:
64+
6465
* `HTTP`
65-
* `MQTT`
66+
* `MQTT`
6667

6768
### HTTP
69+
6870
`HTTP` can be used in the normal internet service. User can use RESTful APIs to interact with `tangle-accelerator`.
6971

7072
### MQTT
73+
7174
`MQTT` is a lightweight communication protocol which can be used in the IoT scenarios. `Tangle-accelerator`'s support to `MQTT` allows embedded devices to write data on IOTA internet with relative low quality hardware devices. We hope this will speed up DLT into our daily life.
7275

7376
## Documentation
7477

7578
This page contains basic instructions for setting up tangle-accelerator, You can generate full documentation and API reference via Doxygen. The documentation is under `docs/` after generated:
7679

77-
```
80+
```bash
7881
$ doxygen Doxyfile
7982
```
8083

@@ -99,7 +102,7 @@ Before running tangle-accelerator, please edit binding address/port of accelerat
99102
* `http_threads`: Determine thread pool size to process HTTP connections.
100103
* `quiet`: Turn off logging message.
101104

102-
```
105+
```bash
103106
$ make && bazel run //accelerator
104107
```
105108

@@ -114,66 +117,79 @@ Tangle-accelerator supports several different build time options.
114117

115118
Debug mode enables tangle-accelerator to display extra `debug` logs.
116119

120+
```bash
121+
$ bazel run --define build_type=debug //accelerator
117122
```
118-
bazel run --define build_type=debug //accelerator
119-
```
123+
120124
* Profiling Mode
121125

122-
Profiling mode adds `-pg` flag when compiling tangle-accelerator. This allows tangle-accelerator to write profile information for the analysis program gprof.
123-
```
124-
bazel run --define build_type=profile //accelerator
126+
Profiling mode adds `-pg` flag when compiling tangle-accelerator. This allows tangle-accelerator to write profile information for the analysis program gprof.
127+
128+
```bash
129+
$ bazel run --define build_type=profile //accelerator
125130
```
126131

127132
See [docs/build.md](docs/build.md) for more information.
128133

129134
## Developing
130135

131136
The codebase of this repository follows [Google's C++ guidelines](https://google.github.io/styleguide/cppguide.html):
132-
- Please run `hooks/autohook.sh install` after initial checkout.
133-
- Pass `-c dbg` for building with debug symbols.
137+
138+
* Please run `hooks/autohook.sh install` after initial checkout.
139+
* Pass `-c dbg` for building with debug symbols.
134140

135141
### Tools required for running git commit hook
136-
- buildifier
137-
- clang-format
142+
143+
* buildifier
144+
* clang-format
138145

139146
### Buildifier
147+
140148
Buildifier can be installed with `bazel` or `go`
141149

142150
#### Install with go
151+
143152
1. change directory to `$GOPATH`
144153
2. run `$ go get github.com/bazelbuild/buildtools/buildifier`
145154
The executable file will be located under `$GOPATH/bin`
146155
3. make a soft link for global usage, run
147156
`$ sudo ln -s $HOME/go/bin/buildifier /usr/bin/buildifier`
148157

149158
#### Install with bazel
159+
150160
1. clone `bazelbuild/buildtools` repository
151161
`$ git clone https://github.com/bazelbuild/buildtools.git`
152162
2. change directory to `buildtools`
153163
3. build it with bazel command, `$ bazel build //buildifier`
154164
The executable file will be located under `path/to/buildtools/bazel-bin`
155-
4. make a soft link or move the executable file under `/usr/bin`
165+
4. make a soft link or move the executable file under `/usr/bin`
156166

157167
### clang-format
168+
158169
clang-format can be installed by command:
159-
- Debian/Ubuntu based systems: `$ sudo apt-get install clang-format`
160-
- macOS: `$ brew install clang-format`
161170

171+
* Debian/Ubuntu based systems: `$ sudo apt-get install clang-format`
172+
* macOS: `$ brew install clang-format`
162173

163174
## Usage
175+
164176
`Tangle-accelerator` currently supports two categories of APIs
177+
165178
* Direct API: check [wiki page](https://github.com/DLTcollab/tangle-accelerator/wiki) for details.
166179
* Proxy API to IOTA core functionalities
167180

168181
### Full Node Proxy API
182+
169183
`tangle-accelerator` allows the use of IOTA core APIs. The calling process does not have to be aware of the destination machine running IOTA full node. With the exactly same format of IOTA core APIs, `tangle-accelerator` would help users forward the request to IOTA full node and forward the response back to users.
170184
We support two way to forward Proxy APIs to IOTA full node:
185+
171186
1. Bypass Proxy APIs directly to IOTA full node.
172187
2. Process the Proxy APIs, then transmit them to IOTA full node.
173188

174189
The user can choose which way they want with CLI argument `--proxy_passthrough`.
175190
All the Proxy APIs are supported with the first way.
176191
However, the second way currently only supports the followings Proxy APIs:
192+
177193
* checkConsistency
178194
* findTransactions
179195
* getBalances
@@ -182,5 +198,6 @@ However, the second way currently only supports the followings Proxy APIs:
182198
* getTrytes
183199

184200
## Licensing
201+
185202
`Tangle-accelerator` is freely redistributable under the MIT License. Use of this source
186203
code is governed by a MIT-style license that can be found in the `LICENSE` file.

0 commit comments

Comments
 (0)