Closed regnull closed 3 years ago
Specifically, this:
func (b Badger) GetNext(receiverKey []byte) (pb.DMSMessage, error) { prefix := []byte("msg_" + util.SerializedCompressedToAddress(receiverKey)) var msg pb.DMSMessage err := b.db.View(func(txn badger.Txn) error { it := txn.NewIterator(badger.DefaultIteratorOptions) defer it.Close() for it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() { err := it.Item().Value(func(v []byte) error { // TODO: How can this possibly work? msg = &pb.DMSMessage{} return proto.Unmarshal(v, msg) }) if err != nil { return err } return nil } return nil }) if err != nil { return nil, err } return msg, nil }
Closing this, store will be deprecated because of migration to IMAP store.
Specifically, this:
func (b Badger) GetNext(receiverKey []byte) (pb.DMSMessage, error) { prefix := []byte("msg_" + util.SerializedCompressedToAddress(receiverKey)) var msg pb.DMSMessage err := b.db.View(func(txn badger.Txn) error { it := txn.NewIterator(badger.DefaultIteratorOptions) defer it.Close() for it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() { err := it.Item().Value(func(v []byte) error { // TODO: How can this possibly work? msg = &pb.DMSMessage{} return proto.Unmarshal(v, msg) }) if err != nil { return err } return nil } return nil }) if err != nil { return nil, err } return msg, nil }