MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Sync

Method Sync

tensorflow/core/platform/s3/s3_file_system.cc:246–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244 }
245
246 Status Sync() override {
247 if (!outfile_) {
248 return errors::FailedPrecondition(
249 "The internal temporary file is not writable.");
250 }
251 if (!sync_needed_) {
252 return Status::OK();
253 }
254 Aws::S3::Model::PutObjectRequest putObjectRequest;
255 putObjectRequest.WithBucket(bucket_.c_str()).WithKey(object_.c_str());
256 long offset = outfile_->tellp();
257 outfile_->seekg(0);
258 putObjectRequest.SetBody(outfile_);
259 putObjectRequest.SetContentLength(offset);
260 auto putObjectOutcome = this->s3_client_->PutObject(putObjectRequest);
261 outfile_->clear();
262 outfile_->seekp(offset);
263 if (!putObjectOutcome.IsSuccess()) {
264 return errors::Unknown(putObjectOutcome.GetError().GetExceptionName(),
265 ": ", putObjectOutcome.GetError().GetMessage());
266 }
267 return Status::OK();
268 }
269
270 private:
271 string bucket_;

Callers 1

TEST_FFunction · 0.45

Calls 5

FailedPreconditionFunction · 0.85
c_strMethod · 0.80
GetErrorMethod · 0.80
UnknownClass · 0.50
clearMethod · 0.45

Tested by 1

TEST_FFunction · 0.36