diff --git a/Dockerfile b/Dockerfile index d39a8dc..d9849ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM golang:1.21 as builder -RUN mkdir -p /go/src/github.com/waku-org/test-waku-query/go +RUN mkdir -p /go/src/github.com/waku-org/message-finder -WORKDIR /go/src/github.com/waku-org/test-waku-query/go +WORKDIR /go/src/github.com/waku-org/message-finder ADD . . @@ -11,11 +11,11 @@ RUN make # Copy the binary to the second image FROM debian:12.5-slim -LABEL source="https://github.com/waku-org/test-waku-query/go" +LABEL source="https://github.com/waku-org/message-finder" LABEL description="Storenode query tool" LABEL commit="unknown" -COPY --from=builder /go/src/github.com/waku-org/test-waku-query/go/build/query /usr/local/bin/query +COPY --from=builder /go/src/github.com/waku-org/message-finder/build/query /usr/local/bin/query ENTRYPOINT ["/usr/local/bin/query"] CMD ["-help"] diff --git a/README.md b/README.md index 8b53d42..994b566 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,6 @@ Payload: 00000090 7f d0 aa 56 03 ca 49 eb ef 08 9a ef ca 12 85 72 |...V..I........r| 000000a0 b0 47 79 2b 28 50 06 7d 89 69 d8 85 8e 3c 7f cb |.Gy+(P.}.i...<..| -Meta: Meta: RateLimitProof: ``` @@ -112,10 +111,10 @@ RateLimitProof: ### Docker ``` # Build -docker build -t querytool:latest . +docker build -t storequery:latest . # Execute -docker run querytool:latest \ +docker run storequery:latest \ --cluster-id=16 \ --storenode=/dns4/store-01.do-ams3.shards.test.status.im/tcp/30303/p2p/16Uiu2HAmAUdrQ3uwzuE4Gy4D56hX6uLKEeerJAnhKEHZ3DxF1EfT \ --pubsub-topic=/waku/2/rs/16/32 \ diff --git a/go.mod b/go.mod index 01a3337..3d2cba8 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/libp2p/go-libp2p v0.35.0 github.com/multiformats/go-multiaddr v0.12.4 github.com/rodaine/table v1.2.0 - github.com/stretchr/testify v1.9.0 github.com/urfave/cli/v2 v2.27.2 github.com/waku-org/go-waku v0.8.1-0.20240605190333-d2d2f5672ebd go.uber.org/zap v1.27.0 @@ -119,6 +118,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/stretchr/testify v1.9.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect diff --git a/main.go b/main.go index 80caa86..c90502a 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,6 @@ import ( "github.com/waku-org/go-waku/waku/v2/utils" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "google.golang.org/protobuf/proto" ) type Options struct { @@ -242,6 +241,16 @@ func QueryMessages(ctx context.Context, opts Options) error { } } + var StartTime *int64 + if options.StartTime > 0 { + StartTime = &options.StartTime + } + + var EndTime *int64 + if options.EndTime > 0 { + EndTime = &options.EndTime + } + cnt := 0 if !options.UseLegacy { var criteria store.Criteria @@ -249,8 +258,8 @@ func QueryMessages(ctx context.Context, opts Options) error { if len(hashes) == 0 { criteria = store.FilterCriteria{ ContentFilter: protocol.NewContentFilter(options.PubSubTopic, options.ContentTopics.Value()...), - TimeStart: proto.Int64(options.StartTime), - TimeEnd: proto.Int64(options.EndTime), + TimeStart: StartTime, + TimeEnd: EndTime, } } else { criteria = store.MessageHashCriteria{ @@ -313,8 +322,8 @@ func QueryMessages(ctx context.Context, opts Options) error { query := legacy_store.Query{ PubsubTopic: options.PubSubTopic, ContentTopics: options.ContentTopics.Value(), - StartTime: proto.Int64(options.StartTime), - EndTime: proto.Int64(options.EndTime), + StartTime: StartTime, + EndTime: EndTime, } ctx, cancel := context.WithTimeout(context.Background(), options.QueryTimeout)