This file contains hidden or 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
type ForwardEntry struct { | |
// Incoming is port id attached to switch | |
Incoming Id | |
// Addr is destination node address | |
Addr types.HwAddr | |
// Time is timestamp when this entry is created | |
Time time.Time | |
} |
This file contains hidden or 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
package link | |
type Transmitter interface { | |
Transmit(frame []byte) error | |
} | |
type Interface interface { | |
Transmitter | |
EndPoint | |
Address() types.HwAddr |
This file contains hidden or 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
package link | |
type Addr string |
This file contains hidden or 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
package link | |
type Link struct { | |
cost uint | |
ep1 EndPoint | |
ep2 EndPoint | |
} | |
func (l *Link) AttachEndpoint(ep EndPoint) error { | |
... |
This file contains hidden or 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
package na | |
// Card is abstracted network adapter part to simulate bytes transport on | |
// physical cable. Node's interface uses this interface to send frame | |
// between nodes. | |
type Card interface { | |
Send(buf []byte, addr string) (time.Time, error) | |
Recv() <-chan *FrameData | |
} |
This file contains hidden or 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
package link | |
type Addr string |
This file contains hidden or 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
package main | |
import ( | |
"bytes" | |
"encoding/hex" | |
"fmt" | |
"github.com/btcsuite/btcd/btcec" | |
"github.com/btcsuite/btcd/chaincfg" | |
"github.com/btcsuite/btcd/chaincfg/chainhash" |
This file contains hidden or 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
let allGood = true; | |
proposalResponses.forEach((pr) => { | |
let oneGood = false; | |
if (pr.response && pr.response.status === 200) { | |
oneGood = true; | |
logger.info('install proposal was good'); | |
} else { | |
logger.error('install proposal was bad'); | |
} |
This file contains hidden or 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
package main | |
import ( | |
"sync" | |
"fmt" | |
) | |
var wg = sync.WaitGroup{} | |
func main() { |
This file contains hidden or 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
/* | |
* referenced | |
* 1. http://www.techiedelight.com/min-heap-max-heap-implementation-in-java/ | |
* 2. https://gist.github.com/flexelem/70b120ac9bf2965f419f | |
* */ | |
class MinHeap<E extends Comparable<E>> { | |
private ArrayList<E> heap; | |
MinHeap() { | |
heap = new ArrayList<>(); |