-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Пронин Валентин / ИТМО DWS / Stage 1 #7
Conversation
} | ||
|
||
public Entry<MemorySegment> toDeletedMemorySegment(String key) { | ||
assert key != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace this assert with a proper check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Брат, почему ты теперь пишешь здесь, а не на отдельной странице
} | ||
|
||
public Entry<MemorySegment> toMemorySegment(String key, String value) { | ||
assert key != null && value != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace this assert with a proper check.
|
||
public class MemorySegmentFactory { | ||
public byte[] toByteArray(MemorySegment data) { | ||
assert data != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace this assert with a proper check.
import java.io.UncheckedIOException; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class ServiceImpl implements ru.vk.itmo.Service { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary use of fully qualified name 'ru.vk.itmo.Service' due to existing import 'ru.vk.itmo.Service'
@@ -0,0 +1,108 @@ | |||
package ru.vk.itmo.test.proninvalentin; | |||
|
|||
import one.nio.http.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid unused imports such as 'one.nio.http'
@@ -0,0 +1,108 @@ | |||
package ru.vk.itmo.test.proninvalentin; | |||
|
|||
import one.nio.http.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid unused imports such as 'one.nio.http'
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
public class StartServer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
MemorySegment key = msFactory.fromString(id); | ||
|
||
Entry<MemorySegment> entry = dao.get(key); | ||
if (entry == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'if' construct must use '{}'s.
@@ -0,0 +1,108 @@ | |||
package ru.vk.itmo.test.proninvalentin; | |||
|
|||
import one.nio.http.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the '.' form of import should be avoided - one.nio.http..
String url = "http://localhost"; | ||
int port = 8080; | ||
int flushThresholdBytes = 1 << 27; // 128 MB | ||
Path profilingDataPath = Path.of("/Users/valentinpronin/IdeaProjects/2024-highload-dht/src/main/java/ru/vk/itmo/test/proninvalentin/server_profiling_data"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is longer than 120 characters (found 164).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 14930 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 14930 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 14931 lines exceeds the maximum allowed for the inline comments feature.
import java.util.Set; | ||
|
||
public class Server extends HttpServer { | ||
private final ReferenceDao dao; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По возможности лучше использовать интерфейс, а не реализацию
|
||
MemorySegment key = msFactory.fromString(id); | ||
MemorySegment value = MemorySegment.ofArray(request.getBody()); | ||
dao.upsert(new BaseEntry<>(key, value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не хватает обработки исключений от дао здесь и ниже и проверки request body на null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Проверка на request request.getBody() == null
выше же или вы про что-то другое?
Решил обработку исключений сделать глобальной и переопределил handleRequest, добавив try
блок.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 14950 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 14958 lines exceeds the maximum allowed for the inline comments feature.
14/15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 14958 lines exceeds the maximum allowed for the inline comments feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR diff size of 14958 lines exceeds the maximum allowed for the inline comments feature.
* First version * Refactor * Add report + improve code style * Add a suggestion to the report about compression need * Fix pr * Fix codestyle --------- Co-authored-by: Valentin Pronin <[email protected]> Co-authored-by: Roman Mushchinskii <[email protected]>
* First version * Refactor * Add report + improve code style * Add a suggestion to the report about compression need * Fix pr * Fix codestyle --------- Co-authored-by: Valentin Pronin <[email protected]> Co-authored-by: Roman Mushchinskii <[email protected]>
Код + отчет