-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] add rules for documentation, PR and testing
(#76 )
- Loading branch information
Showing
21 changed files
with
1,014 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Contributing is welcome | ||
|
||
Pull requests are welcome without the need of opening an issue. If you're unsure | ||
about your feature or your implementation open an issue and discuss your | ||
suggested changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!--- Use a prefix like [TASK], [BUGFIX], [DOC] or [TEST] and provide a general summary of your changes in the Title above --> | ||
|
||
## Description | ||
<!--- Describe your changes --> | ||
|
||
## Motivation and Context | ||
<!--- Why is this change required? What problem does it solve? --> | ||
<!--- If it fixes an open issue, please link to the issue here. --> | ||
|
||
## Checklist: | ||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> | ||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> | ||
- [ ] My code follows the code style of this project. | ||
- [ ] I have added also tests for my new code. | ||
- [ ] My change requires a change to the documentation. | ||
- [ ] I have updated the documentation accordingly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Summary | ||
|
||
* [Home](/docs/index.md) | ||
* [About](/docs/home_about.md) | ||
* [Running](/docs/home_running.md) | ||
|
||
* Documentation | ||
* [Build and Install](/docs/docs_install.md) | ||
* [Usage](/docs/docs_usage.md) | ||
* [Quick Configuration](/docs/docs_quick_conf.md) | ||
* [Configuration](/docs/docs_configuration.md) | ||
|
||
* Developing | ||
* [Add new database type](/docs/dev_database.md) | ||
* [Add new output type](/docs/dev_output.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"plugins": [ | ||
"theme-api", | ||
"anchors", | ||
"sitemap" | ||
], | ||
"pluginsConfig": { | ||
"theme-api": { | ||
"split": true, | ||
"languages": [ | ||
{ | ||
"lang": "toml", | ||
"name": "TOML", | ||
"default": true | ||
} | ||
] | ||
}, | ||
"sitemap": { | ||
"hostname": "https://freifunkbremen.gitbooks.io/yanic/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Add new database type | ||
|
||
Write a new package to implement the interface [database.Connection:](https://github.com/FreifunkBremen/yanic/blob/master/database/database.go) | ||
|
||
```go | ||
type Connection interface { | ||
InsertNode(node *runtime.Node) | ||
|
||
InsertLink(*runtime.Link, time.Time) | ||
|
||
InsertGlobals(*runtime.GlobalStats, time.Time, string) | ||
|
||
PruneNodes(deleteAfter time.Duration) | ||
|
||
Close() | ||
} | ||
``` | ||
|
||
**InsertNode** is stores statistics per node | ||
|
||
**InsertLink** is stores statistics per link | ||
|
||
**InsertGlobals** is stores global statistics (by `site_code`, and "global" like in `runtime.GLOBAL_SITE` overall sites). | ||
|
||
**PruneNodes** is prunes historical per-node data | ||
|
||
**Close** is called during shutdown of Yanic. | ||
|
||
|
||
|
||
For startup, you need to bind your database type by calling `database.RegisterAdapter("typeofdatabase",ConnectFunction)` | ||
|
||
it should be in the `func init() {}` of your package. | ||
|
||
|
||
|
||
The _typeofdatabase_ is used as mapping in the configuration `[[database.connection.typeofdatabase]]` the `map[string]interface{}` of the content are parsed to the _ConnectFunction_ and on of your implemented `Connection` or a `error` is needed as result. | ||
|
||
|
||
|
||
Short: the function signature of _ConnectFunction_ should be `func Connect(configuration interface{}) (Connection, error)` | ||
|
||
|
||
|
||
At last add you import string to compile the your database as well in this [all](https://github.com/FreifunkBremen/yanic/blob/master/database/all/main.go) package. | ||
|
||
|
||
|
||
TIP: take a look in the easy database type [logging](https://github.com/FreifunkBremen/yanic/blob/master/database/logging/file.go). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Add new output type | ||
|
||
Write a new package to implement the interface [output.Output:](https://github.com/FreifunkBremen/yanic/blob/master/output/output.go) | ||
|
||
```go | ||
type Output interface { | ||
Save(nodes *runtime.Nodes) | ||
} | ||
``` | ||
|
||
**Save** a pre-filtered state of the Nodes | ||
|
||
|
||
|
||
For startup, you need to bind your output type by calling | ||
`output.RegisterAdapter("typeofoutput",Register)` | ||
|
||
it should be in the `func init() {}` of your package. | ||
|
||
|
||
|
||
The _typeofoutput_ is used as mapping in the configuration `[[nodes.output.typeofoutput]]` the `map[string]interface{}` of the content are parsed to the _Register_ and on of your implemented `Output` or a `error` is needed as result. | ||
|
||
|
||
|
||
Short: the function signature of _Register_ should be `func Register(configuration map[string]interface{}) (Output, error)` | ||
|
||
|
||
|
||
At last add you import string to compile the your database as well in this [all](https://github.com/FreifunkBremen/yanic/blob/master/output/all/main.go) package. |
Oops, something went wrong.