sewenew / redis-protobuf

Redis module for reading and writing Protobuf messages
Apache License 2.0
203 stars 22 forks source link

Not able to interpret imports from proto #13

Closed maddypj closed 4 years ago

maddypj commented 4 years ago

Hello, I am trying to run redis with redis-protobuf ( compiled from source) I am able to run the module fine if the proto files are in flat directory structure.

It doesn't work in the following case- I am trying load protofiles from nested directory structure. The base path is given in --dir option when loading the redis module.

loadmodule <redis-protobuf so path> --dir /a/b/c/

All the protos are located under c

c/d1/p1.proto
c/d1/p2.proto
c/d2/p3.proto

p1.proto has an import

import "d2/p3.proto"

Any of the schemas defined in the given directory structure are not getting loaded. Same is true with standard protos like "google/protobuf/wrappers.proto" I am new to redis-protobuf, any help appreciated. Thanks in advance

Mj

sewenew commented 4 years ago

Hi @maddypj

I've added support for loading nested Protobuf file, and your problem should be solved. Please download the latest code, and have a try.

However, in order to load standard proto files, you need to copy these standard .proto files to /a/b/c/google/protobuf directory, so that redis-protobuf can find them. These standard Proto files should located at protobuf-3.8.0-map-reflection/src/google/protobuf/ directory:

mkdir -p /a/b/c/google/protobuf
cp /path/to/protobuf-3.8.0-map-reflection/src/google/protobuf/*.proto /a/b/c/google/protobuf

If you still have any problem with redis-protobuf, feel free to let me know :)

Regards

sewenew commented 4 years ago

Hi @maddypj

Does the latest code fixed your problem?

Also I've uploaded these standard proto files to GitHub, you can copy these to /a/b/c/google/protobuf directory. And it should work.

If you still have any problem, feel free to let me know :)

Regards

maddypj commented 4 years ago

Hello Sewenew,

Yes it works!! Thank you for fixing it promptly!

Regards