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

feature: restore part #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

feature: restore part #1

wants to merge 4 commits into from

Conversation

griga
Copy link
Owner

@griga griga commented Mar 12, 2024

for both js and java
GF256 interpolation can take optional partIdx param that can be used to recreate part at that index

Scheme class gets restorePart idx to
restore lost or corrupted part from
minimum required original parts

for both js and java
GF256 interpolation can take optional partIdx param
that can be used to recreate part at that index

Scheme class gets restorePart idx to
restore lost or corrupted part from
minimu required original parts
Copy link

@dmitry-salnikov dmitry-salnikov left a comment

Choose a reason for hiding this comment

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

great job!

const lengths = Object.values(parts).map(x => x.length);
const max = Math.max.apply(null, lengths);
const min = Math.min.apply(null, lengths);
if (max !== min) {``

Choose a reason for hiding this comment

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

redundant ``

Copy link
Owner Author

Choose a reason for hiding this comment

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

fixed

@@ -126,6 +128,35 @@ void splitAndJoinInquorate() {
});
}

@Test
void restorePartRoundtrip() {

Choose a reason for hiding this comment

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

wow, nice! how do you execute these tests?

Copy link
Owner Author

Choose a reason for hiding this comment

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

mvn test
but i don't have maven localy installed
maven is gradle's predecessor

Copy link

@pavlo-liapin pavlo-liapin left a comment

Choose a reason for hiding this comment

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

Great!

const partsToRestoreFrom = { '1': splits['1'], '2': splits['2'] };
const restoredPart = restorePart(partsToRestoreFrom, 3);
const splitsWithRestored = {'1': splits['1'], '3': restoredPart};
const joined = bytesToSring(join(splitsWithRestored))

Choose a reason for hiding this comment

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

Add ; please

Copy link
Owner Author

Choose a reason for hiding this comment

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

fixed

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