mirror of https://github.com/status-im/go-waku.git
change ContentTopic from uint32 to string
This commit is contained in:
parent
a84b81b400
commit
ff8d4ef8a4
|
@ -3,7 +3,6 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/binary"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
@ -39,7 +38,7 @@ func (dbStore *DBStore) Put(message *protocol.WakuMessage) error {
|
||||||
func (dbStore *DBStore) GetAll() ([]*protocol.WakuMessage, error) {
|
func (dbStore *DBStore) GetAll() ([]*protocol.WakuMessage, error) {
|
||||||
fmt.Println("TODO: Implement MessageProvider.GetAll. Returning a sample message")
|
fmt.Println("TODO: Implement MessageProvider.GetAll. Returning a sample message")
|
||||||
exampleMessage := new(protocol.WakuMessage)
|
exampleMessage := new(protocol.WakuMessage)
|
||||||
exampleMessage.ContentTopic = 1
|
exampleMessage.ContentTopic = "dingpu"
|
||||||
exampleMessage.Payload = []byte("Hello!")
|
exampleMessage.Payload = []byte("Hello!")
|
||||||
exampleMessage.Version = 0
|
exampleMessage.Version = 0
|
||||||
|
|
||||||
|
@ -115,7 +114,7 @@ var rootCmd = &cobra.Command{
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultContentTopic uint32 = binary.LittleEndian.Uint32([]byte("dingpu"))
|
var DefaultContentTopic string = "dingpu"
|
||||||
|
|
||||||
response, err := wakuNode.Query(DefaultContentTopic, true, 10)
|
response, err := wakuNode.Query(DefaultContentTopic, true, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -196,7 +196,7 @@ func (w *WakuNode) AddStorePeer(address string) error {
|
||||||
return w.store.AddPeer(info.ID, info.Addrs)
|
return w.store.AddPeer(info.ID, info.Addrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *WakuNode) Query(contentTopic uint32, asc bool, pageSize uint64) (*protocol.HistoryResponse, error) {
|
func (w *WakuNode) Query(contentTopic string, asc bool, pageSize uint64) (*protocol.HistoryResponse, error) {
|
||||||
if w.store == nil {
|
if w.store == nil {
|
||||||
return nil, errors.New("WakuStore is not set")
|
return nil, errors.New("WakuStore is not set")
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
type WakuMessage struct {
|
type WakuMessage struct {
|
||||||
Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||||
ContentTopic uint32 `protobuf:"varint,2,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"`
|
ContentTopic string `protobuf:"bytes,2,opt,name=contentTopic,proto3" json:"contentTopic,omitempty"`
|
||||||
Version uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
|
Version uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
Timestamp float64 `protobuf:"fixed64,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
Timestamp float64 `protobuf:"fixed64,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||||
Proof []byte `protobuf:"bytes,21,opt,name=proof,proto3" json:"proof,omitempty"`
|
Proof []byte `protobuf:"bytes,21,opt,name=proof,proto3" json:"proof,omitempty"`
|
||||||
|
@ -74,11 +74,11 @@ func (m *WakuMessage) GetPayload() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *WakuMessage) GetContentTopic() uint32 {
|
func (m *WakuMessage) GetContentTopic() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.ContentTopic
|
return m.ContentTopic
|
||||||
}
|
}
|
||||||
return 0
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *WakuMessage) GetVersion() uint32 {
|
func (m *WakuMessage) GetVersion() uint32 {
|
||||||
|
@ -109,19 +109,19 @@ func init() {
|
||||||
func init() { proto.RegisterFile("waku_message.proto", fileDescriptor_6f0a20862b3bf714) }
|
func init() { proto.RegisterFile("waku_message.proto", fileDescriptor_6f0a20862b3bf714) }
|
||||||
|
|
||||||
var fileDescriptor_6f0a20862b3bf714 = []byte{
|
var fileDescriptor_6f0a20862b3bf714 = []byte{
|
||||||
// 183 bytes of a gzipped FileDescriptorProto
|
// 186 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4f, 0xcc, 0x2e,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4f, 0xcc, 0x2e,
|
||||||
0x8d, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2,
|
0x8d, 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2,
|
||||||
0x00, 0x53, 0xc9, 0xf9, 0x39, 0x4a, 0x33, 0x19, 0xb9, 0xb8, 0xc3, 0x13, 0xb3, 0x4b, 0x7d, 0x21,
|
0x00, 0x53, 0xc9, 0xf9, 0x39, 0x4a, 0x33, 0x19, 0xb9, 0xb8, 0xc3, 0x13, 0xb3, 0x4b, 0x7d, 0x21,
|
||||||
0xf2, 0x42, 0x12, 0x5c, 0xec, 0x05, 0x89, 0x95, 0x39, 0xf9, 0x89, 0x29, 0x12, 0x8c, 0x0a, 0x8c,
|
0xf2, 0x42, 0x12, 0x5c, 0xec, 0x05, 0x89, 0x95, 0x39, 0xf9, 0x89, 0x29, 0x12, 0x8c, 0x0a, 0x8c,
|
||||||
0x1a, 0x3c, 0x41, 0x30, 0xae, 0x90, 0x12, 0x17, 0x4f, 0x72, 0x7e, 0x5e, 0x49, 0x6a, 0x5e, 0x49,
|
0x1a, 0x3c, 0x41, 0x30, 0xae, 0x90, 0x12, 0x17, 0x4f, 0x72, 0x7e, 0x5e, 0x49, 0x6a, 0x5e, 0x49,
|
||||||
0x48, 0x7e, 0x41, 0x66, 0xb2, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6f, 0x10, 0x8a, 0x18, 0x48, 0x77,
|
0x48, 0x7e, 0x41, 0x66, 0xb2, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x8a, 0x18, 0x48, 0x77,
|
||||||
0x59, 0x6a, 0x51, 0x71, 0x66, 0x7e, 0x9e, 0x04, 0x33, 0x58, 0x1a, 0xc6, 0x15, 0x92, 0xe1, 0xe2,
|
0x59, 0x6a, 0x51, 0x71, 0x66, 0x7e, 0x9e, 0x04, 0xb3, 0x02, 0xa3, 0x06, 0x6f, 0x10, 0x8c, 0x2b,
|
||||||
0x2c, 0xc9, 0xcc, 0x4d, 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0x90, 0x60, 0x51, 0x60, 0xd4, 0x60, 0x0c,
|
0x24, 0xc3, 0xc5, 0x59, 0x92, 0x99, 0x9b, 0x5a, 0x5c, 0x92, 0x98, 0x5b, 0x20, 0xc1, 0xa2, 0xc0,
|
||||||
0x42, 0x08, 0x08, 0x89, 0x70, 0xb1, 0x16, 0x14, 0xe5, 0xe7, 0xa7, 0x49, 0x88, 0x82, 0xed, 0x84,
|
0xa8, 0xc1, 0x18, 0x84, 0x10, 0x10, 0x12, 0xe1, 0x62, 0x2d, 0x28, 0xca, 0xcf, 0x4f, 0x93, 0x10,
|
||||||
0x70, 0x9c, 0x04, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6,
|
0x05, 0xdb, 0x09, 0xe1, 0x38, 0x09, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83,
|
||||||
0x19, 0x8f, 0xe5, 0x18, 0x92, 0xd8, 0xc0, 0xee, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc9,
|
0x47, 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0xdd, 0x6d, 0x0c, 0x08, 0x00, 0x00,
|
||||||
0xff, 0x08, 0x77, 0xd4, 0x00, 0x00, 0x00,
|
0xff, 0xff, 0xb0, 0xa0, 0x70, 0x06, 0xd4, 0x00, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *WakuMessage) Marshal() (dAtA []byte, err error) {
|
func (m *WakuMessage) Marshal() (dAtA []byte, err error) {
|
||||||
|
@ -168,10 +168,12 @@ func (m *WakuMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0x18
|
dAtA[i] = 0x18
|
||||||
}
|
}
|
||||||
if m.ContentTopic != 0 {
|
if len(m.ContentTopic) > 0 {
|
||||||
i = encodeVarintWakuMessage(dAtA, i, uint64(m.ContentTopic))
|
i -= len(m.ContentTopic)
|
||||||
|
copy(dAtA[i:], m.ContentTopic)
|
||||||
|
i = encodeVarintWakuMessage(dAtA, i, uint64(len(m.ContentTopic)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0x10
|
dAtA[i] = 0x12
|
||||||
}
|
}
|
||||||
if len(m.Payload) > 0 {
|
if len(m.Payload) > 0 {
|
||||||
i -= len(m.Payload)
|
i -= len(m.Payload)
|
||||||
|
@ -204,8 +206,9 @@ func (m *WakuMessage) Size() (n int) {
|
||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovWakuMessage(uint64(l))
|
n += 1 + l + sovWakuMessage(uint64(l))
|
||||||
}
|
}
|
||||||
if m.ContentTopic != 0 {
|
l = len(m.ContentTopic)
|
||||||
n += 1 + sovWakuMessage(uint64(m.ContentTopic))
|
if l > 0 {
|
||||||
|
n += 1 + l + sovWakuMessage(uint64(l))
|
||||||
}
|
}
|
||||||
if m.Version != 0 {
|
if m.Version != 0 {
|
||||||
n += 1 + sovWakuMessage(uint64(m.Version))
|
n += 1 + sovWakuMessage(uint64(m.Version))
|
||||||
|
@ -293,10 +296,10 @@ func (m *WakuMessage) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 0 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field ContentTopic", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field ContentTopic", wireType)
|
||||||
}
|
}
|
||||||
m.ContentTopic = 0
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
if shift >= 64 {
|
if shift >= 64 {
|
||||||
return ErrIntOverflowWakuMessage
|
return ErrIntOverflowWakuMessage
|
||||||
|
@ -306,11 +309,24 @@ func (m *WakuMessage) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
b := dAtA[iNdEx]
|
b := dAtA[iNdEx]
|
||||||
iNdEx++
|
iNdEx++
|
||||||
m.ContentTopic |= uint32(b&0x7F) << shift
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
if b < 0x80 {
|
if b < 0x80 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthWakuMessage
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthWakuMessage
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.ContentTopic = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
case 3:
|
case 3:
|
||||||
if wireType != 0 {
|
if wireType != 0 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
|
||||||
|
|
|
@ -4,7 +4,7 @@ package protocol;
|
||||||
|
|
||||||
message WakuMessage {
|
message WakuMessage {
|
||||||
bytes payload = 1;
|
bytes payload = 1;
|
||||||
uint32 contentTopic = 2;
|
string contentTopic = 2;
|
||||||
uint32 version = 3;
|
uint32 version = 3;
|
||||||
double timestamp = 4;
|
double timestamp = 4;
|
||||||
bytes proof = 21;
|
bytes proof = 21;
|
||||||
|
|
|
@ -167,7 +167,7 @@ func (m *PagingInfo) GetDirection() PagingInfo_Direction {
|
||||||
}
|
}
|
||||||
|
|
||||||
type HistoryQuery struct {
|
type HistoryQuery struct {
|
||||||
Topics []uint32 `protobuf:"varint,1,rep,packed,name=topics,proto3" json:"topics,omitempty"`
|
Topics []string `protobuf:"bytes,1,rep,name=topics,proto3" json:"topics,omitempty"`
|
||||||
PagingInfo *PagingInfo `protobuf:"bytes,2,opt,name=pagingInfo,proto3" json:"pagingInfo,omitempty"`
|
PagingInfo *PagingInfo `protobuf:"bytes,2,opt,name=pagingInfo,proto3" json:"pagingInfo,omitempty"`
|
||||||
StartTime float64 `protobuf:"fixed64,3,opt,name=startTime,proto3" json:"startTime,omitempty"`
|
StartTime float64 `protobuf:"fixed64,3,opt,name=startTime,proto3" json:"startTime,omitempty"`
|
||||||
EndTime float64 `protobuf:"fixed64,4,opt,name=endTime,proto3" json:"endTime,omitempty"`
|
EndTime float64 `protobuf:"fixed64,4,opt,name=endTime,proto3" json:"endTime,omitempty"`
|
||||||
|
@ -209,7 +209,7 @@ func (m *HistoryQuery) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_HistoryQuery proto.InternalMessageInfo
|
var xxx_messageInfo_HistoryQuery proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *HistoryQuery) GetTopics() []uint32 {
|
func (m *HistoryQuery) GetTopics() []string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Topics
|
return m.Topics
|
||||||
}
|
}
|
||||||
|
@ -367,34 +367,34 @@ func init() {
|
||||||
func init() { proto.RegisterFile("waku_store.proto", fileDescriptor_ca6891f77a46e680) }
|
func init() { proto.RegisterFile("waku_store.proto", fileDescriptor_ca6891f77a46e680) }
|
||||||
|
|
||||||
var fileDescriptor_ca6891f77a46e680 = []byte{
|
var fileDescriptor_ca6891f77a46e680 = []byte{
|
||||||
// 427 bytes of a gzipped FileDescriptorProto
|
// 426 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x51, 0xc1, 0x6e, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x51, 0xc1, 0x6e, 0xd4, 0x30,
|
||||||
0x10, 0xed, 0x92, 0x36, 0xb5, 0x27, 0x81, 0x46, 0x23, 0xa8, 0x4c, 0x05, 0x56, 0xe4, 0x03, 0xe4,
|
0x10, 0xad, 0xd9, 0x76, 0x9b, 0xcc, 0xae, 0xe8, 0x6a, 0x04, 0x55, 0xa8, 0x20, 0x5a, 0xe5, 0x00,
|
||||||
0x80, 0x2c, 0x61, 0xe0, 0xc6, 0xa5, 0x4d, 0x85, 0x88, 0x10, 0xa2, 0x2c, 0x48, 0x3d, 0x56, 0xc6,
|
0x39, 0xa0, 0x48, 0x04, 0xb8, 0x71, 0x69, 0xb7, 0x42, 0xac, 0x10, 0xa2, 0x18, 0xa4, 0x1e, 0xab,
|
||||||
0x1e, 0xac, 0x55, 0xa9, 0xd7, 0xdd, 0x5d, 0x03, 0xed, 0x57, 0x70, 0xe0, 0xc0, 0x9f, 0xf0, 0x0b,
|
0x90, 0x0c, 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7d, 0xfd, 0x15, 0x6e, 0xbc, 0x1d, 0xdb, 0xae, 0x87, 0xbf, 0x03, 0x00, 0x00,
|
||||||
0x00, 0xff, 0xff, 0x7e, 0xa9, 0x5e, 0x0d, 0xef, 0x02, 0x00, 0x00,
|
0xff, 0xff, 0x9f, 0x85, 0xef, 0xfb, 0xef, 0x02, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Index) Marshal() (dAtA []byte, err error) {
|
func (m *Index) Marshal() (dAtA []byte, err error) {
|
||||||
|
@ -535,22 +535,13 @@ func (m *HistoryQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
dAtA[i] = 0x12
|
dAtA[i] = 0x12
|
||||||
}
|
}
|
||||||
if len(m.Topics) > 0 {
|
if len(m.Topics) > 0 {
|
||||||
dAtA4 := make([]byte, len(m.Topics)*10)
|
for iNdEx := len(m.Topics) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
var j3 int
|
i -= len(m.Topics[iNdEx])
|
||||||
for _, num := range m.Topics {
|
copy(dAtA[i:], m.Topics[iNdEx])
|
||||||
for num >= 1<<7 {
|
i = encodeVarintWakuStore(dAtA, i, uint64(len(m.Topics[iNdEx])))
|
||||||
dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80)
|
i--
|
||||||
num >>= 7
|
dAtA[i] = 0xa
|
||||||
j3++
|
|
||||||
}
|
|
||||||
dAtA4[j3] = uint8(num)
|
|
||||||
j3++
|
|
||||||
}
|
}
|
||||||
i -= j3
|
|
||||||
copy(dAtA[i:], dAtA4[:j3])
|
|
||||||
i = encodeVarintWakuStore(dAtA, i, uint64(j3))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
}
|
||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
@ -725,11 +716,10 @@ func (m *HistoryQuery) Size() (n int) {
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Topics) > 0 {
|
if len(m.Topics) > 0 {
|
||||||
l = 0
|
for _, s := range m.Topics {
|
||||||
for _, e := range m.Topics {
|
l = len(s)
|
||||||
l += sovWakuStore(uint64(e))
|
n += 1 + l + sovWakuStore(uint64(l))
|
||||||
}
|
}
|
||||||
n += 1 + sovWakuStore(uint64(l)) + l
|
|
||||||
}
|
}
|
||||||
if m.PagingInfo != nil {
|
if m.PagingInfo != nil {
|
||||||
l = m.PagingInfo.Size()
|
l = m.PagingInfo.Size()
|
||||||
|
@ -1050,81 +1040,37 @@ func (m *HistoryQuery) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType == 0 {
|
if wireType != 2 {
|
||||||
var v uint32
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuStore
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
v |= uint32(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.Topics = append(m.Topics, v)
|
|
||||||
} else if wireType == 2 {
|
|
||||||
var packedLen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuStore
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
packedLen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if packedLen < 0 {
|
|
||||||
return ErrInvalidLengthWakuStore
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + packedLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthWakuStore
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
var elementCount int
|
|
||||||
var count int
|
|
||||||
for _, integer := range dAtA[iNdEx:postIndex] {
|
|
||||||
if integer < 128 {
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elementCount = count
|
|
||||||
if elementCount != 0 && len(m.Topics) == 0 {
|
|
||||||
m.Topics = make([]uint32, 0, elementCount)
|
|
||||||
}
|
|
||||||
for iNdEx < postIndex {
|
|
||||||
var v uint32
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowWakuStore
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
v |= uint32(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.Topics = append(m.Topics, v)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Topics", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Topics", wireType)
|
||||||
}
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowWakuStore
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthWakuStore
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthWakuStore
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Topics = append(m.Topics, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field PagingInfo", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field PagingInfo", wireType)
|
||||||
|
|
|
@ -20,7 +20,7 @@ message PagingInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
message HistoryQuery {
|
message HistoryQuery {
|
||||||
repeated uint32 topics = 1;
|
repeated string topics = 1;
|
||||||
PagingInfo pagingInfo = 2; // used for pagination
|
PagingInfo pagingInfo = 2; // used for pagination
|
||||||
double startTime = 3;
|
double startTime = 3;
|
||||||
double endTime = 4;
|
double endTime = 4;
|
||||||
|
|
|
@ -31,6 +31,7 @@ var log = logging.Logger("wakustore")
|
||||||
const WakuStoreProtocolId = libp2pProtocol.ID("/vac/waku/store/2.0.0-beta1")
|
const WakuStoreProtocolId = libp2pProtocol.ID("/vac/waku/store/2.0.0-beta1")
|
||||||
const MaxPageSize = 100 // Maximum number of waku messages in each page
|
const MaxPageSize = 100 // Maximum number of waku messages in each page
|
||||||
const ConnectionTimeout = 10 * time.Second
|
const ConnectionTimeout = 10 * time.Second
|
||||||
|
const DefaultContentTopic = "/waku/2/default-content/proto"
|
||||||
|
|
||||||
func minOf(vars ...int) int {
|
func minOf(vars ...int) int {
|
||||||
min := vars[0]
|
min := vars[0]
|
||||||
|
@ -133,7 +134,7 @@ func paginateWithoutIndex(list []IndexedWakuMessage, pinfo *protocol.PagingInfo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func contains(s []uint32, e uint32) bool {
|
func contains(s []string, e string) bool {
|
||||||
for _, a := range s {
|
for _, a := range s {
|
||||||
if a == e {
|
if a == e {
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue