fix style

This commit is contained in:
KinderRiven 2022-05-01 00:33:41 +08:00
parent 30b16ea47e
commit e0fc7870a8

View File

@ -66,7 +66,7 @@ void CachedReadBufferFromRemoteFS::appendFilesystemCacheLog(
elem.event_time = std::chrono::system_clock::to_time_t(current_time);
elem.file_segment_range = std::make_pair(file_segment_range.left, file_segment_range.right);
switch(type)
switch (type)
{
case CachedReadBufferFromRemoteFS::ReadType::CACHED:
elem.read_type = FilesystemCacheLogElement::ReadType::READ_FROM_CACHE;
@ -119,7 +119,7 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getRemoteFSReadBuffer(FileSe
{
switch (read_type_)
{
case ReadType::REMOTE_FS_READ_AND_PUT_IN_CACHE:
case ReadType::REMOTE_FS_READ_AND_PUT_IN_CACHE:
{
/**
* Each downloader is elected to download at most buffer_size bytes and then any other can
@ -147,7 +147,7 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getRemoteFSReadBuffer(FileSe
return remote_fs_segment_reader;
}
case ReadType::REMOTE_FS_READ_BYPASS_CACHE:
case ReadType::REMOTE_FS_READ_BYPASS_CACHE:
{
/// Result buffer is owned only by current buffer -- not shareable like in the case above.
@ -189,12 +189,12 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getReadBufferForFileSegment(
{
switch (download_state)
{
case FileSegment::State::SKIP_CACHE:
case FileSegment::State::SKIP_CACHE:
{
read_type = ReadType::REMOTE_FS_READ_BYPASS_CACHE;
return getRemoteFSReadBuffer(file_segment, read_type);
}
case FileSegment::State::EMPTY:
case FileSegment::State::EMPTY:
{
auto downloader_id = file_segment->getOrSetDownloader();
if (downloader_id == file_segment->getCallerId())
@ -226,7 +226,7 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getReadBufferForFileSegment(
continue;
}
}
case FileSegment::State::DOWNLOADING:
case FileSegment::State::DOWNLOADING:
{
size_t download_offset = file_segment->getDownloadOffset();
bool can_start_from_cache = download_offset > file_offset_of_buffer_end;
@ -257,12 +257,12 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getReadBufferForFileSegment(
continue;
}
case FileSegment::State::DOWNLOADED:
case FileSegment::State::DOWNLOADED:
{
read_type = ReadType::CACHED;
return getCacheReadBuffer(range.left);
}
case FileSegment::State::PARTIALLY_DOWNLOADED:
case FileSegment::State::PARTIALLY_DOWNLOADED:
{
auto downloader_id = file_segment->getOrSetDownloader();
if (downloader_id == file_segment->getCallerId())
@ -312,7 +312,7 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getReadBufferForFileSegment(
download_state = file_segment->state();
continue;
}
case FileSegment::State::PARTIALLY_DOWNLOADED_NO_CONTINUATION:
case FileSegment::State::PARTIALLY_DOWNLOADED_NO_CONTINUATION:
{
size_t download_offset = file_segment->getDownloadOffset();
bool can_start_from_cache = download_offset > file_offset_of_buffer_end;
@ -359,7 +359,7 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getImplementationBuffer(File
switch (read_type)
{
case ReadType::CACHED:
case ReadType::CACHED:
{
#ifndef NDEBUG
auto * file_reader = assert_cast<ReadBufferFromFile *>(read_buffer_for_file_segment.get());
@ -389,12 +389,12 @@ SeekableReadBufferPtr CachedReadBufferFromRemoteFS::getImplementationBuffer(File
break;
}
case ReadType::REMOTE_FS_READ_BYPASS_CACHE:
case ReadType::REMOTE_FS_READ_BYPASS_CACHE:
{
read_buffer_for_file_segment->seek(file_offset_of_buffer_end, SEEK_SET);
break;
}
case ReadType::REMOTE_FS_READ_AND_PUT_IN_CACHE:
case ReadType::REMOTE_FS_READ_AND_PUT_IN_CACHE:
{
assert(file_segment->isDownloader());
@ -797,17 +797,17 @@ bool CachedReadBufferFromRemoteFS::nextImplStep()
switch (read_type)
{
case ReadType::CACHED:
case ReadType::CACHED:
{
ProfileEvents::increment(ProfileEvents::RemoteFSCacheReadBytes, size);
break;
}
case ReadType::REMOTE_FS_READ_BYPASS_CACHE:
case ReadType::REMOTE_FS_READ_BYPASS_CACHE:
{
ProfileEvents::increment(ProfileEvents::RemoteFSReadBytes, size);
break;
}
case ReadType::REMOTE_FS_READ_AND_PUT_IN_CACHE:
case ReadType::REMOTE_FS_READ_AND_PUT_IN_CACHE:
{
ProfileEvents::increment(ProfileEvents::RemoteFSReadBytes, size);
ProfileEvents::increment(ProfileEvents::RemoteFSCacheDownloadBytes, size);