MCPcopy Create free account
hub / github.com/baidu/tera / Append

Method Append

src/leveldb/persistent_cache/persistent_cache_file.cc:88–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88Status WriteableCacheFile::Append(const Slice& val) {
89 uint64_t i = 0;
90
91 Status s;
92 while (!(s = cache_->MakeRoomForWrite(val.size())).ok()) {
93 Env::Default()->SleepForMicroseconds(kRetryIntervalUs);
94 if (i++ >= write_retry_times_) {
95 cache_->GetStats()->cache_errors.Inc();
96 return s;
97 }
98 }
99
100 s = file_->Append(val);
101 cache_->GetStats()->write_count.Inc();
102
103 if (s.ok()) {
104 cache_->GetStats()->write_throughput.Add(val.size());
105 } else {
106 cache_->GetStats()->cache_errors.Inc();
107 }
108
109 return s;
110}
111
112void WriteableCacheFile::Close(const Slice& key) {
113 file_.reset();

Callers

nothing calls this directly

Calls 7

IncMethod · 0.80
GetStatsMethod · 0.80
okMethod · 0.45
MakeRoomForWriteMethod · 0.45
sizeMethod · 0.45
SleepForMicrosecondsMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected