This is a draft for handling attachment holders.
I wanted to get feedback on the idea as I think it's not perfect and I'm going to try to find a better alternative but that's all I have for now
The problem is that we want to send a list/array using gRPC.
I came across `repeated` fields. It fits well, the problem is that we use `oneof` already in this case (`PullBackupResponse`). `oneof` is pretty good I think because it enforces that only one of the fields is set - it matters here as many times we'll expect te have data chunks reaching the maximum of the gRPC message limit.
t first, I tried to do something like this:
```
message PullBackupResponse {
oneof data {
bytes compactionChunk = 1;
repeated string attachmentHolder = 2;
bytes logChunk = 3;
}
}
```
But the problem is, protobuf forbids using `repeated` inside of `oneof`, one of the protobuf contributors [said](https://github.com/protocolbuffers/protobuf/issues/2592#issuecomment-284540212):
> Repeated oneof was in the initial proposal but as we later found out, there were lots many complicated corner cases in wire and API. We decided not to add repeated for oneof.
A walkaround for this that seems to be a preferred one is the one I put in this diff - see [this comment](https://github.com/protocolbuffers/protobuf/issues/2592#issuecomment-365311139).
I personally don't really like this but I'm afraid there might be no better way of doing this considering also how many likes this comment got and that other people suggested this as well.
What is wrong with this idea: For the rest of the fields, we have to remember to put only one item (`compactionChunk`, `logChunk`) per connection. It is not indicated by the proto schema.