Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Dec 4, 2024
1 parent 5bf52a2 commit 0be4e7c
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 58 deletions.
24 changes: 16 additions & 8 deletions src/data_source/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ where
D: VersionedDataSource + Send,
U: Send + Sync,
{
type Transaction<'a> = D::Transaction<'a>
type Transaction<'a>
= D::Transaction<'a>
where
Self: 'a;

type ReadOnly<'a> = D::ReadOnly<'a>
type ReadOnly<'a>
= D::ReadOnly<'a>
where
Self: 'a;

Expand All @@ -144,22 +146,28 @@ where
Types: NodeType,
Payload<Types>: QueryablePayload<Types>,
{
type LeafRange<R> = D::LeafRange<R>
type LeafRange<R>
= D::LeafRange<R>
where
R: RangeBounds<usize> + Send;
type BlockRange<R> = D::BlockRange<R>
type BlockRange<R>
= D::BlockRange<R>
where
R: RangeBounds<usize> + Send;
type PayloadRange<R> = D::PayloadRange<R>
type PayloadRange<R>
= D::PayloadRange<R>
where
R: RangeBounds<usize> + Send;
type PayloadMetadataRange<R> = D::PayloadMetadataRange<R>
type PayloadMetadataRange<R>
= D::PayloadMetadataRange<R>
where
R: RangeBounds<usize> + Send;
type VidCommonRange<R> = D::VidCommonRange<R>
type VidCommonRange<R>
= D::VidCommonRange<R>
where
R: RangeBounds<usize> + Send;
type VidCommonMetadataRange<R> = D::VidCommonMetadataRange<R>
type VidCommonMetadataRange<R>
= D::VidCommonMetadataRange<R>
where
R: RangeBounds<usize> + Send;

Expand Down
30 changes: 20 additions & 10 deletions src/data_source/fetching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,28 @@ where
for<'a> S::ReadOnly<'a>: AvailabilityStorage<Types> + NodeStorage<Types> + PrunedHeightStorage,
P: AvailabilityProvider<Types>,
{
type LeafRange<R> = BoxStream<'static, Fetch<LeafQueryData<Types>>>
type LeafRange<R>
= BoxStream<'static, Fetch<LeafQueryData<Types>>>
where
R: RangeBounds<usize> + Send;
type BlockRange<R> = BoxStream<'static, Fetch<BlockQueryData<Types>>>
type BlockRange<R>
= BoxStream<'static, Fetch<BlockQueryData<Types>>>
where
R: RangeBounds<usize> + Send;
type PayloadRange<R> = BoxStream<'static, Fetch<PayloadQueryData<Types>>>
type PayloadRange<R>
= BoxStream<'static, Fetch<PayloadQueryData<Types>>>
where
R: RangeBounds<usize> + Send;
type PayloadMetadataRange<R> = BoxStream<'static, Fetch<PayloadMetadata<Types>>>
type PayloadMetadataRange<R>
= BoxStream<'static, Fetch<PayloadMetadata<Types>>>
where
R: RangeBounds<usize> + Send;
type VidCommonRange<R> = BoxStream<'static, Fetch<VidCommonQueryData<Types>>>
type VidCommonRange<R>
= BoxStream<'static, Fetch<VidCommonQueryData<Types>>>
where
R: RangeBounds<usize> + Send;
type VidCommonMetadataRange<R> = BoxStream<'static, Fetch<VidCommonMetadata<Types>>>
type VidCommonMetadataRange<R>
= BoxStream<'static, Fetch<VidCommonMetadata<Types>>>
where
R: RangeBounds<usize> + Send;

Expand Down Expand Up @@ -714,10 +720,12 @@ where
S: VersionedDataSource + Send + Sync,
P: Send + Sync,
{
type Transaction<'a> = S::Transaction<'a>
type Transaction<'a>
= S::Transaction<'a>
where
Self: 'a;
type ReadOnly<'a> = S::ReadOnly<'a>
type ReadOnly<'a>
= S::ReadOnly<'a>
where
Self: 'a;

Expand Down Expand Up @@ -760,10 +768,12 @@ where
S: VersionedDataSource + Send + Sync,
P: Send + Sync,
{
type Transaction<'a> = S::Transaction<'a>
type Transaction<'a>
= S::Transaction<'a>
where
Self: 'a;
type ReadOnly<'a> = S::ReadOnly<'a>
type ReadOnly<'a>
= S::ReadOnly<'a>
where
Self: 'a;

Expand Down
6 changes: 4 additions & 2 deletions src/data_source/storage/fail_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,12 @@ impl<S> VersionedDataSource for FailStorage<S>
where
S: VersionedDataSource,
{
type Transaction<'a> = Transaction<S::Transaction<'a>>
type Transaction<'a>
= Transaction<S::Transaction<'a>>
where
Self: 'a;
type ReadOnly<'a> = Transaction<S::ReadOnly<'a>>
type ReadOnly<'a>
= Transaction<S::ReadOnly<'a>>
where
Self: 'a;

Expand Down
6 changes: 4 additions & 2 deletions src/data_source/storage/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,12 @@ impl<Types: NodeType> VersionedDataSource for FileSystemStorage<Types>
where
Payload<Types>: QueryablePayload<Types>,
{
type Transaction<'a> = Transaction<RwLockWriteGuard<'a, FileSystemStorageInner<Types>>>
type Transaction<'a>
= Transaction<RwLockWriteGuard<'a, FileSystemStorageInner<Types>>>
where
Self: 'a;
type ReadOnly<'a> = Transaction<RwLockReadGuard<'a, FileSystemStorageInner<Types>>>
type ReadOnly<'a>
= Transaction<RwLockReadGuard<'a, FileSystemStorageInner<Types>>>
where
Self: 'a;

Expand Down
30 changes: 20 additions & 10 deletions src/data_source/storage/no_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ pub struct Transaction<'a> {
}

impl VersionedDataSource for NoStorage {
type Transaction<'a> = Transaction<'a>
type Transaction<'a>
= Transaction<'a>
where
Self: 'a;
type ReadOnly<'a> = Transaction<'a>
type ReadOnly<'a>
= Transaction<'a>
where
Self: 'a;

Expand Down Expand Up @@ -457,10 +459,12 @@ pub mod testing {
// Now a lot of boilerplate to implement all teh traits for [`DataSource`], by dispatching each
// method to either variant.
impl VersionedDataSource for DataSource {
type Transaction<'a> = Transaction<'a, <SqlStorage as VersionedDataSource>::Transaction<'a>>
type Transaction<'a>
= Transaction<'a, <SqlStorage as VersionedDataSource>::Transaction<'a>>
where
Self: 'a;
type ReadOnly<'a> = Transaction<'a, <SqlStorage as VersionedDataSource>::ReadOnly<'a>>
type ReadOnly<'a>
= Transaction<'a, <SqlStorage as VersionedDataSource>::ReadOnly<'a>>
where
Self: 'a;

Expand Down Expand Up @@ -549,22 +553,28 @@ pub mod testing {

#[async_trait]
impl AvailabilityDataSource<MockTypes> for DataSource {
type LeafRange<R> = BoxStream<'static, Fetch<LeafQueryData<MockTypes>>>
type LeafRange<R>
= BoxStream<'static, Fetch<LeafQueryData<MockTypes>>>
where
R: RangeBounds<usize> + Send;
type BlockRange<R> = BoxStream<'static, Fetch<BlockQueryData<MockTypes>>>
type BlockRange<R>
= BoxStream<'static, Fetch<BlockQueryData<MockTypes>>>
where
R: RangeBounds<usize> + Send;
type PayloadRange<R> = BoxStream<'static, Fetch<PayloadQueryData<MockTypes>>>
type PayloadRange<R>
= BoxStream<'static, Fetch<PayloadQueryData<MockTypes>>>
where
R: RangeBounds<usize> + Send;
type PayloadMetadataRange<R> = BoxStream<'static, Fetch<PayloadMetadata<MockTypes>>>
type PayloadMetadataRange<R>
= BoxStream<'static, Fetch<PayloadMetadata<MockTypes>>>
where
R: RangeBounds<usize> + Send;
type VidCommonRange<R> = BoxStream<'static, Fetch<VidCommonQueryData<MockTypes>>>
type VidCommonRange<R>
= BoxStream<'static, Fetch<VidCommonQueryData<MockTypes>>>
where
R: RangeBounds<usize> + Send;
type VidCommonMetadataRange<R> = BoxStream<'static, Fetch<VidCommonMetadata<MockTypes>>>
type VidCommonMetadataRange<R>
= BoxStream<'static, Fetch<VidCommonMetadata<MockTypes>>>
where
R: RangeBounds<usize> + Send;

Expand Down
6 changes: 4 additions & 2 deletions src/data_source/storage/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,12 @@ impl PruneStorage for SqlStorage {
}

impl VersionedDataSource for SqlStorage {
type Transaction<'a> = Transaction<Write>
type Transaction<'a>
= Transaction<Write>
where
Self: 'a;
type ReadOnly<'a> = Transaction<Read>
type ReadOnly<'a>
= Transaction<Read>
where
Self: 'a;

Expand Down
36 changes: 12 additions & 24 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,40 +627,28 @@ mod test {

#[async_trait]
impl AvailabilityDataSource<MockTypes> for CompositeState {
type LeafRange<R> =
<MockDataSource as AvailabilityDataSource<
MockTypes,
>>::LeafRange<R>
type LeafRange<R>
= <MockDataSource as AvailabilityDataSource<MockTypes>>::LeafRange<R>
where
R: RangeBounds<usize> + Send;
type BlockRange<R> =
<MockDataSource as AvailabilityDataSource<
MockTypes,
>>::BlockRange<R>
type BlockRange<R>
= <MockDataSource as AvailabilityDataSource<MockTypes>>::BlockRange<R>
where
R: RangeBounds<usize> + Send;
type PayloadRange<R> =
<MockDataSource as AvailabilityDataSource<
MockTypes,
>>::PayloadRange<R>
type PayloadRange<R>
= <MockDataSource as AvailabilityDataSource<MockTypes>>::PayloadRange<R>
where
R: RangeBounds<usize> + Send;
type PayloadMetadataRange<R> =
<MockDataSource as AvailabilityDataSource<
MockTypes,
>>::PayloadMetadataRange<R>
type PayloadMetadataRange<R>
= <MockDataSource as AvailabilityDataSource<MockTypes>>::PayloadMetadataRange<R>
where
R: RangeBounds<usize> + Send;
type VidCommonRange<R> =
<MockDataSource as AvailabilityDataSource<
MockTypes,
>>::VidCommonRange<R>
type VidCommonRange<R>
= <MockDataSource as AvailabilityDataSource<MockTypes>>::VidCommonRange<R>
where
R: RangeBounds<usize> + Send;
type VidCommonMetadataRange<R> =
<MockDataSource as AvailabilityDataSource<
MockTypes,
>>::VidCommonMetadataRange<R>
type VidCommonMetadataRange<R>
= <MockDataSource as AvailabilityDataSource<MockTypes>>::VidCommonMetadataRange<R>
where
R: RangeBounds<usize> + Send;

Expand Down

0 comments on commit 0be4e7c

Please sign in to comment.