From 96ed2cc17aaaaf3914dbd9b4b74e85160be9b39c Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Tue, 13 Nov 2018 16:00:41 -0800 Subject: [PATCH] setup interface for IDA --- p2p/ida/ida.go | 11 +++++++++++ p2p/ida/interface.go | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 p2p/ida/ida.go create mode 100644 p2p/ida/interface.go diff --git a/p2p/ida/ida.go b/p2p/ida/ida.go new file mode 100644 index 000000000..788e1cbfd --- /dev/null +++ b/p2p/ida/ida.go @@ -0,0 +1,11 @@ +package ida + +// HarmonyIDA implements IDA interface. +type HarmonyIDA struct { + raptorQImp *RaptorQ +} + +// TakeRaptorQ takes RaptorQ implementation. +func (ida *HarmonyIDA) TakeRaptorQ(raptorQImp *RaptorQ) { + ida.raptorQImp = raptorQImp +} diff --git a/p2p/ida/interface.go b/p2p/ida/interface.go new file mode 100644 index 000000000..a1b6d9e67 --- /dev/null +++ b/p2p/ida/interface.go @@ -0,0 +1,22 @@ +package ida + +import ( + "github.com/simple-rules/harmony-benchmark/p2p" +) + +// Symbol is produced from a RaptorQ implementation. +type Symbol []byte + +// Message is type of general message gopssiped +type Message []byte + +// RaptorQ interface. +type RaptorQ interface { + Init() + Process(msg Message) chan Symbol +} + +// IDA interface. +type IDA interface { + Process(msg Message, peers []p2p.Peer, timeout int) +}