-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
292 additions
and
284 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 |
---|---|---|
@@ -1,21 +1,18 @@ | ||
### How to contribute? | ||
|
||
All contributors are welcome! | ||
|
||
You can choose to contribute in multiple ways: | ||
- comment and pick up an [issue](https://github.com/danalex97/Speer/issues) | ||
- create a [new issue](ISSUE_TEMPLATE/feature_request.md) | ||
- mail me on *dan.alex97@yahoo.com* and ask for work | ||
- take a look at the [contributor thread](https://github.com/danalex97/Speer/issues/33) | ||
- mail me on dan.alex97@yahoo.com and ask for work | ||
|
||
If you are not sure how you can contribute write onto the [contributor thread](https://github.com/danalex97/Speer/issues/33). | ||
If you are not sure how you can contribute write in the [contributor thread](https://github.com/danalex97/Speer/issues/33). | ||
|
||
Once you finish the work on an issue, you can create a [pull request](PULL_REQUEST_TEMPLATE.md). You can use one of the templates for [bugs](ISSUE_TEMPLATE/bug_report.md) or [feature requests](ISSUE_TEMPLATE/feature_request.md). | ||
Once you finish the work on an issue, you can create a [pull request](PULL_REQUEST_TEMPLATE.md). Github will let you choose between the templates for [bugs](ISSUE_TEMPLATE/bug_report.md) and [feature requests](ISSUE_TEMPLATE/feature_request.md). | ||
|
||
#### What to work on? | ||
|
||
If you do not know what to implement/work on: | ||
- check our [issues](https://github.com/danalex97/Speer/issues) | ||
- check our [roadmap](../docs/roadmap.md) | ||
|
||
#### Workload | ||
|
||
We aim to split the work for the project to be **small over larger periods of times**. We aim for a mean contribution time between **2-3 hours weekly**. We aim for the contributor work onto this project to be recreational rather than stressful. |
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
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,56 @@ | ||
# Examples | ||
|
||
### Examples | ||
|
||
Before running the examples, move to the installation directory of Speer: | ||
``` | ||
cd $GOPATH/src/github.com/danalex97/Speer | ||
``` | ||
|
||
We provide the following examples: | ||
``` | ||
go run speer.go -config=examples/config/sink.json | ||
go run speer.go -config=examples/config/broadcast.json | ||
go run speer.go -config=examples/config/data_link.json | ||
``` | ||
|
||
For a more complex example, check this [repository](https://github.com/danalex97/nfsTorrent). | ||
|
||
### Primitives | ||
|
||
Getting the bootstrap node id: | ||
```go | ||
id := util.Join() | ||
``` | ||
|
||
Sending a control message: | ||
|
||
```go | ||
util.Transport().ControlSend(id, "message") | ||
``` | ||
|
||
Receiving a control message: | ||
|
||
```go | ||
msg := <-util.Transport().ControlRecv() | ||
``` | ||
|
||
Sending data via a link: | ||
|
||
```go | ||
// Creating the link | ||
link := util.Transport().Connect(id) | ||
|
||
// Sending the data | ||
link.Upload(Data{ | ||
Id : "someUniqueId", // Some ID associated with the message. | ||
// The ID can be used for keeping the actual data or metadata. | ||
Size : 1000, // Total data size in bits. | ||
}) | ||
``` | ||
|
||
Getting data from a link: | ||
|
||
```go | ||
data := <-link.Download() | ||
``` |
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,54 @@ | ||
# Golang SDK | ||
|
||
The current implementation provides a Golang SDK. In order to be able to use the simulator, the user can implement the **Node** interface. | ||
|
||
Each interface comes with a **Util** interface provided to the user for interacting with a simulation: | ||
```go | ||
// This interface needs to be implemented by a node. | ||
type Node interface { | ||
// constructor interface | ||
New(util NodeUtil) Node | ||
|
||
// The general method that is just a runner. | ||
OnJoin() | ||
|
||
// A method that should be called when a node leaves the network. | ||
OnLeave() | ||
} | ||
``` | ||
|
||
A user needs to implement all the methods provided below to obtain a valid node to use in a simulation: | ||
```go | ||
import ( | ||
. "github.com/danalex97/Speer/interfaces" | ||
) | ||
|
||
type Example struct { | ||
//[...] | ||
} | ||
|
||
func (s *Example) OnJoin() { | ||
//[...] | ||
} | ||
|
||
func (s *Example) OnLeave() { | ||
//[...] | ||
} | ||
|
||
func (s *Example) New(util Util) Node { | ||
//[...] | ||
} | ||
``` | ||
|
||
The `New` function is used to generate new nodes from an empty structure template. The structure `NodeUtil` provides a set of functions which `Example` can use to interact with the simulation: | ||
```go | ||
// The Util interface is provided to a node. | ||
type NodeUtil interface { | ||
Transport() Transport // Interface used to send data to other nodes. | ||
|
||
Id() string // The ID of the node. | ||
Join() string // The ID of another node in the network. | ||
|
||
Time() func() int // Function that can be used to retrieve the simulation global virtual time. | ||
} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.