-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Use AtomicView
in the TxPool
#1590
Merged
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
df6e1ae
Move storage traits implementation to the `fuel-core-storage` crate
xgreenx de82e25
Added comments to all newly added stuff. Made self-review and applied…
xgreenx 7ccc722
Merge branch 'master' into feature/move-storage-implementation-to-own…
xgreenx 33661bc
Updated CHANGELOG.md
xgreenx 1b8295a
Merge remote-tracking branch 'origin/feature/move-storage-implementat…
xgreenx 82df7e2
Moved insertion of the blocks into the `BlockImporter` instead of the…
xgreenx d4a4d0a
Update CHANGELOG.md
xgreenx 5033d8c
Cleanup
xgreenx ab88c67
Moved insertion of the whole block with transactions
xgreenx a49d96d
Use `store_block` as a name instead of `block`
xgreenx c6fb1fe
Merge branch 'master' into feature/move-blocks-to-importer
xgreenx f5c38f2
Move `ChainId` to `fuel_core_importer::Config`
xgreenx 4c3f18c
Apply suggestions from the PR
xgreenx 0eaab98
Merge branch 'master' into feature/move-storage-implementation-to-own…
xgreenx c1ee5f8
Apply suggestions from the PR
xgreenx c594d45
Extract off chain logic from the executor
xgreenx bd60793
Added comments and linked todos
xgreenx 8221443
Updated CHANGELOG.md
xgreenx 810edee
Merge branch 'master' into feature/move-offchain-logic-from-executor
xgreenx 4a580ed
Merge branch 'master' into feature/move-offchain-logic-from-executor
xgreenx 0cea5bb
Merge branch 'master' into feature/move-storage-implementation-to-own…
xgreenx c9977a4
Merge branch 'master' into feature/move-storage-implementation-to-own…
xgreenx b0ed3e9
Fixed compilation
xgreenx 541527e
Merge branch 'master' into feature/move-storage-implementation-to-own…
xgreenx c5a7b71
Merge branch 'master' into feature/move-offchain-logic-from-executor
xgreenx d2b5504
Use `BlockHeight` as a primary key for the `FuelsBlock` table
xgreenx 1013f0e
Merge branch 'feature/move-storage-implementation-to-own-crate' into …
xgreenx 359192e
Updated CHANGELOG.md
xgreenx 34b5e6a
Merge remote-tracking branch 'origin/feature/block-height-as-primary-…
xgreenx e27996a
Fix compilation
xgreenx f3515d8
Merge branch 'master' into feature/move-offchain-logic-from-executor
xgreenx 1be054c
Use `AtomicView` in the `TxPool`
xgreenx ea69532
Update CHANGELOG.md
xgreenx 452418c
Merge remote-tracking branch 'origin/feature/move-storage-implementat…
xgreenx 1fbc318
Merge branch 'master' into feature/move-storage-implementation-to-own…
xgreenx c5956a8
Use "blueprint" instead of "structure"
xgreenx cc9966c
Fix documents
xgreenx 0bbeea1
Merge branch 'feature/move-storage-implementation-to-own-crate' into …
xgreenx 2d3e471
Merge latest modifications from move storage PR
xgreenx f0df4f0
Merge branch 'master' into feature/block-height-as-primary-key
xgreenx 688a24b
Merge branch 'master' into feature/move-offchain-logic-from-executor
xgreenx c7bce20
Fix conflicts
xgreenx 0850b03
Merge branch 'feature/move-offchain-logic-from-executor' into feature…
xgreenx f607007
Merge branch 'feature/move-offchain-logic-from-executor' into feature…
xgreenx 55424cb
Merge remote-tracking branch 'origin/feature/use-view-in-txpool' into…
xgreenx 2b95d4e
Merge branch 'master' into feature/use-view-in-txpool
xgreenx 993aa84
Merge branch 'master' into feature/block-height-as-primary-key
xgreenx 36445b7
Merged master
xgreenx 0e2abad
Merge branch 'master' into feature/block-height-as-primary-key
xgreenx 6a503b9
Apply comments
xgreenx 02a45a8
Merge branch 'master' into feature/use-view-in-txpool
xgreenx 50f2ff0
Merge branch 'feature/block-height-as-primary-key' into feature/use-v…
xgreenx 067792b
Apply comments
xgreenx 6cead2b
Merge branch 'master' into feature/use-view-in-txpool
xgreenx 8369cd5
Move arc wrapper into its own module
xgreenx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use crate::fuel_core_graphql_api::{ | ||
database::{ | ||
OffChainView, | ||
OnChainView, | ||
}, | ||
ports::{ | ||
OffChainDatabase, | ||
OnChainDatabase, | ||
}, | ||
}; | ||
use fuel_core_storage::{ | ||
transactional::AtomicView, | ||
Result as StorageResult, | ||
}; | ||
use fuel_core_types::fuel_types::BlockHeight; | ||
use std::sync::Arc; | ||
|
||
/// The GraphQL can't work with the generics in [`async_graphql::Context::data_unchecked`] and requires a known type. | ||
/// It is an `Arc` wrapper around the generic for on-chain and off-chain databases. | ||
pub struct ArcWrapper<Provider, ArcView> { | ||
inner: Provider, | ||
_marker: core::marker::PhantomData<ArcView>, | ||
} | ||
|
||
impl<Provider, ArcView> ArcWrapper<Provider, ArcView> { | ||
pub fn new(inner: Provider) -> Self { | ||
Self { | ||
inner, | ||
_marker: core::marker::PhantomData, | ||
} | ||
} | ||
} | ||
|
||
impl<Provider, View> AtomicView for ArcWrapper<Provider, OnChainView> | ||
where | ||
Provider: AtomicView<View = View>, | ||
View: OnChainDatabase + 'static, | ||
{ | ||
type View = OnChainView; | ||
|
||
fn view_at(&self, height: BlockHeight) -> StorageResult<Self::View> { | ||
let view = self.inner.view_at(height)?; | ||
Ok(Arc::new(view)) | ||
} | ||
|
||
fn latest_view(&self) -> Self::View { | ||
Arc::new(self.inner.latest_view()) | ||
} | ||
} | ||
|
||
impl<Provider, View> AtomicView for ArcWrapper<Provider, OffChainView> | ||
where | ||
Provider: AtomicView<View = View>, | ||
View: OffChainDatabase + 'static, | ||
{ | ||
type View = OffChainView; | ||
|
||
fn view_at(&self, height: BlockHeight) -> StorageResult<Self::View> { | ||
let view = self.inner.view_at(height)?; | ||
Ok(Arc::new(view)) | ||
} | ||
|
||
fn latest_view(&self) -> Self::View { | ||
Arc::new(self.inner.latest_view()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I feel like we should fix this TODO as well, now that the linked issue is no longer blocked. I'm fine with a follow-up PR as well.