| 123 | } |
| 124 | |
| 125 | Status IGFS::NewAppendableFile(const string &file_name, |
| 126 | std::unique_ptr<WritableFile> *result) { |
| 127 | std::unique_ptr<IGFSClient> client = CreateClient(); |
| 128 | |
| 129 | CtrlResponse<HandshakeResponse> handshake_response(true); |
| 130 | TF_RETURN_IF_ERROR(client->Handshake(&handshake_response)); |
| 131 | |
| 132 | CtrlResponse<ExistsResponse> exists_response(false); |
| 133 | TF_RETURN_IF_ERROR(client->Exists(&exists_response, file_name)); |
| 134 | |
| 135 | if (exists_response.res.exists) { |
| 136 | CtrlResponse<DeleteResponse> del_response(false); |
| 137 | TF_RETURN_IF_ERROR(client->Delete(&del_response, file_name, false)); |
| 138 | } |
| 139 | |
| 140 | CtrlResponse<OpenAppendResponse> open_append_resp(false); |
| 141 | TF_RETURN_IF_ERROR(client->OpenAppend(&open_append_resp, file_name)); |
| 142 | |
| 143 | result->reset(new IGFSWritableFile(TranslateName(file_name), |
| 144 | open_append_resp.res.stream_id, |
| 145 | std::move(client))); |
| 146 | |
| 147 | LOG(INFO) << "New appendable file completed successfully [file_name=" |
| 148 | << file_name << "]"; |
| 149 | |
| 150 | return Status::OK(); |
| 151 | } |
| 152 | |
| 153 | Status IGFS::NewReadOnlyMemoryRegionFromFile( |
| 154 | const string &file_name, std::unique_ptr<ReadOnlyMemoryRegion> *result) { |
nothing calls this directly
no test coverage detected