Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

file transfer using gRPC

What is the standard way to use gRPC and protocol buffer to transfer file or images from one process to another? The file is from 1MB to 6MB.

Basically I want to know how to implement sender / receiver code pairs for python, C++ and golang.

http://github.com/johanbrandhorst/chunker

This is the closest I can find so far for golang. I am thinking whether it is extendable to python and c++. A more general approach with less dependencies is preferred.

I am creating multiservices to exchange images btw machines/processes via IPC message passing. Another option is to use shared memory. I am not sure whether Redis can store images

like image 465
cpchung Avatar asked Sep 07 '17 21:09

cpchung


1 Answers

I haven't done that before, but I think this boils down to the types the protocol buffer language supports.

My understanding is that you can use the bytes type since it may contain any arbitrary sequence of bytes. Encode the content before storing it, assign it and "ship it over"!

Have a look here for the scalar types.

Another approach would be to store the file in a location the "services" involved can read — and maybe write if required for some of them. Then send a gRPC message to the "interested" services with the information required to access (or do anything else with) the file(s) in question.

like image 82
x80486 Avatar answered Sep 19 '22 16:09

x80486