2024-09-19 20:16:53 +00:00
|
|
|
package wakuv2
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
|
|
|
|
2024-10-24 14:35:01 +00:00
|
|
|
"github.com/status-im/status-go/wakuv2/common"
|
|
|
|
|
2024-09-19 20:16:53 +00:00
|
|
|
"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 {
|
2024-10-24 14:35:01 +00:00
|
|
|
return hr.waku.OnNewEnvelopes(env, common.StoreMessageType, processEnvelopes)
|
2024-09-19 20:16:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (hr *HistoryProcessorWrapper) OnRequestFailed(requestID []byte, peerID peer.ID, err error) {
|
|
|
|
hr.waku.onHistoricMessagesRequestFailed(requestID, peerID, err)
|
|
|
|
}
|