regnull / ubikom

Free, secure communications for everyone, powered by decentralized private identity.
MIT License
67 stars 3 forks source link

Check code in store/badger.go #30

Closed regnull closed 3 years ago

regnull commented 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 }

regnull commented 3 years ago

Closing this, store will be deprecated because of migration to IMAP store.