mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-12 14:54:19 +00:00
37 lines
943 B
Go
37 lines
943 B
Go
package store
|
|
|
|
import (
|
|
"github.com/waku-org/go-waku/waku/v2/protocol"
|
|
wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb"
|
|
"github.com/waku-org/go-waku/waku/v2/protocol/store/pb"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
type Criteria interface {
|
|
PopulateStoreRequest(request *pb.StoreQueryRequest)
|
|
}
|
|
|
|
type FilterCriteria struct {
|
|
protocol.ContentFilter
|
|
TimeStart *int64
|
|
TimeEnd *int64
|
|
}
|
|
|
|
func (f FilterCriteria) PopulateStoreRequest(request *pb.StoreQueryRequest) {
|
|
request.ContentTopics = f.ContentTopicsList()
|
|
request.PubsubTopic = proto.String(f.PubsubTopic)
|
|
request.TimeStart = f.TimeStart
|
|
request.TimeEnd = f.TimeEnd
|
|
}
|
|
|
|
type MessageHashCriteria struct {
|
|
MessageHashes []wpb.MessageHash
|
|
}
|
|
|
|
func (m MessageHashCriteria) PopulateStoreRequest(request *pb.StoreQueryRequest) {
|
|
request.MessageHashes = make([][]byte, len(m.MessageHashes))
|
|
for i := range m.MessageHashes {
|
|
request.MessageHashes[i] = m.MessageHashes[i][:]
|
|
}
|
|
}
|