@@ -26,14 +26,12 @@ CloudLogWritableFile::CloudLogWritableFile(
2626CloudLogWritableFile::~CloudLogWritableFile () {}
2727
2828const std::chrono::microseconds CloudLogControllerImpl::kRetryPeriod =
29- std::chrono::seconds (30 );
29+ std::chrono::seconds (30 );
3030
31- CloudLogController::~CloudLogController () {
32- }
31+ CloudLogController::~CloudLogController () {}
3332
3433CloudLogControllerImpl::CloudLogControllerImpl (CloudEnv* env)
35- : env_(env), running_(false ) {
36-
34+ : env_(env), running_(false ) {
3735 // Create a random number for the cache directory.
3836 const std::string uid = trim (env_->GetBaseEnv ()->GenerateUniqueId ());
3937
@@ -63,15 +61,15 @@ CloudLogControllerImpl::~CloudLogControllerImpl() {
6361 " [%s] CloudLogController closed." , Name ());
6462}
6563
66- std::string CloudLogControllerImpl::GetCachePath (const Slice& original_pathname) const {
64+ std::string CloudLogControllerImpl::GetCachePath (
65+ const Slice& original_pathname) const {
6766 const std::string & cache_dir = GetCacheDir ();
6867 return cache_dir + pathsep + basename (original_pathname.ToString ());
6968}
7069
71- bool CloudLogControllerImpl::ExtractLogRecord (const Slice& input, uint32_t * operation, Slice* filename,
72- uint64_t * offset_in_file,
73- uint64_t * file_size, Slice* data) {
74-
70+ bool CloudLogControllerImpl::ExtractLogRecord (
71+ const Slice& input, uint32_t * operation, Slice* filename,
72+ uint64_t * offset_in_file, uint64_t * file_size, Slice* data) {
7573 Slice in = input;
7674 if (in.size () < 1 ) {
7775 return false ;
@@ -206,7 +204,9 @@ Status CloudLogControllerImpl::Apply(const Slice& in) {
206204}
207205
208206void CloudLogControllerImpl::SerializeLogRecordAppend (const Slice& filename,
209- const Slice& data, uint64_t offset, std::string* out) {
207+ const Slice& data,
208+ uint64_t offset,
209+ std::string* out) {
210210 // write the operation type
211211 PutVarint32 (out, kAppend );
212212
@@ -220,8 +220,9 @@ void CloudLogControllerImpl::SerializeLogRecordAppend(const Slice& filename,
220220 PutLengthPrefixedSlice (out, data);
221221}
222222
223- void CloudLogControllerImpl::SerializeLogRecordClosed (
224- const Slice& filename, uint64_t file_size, std::string* out) {
223+ void CloudLogControllerImpl::SerializeLogRecordClosed (const Slice& filename,
224+ uint64_t file_size,
225+ std::string* out) {
225226 // write the operation type
226227 PutVarint32 (out, kClosed );
227228
@@ -288,7 +289,7 @@ Status CloudLogControllerImpl::Retry(RetryType func) {
288289 }
289290 return stat;
290291}
291-
292+
292293Status CloudLogControllerImpl::GetFileModificationTime (const std::string& fname,
293294 uint64_t * time) {
294295 Status st = status ();
@@ -298,18 +299,18 @@ Status CloudLogControllerImpl::GetFileModificationTime(const std::string& fname,
298299 Log (InfoLogLevel::DEBUG_LEVEL, env_->info_log_ ,
299300 " [kinesis] GetFileModificationTime logfile %s %s" , pathname.c_str (),
300301 " ok" );
301-
302+
302303 auto lambda = [this , pathname, time]() -> Status {
303- return env_->GetBaseEnv ()->GetFileModificationTime (pathname, time);
304+ return env_->GetBaseEnv ()->GetFileModificationTime (pathname, time);
304305 };
305306 st = Retry (lambda);
306307 }
307308 return st;
308309}
309-
310- Status CloudLogControllerImpl::NewSequentialFile (const std::string& fname,
311- std::unique_ptr<SequentialFile>* result,
312- const EnvOptions& options) {
310+
311+ Status CloudLogControllerImpl::NewSequentialFile (
312+ const std::string& fname, std::unique_ptr<SequentialFile>* result,
313+ const EnvOptions& options) {
313314 // read from Kinesis
314315 Status st = status ();
315316 if (st.ok ()) {
@@ -319,39 +320,39 @@ Status CloudLogControllerImpl::NewSequentialFile(const std::string& fname,
319320 " [%s] NewSequentialFile logfile %s %s" , Name (), pathname.c_str (), " ok" );
320321
321322 auto lambda = [this , pathname, &result, options]() -> Status {
322- return env_->GetBaseEnv ()->NewSequentialFile (pathname, result, options);
323+ return env_->GetBaseEnv ()->NewSequentialFile (pathname, result, options);
323324 };
324325 st = Retry (lambda);
325326 }
326327 return st;
327328}
328329
329- Status CloudLogControllerImpl::NewRandomAccessFile (const std::string& fname,
330- std::unique_ptr<RandomAccessFile>* result,
331- const EnvOptions& options) {
330+ Status CloudLogControllerImpl::NewRandomAccessFile (
331+ const std::string& fname, std::unique_ptr<RandomAccessFile>* result,
332+ const EnvOptions& options) {
332333 Status st = status ();
333334 if (st.ok ()) {
334335 // map pathname to cache dir
335336 std::string pathname = GetCachePath (Slice (fname));
336337 Log (InfoLogLevel::DEBUG_LEVEL, env_->info_log_ ,
337338 " [%s] NewRandomAccessFile logfile %s %s" , Name (), pathname.c_str (),
338339 " ok" );
339-
340+
340341 auto lambda = [this , pathname, &result, options]() -> Status {
341- return env_->GetBaseEnv ()->NewRandomAccessFile (pathname, result, options);
342- };
342+ return env_->GetBaseEnv ()->NewRandomAccessFile (pathname, result, options);
343+ };
343344 st = Retry (lambda);
344345 }
345346 return st;
346347}
347-
348+
348349Status CloudLogControllerImpl::FileExists (const std::string& fname) {
349350 Status st = status ();
350351 if (st.ok ()) {
351352 // map pathname to cache dir
352353 std::string pathname = GetCachePath (Slice (fname));
353354 Log (InfoLogLevel::DEBUG_LEVEL, env_->info_log_ ,
354- " [%s] FileExists logfile %s %s" , Name (), pathname.c_str (), " ok" );
355+ " [%s] FileExists logfile %s %s" , Name (), pathname.c_str (), " ok" );
355356
356357 auto lambda = [this , pathname]() -> Status {
357358 return env_->GetBaseEnv ()->FileExists (pathname);
@@ -360,8 +361,9 @@ Status CloudLogControllerImpl::FileExists(const std::string& fname) {
360361 }
361362 return st;
362363}
363-
364- Status CloudLogControllerImpl::GetFileSize (const std::string& fname, uint64_t * size) {
364+
365+ Status CloudLogControllerImpl::GetFileSize (const std::string& fname,
366+ uint64_t * size) {
365367 Status st = status ();
366368 if (st.ok ()) {
367369 // map pathname to cache dir
@@ -370,7 +372,7 @@ Status CloudLogControllerImpl::GetFileSize(const std::string& fname, uint64_t* s
370372 " [%s] GetFileSize logfile %s %s" , Name (), pathname.c_str (), " ok" );
371373
372374 auto lambda = [this , pathname, size]() -> Status {
373- return env_->GetBaseEnv ()->GetFileSize (pathname, size);
375+ return env_->GetBaseEnv ()->GetFileSize (pathname, size);
374376 };
375377 st = Retry (lambda);
376378 }
0 commit comments