-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement/delegation-pattern (#17)
* updates * fixed test * updated * updated docs * more docs
- Loading branch information
Showing
34 changed files
with
1,044 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,10 +1,19 @@ | ||
import Foundation | ||
|
||
/// Message represents the message sent between nodes. | ||
public struct Message { | ||
let proto: UBID | ||
let to: Addr | ||
let from: Addr | ||
let message: Data | ||
|
||
/// The message protocol. | ||
public let proto: UBID | ||
|
||
/// The recipient of the message. | ||
public let to: Addr | ||
|
||
/// The sender of the message. | ||
public let from: Addr | ||
|
||
/// The raw message data. | ||
public let message: Data | ||
} | ||
|
||
// @todo encoding and decoding |
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,12 @@ | ||
import Foundation | ||
|
||
/// NodeDelegate is used to handle the receiving of messages. | ||
public protocol NodeDelegate { | ||
|
||
/// Called when a node receives a message. | ||
/// | ||
/// - Parameters: | ||
/// - node: The node that received the message. | ||
/// - message: The received message. | ||
func node(_ node: Node, didReceiveMessage message: Message) // @todo return something? | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without 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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import Foundation | ||
|
||
typealias Addr = [UInt8] // @todo use yeeth multiaddr | ||
/// A node address represented as a byte array. | ||
public typealias Addr = [UInt8] // @todo use yeeth multiaddr | ||
|
||
/// Ultralight Beam specific IDs represented as byte arrays. | ||
public typealias UBID = [UInt8] // @todo might be data? |
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 was deleted.
Oops, something went wrong.
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.