Skip to content
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

Merged
merged 8 commits into from
Mar 5, 2024

Conversation

GonarchX
Copy link
Contributor

@GonarchX GonarchX commented Feb 18, 2024

Код + отчет

}

public Entry<MemorySegment> toDeletedMemorySegment(String key) {
assert key != null;
Copy link

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.

Copy link
Contributor Author

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;
Copy link

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;
Copy link

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 {
Copy link

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.*;
Copy link

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.*;
Copy link

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 {
Copy link

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)
Copy link

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.*;
Copy link

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");
Copy link

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).

Copy link

@codeclimate codeclimate bot left a 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.

Copy link

@codeclimate codeclimate bot left a 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.

Copy link

@codeclimate codeclimate bot left a 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.

@vladimir-bf vladimir-bf assigned urbanchef and unassigned vladimir-bf Feb 23, 2024
import java.util.Set;

public class Server extends HttpServer {
private final ReferenceDao dao;
Copy link
Contributor

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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не хватает обработки исключений от дао здесь и ниже и проверки request body на null

Copy link
Contributor Author

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 блок.

Copy link

@codeclimate codeclimate bot left a 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.

Copy link

@codeclimate codeclimate bot left a 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.

@urbanchef
Copy link
Contributor

14/15
Хороший отчет с подробным анализом и предложениями по улучшению. Небольшие замечания по коду - не было обработки исключений.

Copy link

@codeclimate codeclimate bot left a 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.

Copy link

@codeclimate codeclimate bot left a 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.

@urbanchef urbanchef merged commit a3029ec into polis-vk:main Mar 5, 2024
2 checks passed
osokindm pushed a commit to osokindm/2024-highload-dht that referenced this pull request Mar 6, 2024
* 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]>
axothy pushed a commit to axothy/2024-highload-dht that referenced this pull request Mar 13, 2024
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants