mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-18 04:40:03 +02:00
transport/channel.go: Rewrite to not use a interface. Action struct has a Channel() method that returns a channel instead.
This commit is contained in:
parent
8e99146cc2
commit
68c21c8ed8
9 changed files with 31 additions and 45 deletions
|
|
@ -46,7 +46,7 @@ func SpawnProccessor(shClient *shipclient.Client, writer transport.Writer, abi *
|
|||
shClient.TraceHandler = processor.processTraces
|
||||
}
|
||||
|
||||
func (processor *ShipProcessor) queueMessage(channel transport.ChannelInterface, payload []byte) bool {
|
||||
func (processor *ShipProcessor) queueMessage(channel transport.Channel, payload []byte) bool {
|
||||
err := processor.writer.Write(channel, payload)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("Failed to post to channel '%s'", channel)
|
||||
|
|
@ -55,7 +55,7 @@ func (processor *ShipProcessor) queueMessage(channel transport.ChannelInterface,
|
|||
return true
|
||||
}
|
||||
|
||||
func (processor *ShipProcessor) encodeQueue(channel transport.ChannelInterface, v interface{}) bool {
|
||||
func (processor *ShipProcessor) encodeQueue(channel transport.Channel, v interface{}) bool {
|
||||
if payload, err := processor.encode(v); err == nil {
|
||||
return processor.queueMessage(channel, payload)
|
||||
}
|
||||
|
|
@ -116,11 +116,11 @@ func (processor *ShipProcessor) processTraces(traces []*ship.TransactionTraceV0)
|
|||
continue
|
||||
}
|
||||
|
||||
channels := []transport.ChannelInterface{
|
||||
transport.ActionChannel{},
|
||||
transport.ActionChannel{Action: string(act.Action)},
|
||||
transport.ActionChannel{Contract: string(act.Contract)},
|
||||
transport.ActionChannel{Action: string(act.Action), Contract: string(act.Contract)},
|
||||
channels := []transport.Channel{
|
||||
transport.Action{}.Channel(),
|
||||
transport.Action{Action: act.Action}.Channel(),
|
||||
transport.Action{Contract: act.Contract}.Channel(),
|
||||
transport.Action{Action: act.Action, Contract: act.Contract}.Channel(),
|
||||
}
|
||||
|
||||
for _, channel := range channels {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue