| 111 | |
| 112 | |
| 113 | std::vector<char> I3SInterface::fetchBinary(std::string url, |
| 114 | std::string attNum, std::string ext) const |
| 115 | { |
| 116 | const int NumRetries(5); |
| 117 | int retry = 0; |
| 118 | |
| 119 | std::string filepath = m_filename + "/layers/0/" + url + attNum; |
| 120 | // For the REST I3S endpoint there are no file extensions. |
| 121 | std::vector<char> result; |
| 122 | while (true) |
| 123 | { |
| 124 | auto data = m_arbiter.tryGetBinary(filepath); |
| 125 | if (data) |
| 126 | { |
| 127 | result = std::move(*data); |
| 128 | break; |
| 129 | } |
| 130 | if (++retry == NumRetries) |
| 131 | throw EsriError(std::string("Failed to fetch: " + filepath)); |
| 132 | std::this_thread::sleep_for(std::chrono::milliseconds(250)); |
| 133 | } |
| 134 | return result; |
| 135 | } |
| 136 | |
| 137 | } //namespace pdal |