status-go/wakuv2/history_processor_wrapper.go

27 lines
742 B
Go

package wakuv2
import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/status-im/status-go/wakuv2/common"
"github.com/waku-org/go-waku/waku/v2/api/history"
"github.com/waku-org/go-waku/waku/v2/protocol"
)
type HistoryProcessorWrapper struct {
waku *Waku
}
func NewHistoryProcessorWrapper(waku *Waku) history.HistoryProcessor {
return &HistoryProcessorWrapper{waku}
}
func (hr *HistoryProcessorWrapper) OnEnvelope(env *protocol.Envelope, processEnvelopes bool) error {
return hr.waku.OnNewEnvelopes(env, common.StoreMessageType, processEnvelopes)
}
func (hr *HistoryProcessorWrapper) OnRequestFailed(requestID []byte, peerInfo peer.AddrInfo, err error) {
hr.waku.onHistoricMessagesRequestFailed(requestID, peerInfo, err)
}