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

PE-2618: Sync from Snapshots #826

Merged
merged 71 commits into from Jan 3, 2023
Merged

PE-2618: Sync from Snapshots #826

merged 71 commits into from Jan 3, 2023

Conversation

matibat
Copy link
Contributor

@matibat matibat commented Dec 16, 2022

PE-2632: Make use of the components for Quick Sync [Read-side]
@matibat matibat self-assigned this Dec 16, 2022
@matibat matibat marked this pull request as ready for review December 16, 2022 17:32
@github-actions
Copy link

github-actions bot commented Dec 16, 2022

Visit the preview URL for this PR (updated for commit 1b5ba34):

https://ardrive-web--pr826-pe-2618-ltumutwi.web.app

(expires Wed, 04 Jan 2023 18:52:51 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a224ebaee2f0939e7665e7630e7d3d6cd7d0f8b0

@@ -6,13 +6,15 @@ Stream<double> _parseDriveTransactionsIntoDatabaseEntities({
required DriveDao driveDao,
required Database database,
required ArweaveService arweaveService,
required List<DriveEntityHistory$Query$TransactionConnection$TransactionEdge>
required List<
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a better way to handle these. It's risky to rely on generated types like this without some abstraction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -42,15 +44,20 @@ Stream<double> _parseDriveTransactionsIntoDatabaseEntities({
final owner = await arweave.getOwnerForDriveEntityWithId(drive.id);

yield* _batchProcess<
DriveEntityHistory$Query$TransactionConnection$TransactionEdge>(
DriveEntityHistory$Query$TransactionConnection$TransactionEdge$Transaction>(
Copy link
Contributor

@jdaev jdaev Dec 16, 2022

Choose a reason for hiding this comment

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

Maybe we should create a tech debt ticket for a better GQL abstraction in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PE-2782 🚀
359384f

lastBlockHeight,
)
.map(
(edge) => edge.node,
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps move this mapping inside the function to abstract it away. The sync cubit shouldn't need to know about edges or nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Much cleaner :) - ae51d75

await for (var t in transactionsStream) {
if (t.isEmpty) continue;

await for (DriveEntityHistory$Query$TransactionConnection$TransactionEdge$Transaction t
Copy link
Contributor

Choose a reason for hiding this comment

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

Simplify this for now by adding to the start of the file.
typedef DriveEntityTransaction = DriveEntityHistory$Query$TransactionConnection$TransactionEdge$Transaction;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

String get _dataUri {
return 'https://arweave.net/$txId';
Copy link
Contributor

Choose a reason for hiding this comment

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

We can get the url from config instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like so? - b3ac93e

Copy link
Contributor

Choose a reason for hiding this comment

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

ConfigService and AppConfig already have it defined. You just need to use those.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return _getNextStream();
}

Stream<DriveEntityHistory$Query$TransactionConnection$TransactionEdge$Transaction>
Copy link
Contributor

Choose a reason for hiding this comment

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

These long types almost make me cry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There you go, Javed 😭 - 359384f

@matibat matibat requested a review from jdaev December 20, 2022 16:17
jdaev
jdaev previously approved these changes Dec 20, 2022
Copy link
Contributor

@jdaev jdaev left a comment

Choose a reason for hiding this comment

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

Fantastic work 💯

jdaev
jdaev previously approved these changes Dec 21, 2022
@matibat matibat merged commit 08bf0b6 into dev Jan 3, 2023
@matibat matibat deleted the PE-2618 branch January 3, 2023 17:56
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.

None yet

3 participants