Skip to content

Commit

Permalink
cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPawelec-RDX committed Oct 2, 2024
1 parent 6596ae4 commit 1470044
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="IExtensionsQuerier.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using RadixDlt.NetworkGateway.Abstractions;
using System.Threading;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="StateAccountAuthorizedDepositorsPageRequestValidator.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using FluentValidation;
using RadixDlt.NetworkGateway.GatewayApiSdk.Model;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="StateAccountResourcePreferencesPageRequestValidator.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using FluentValidation;
using RadixDlt.NetworkGateway.GatewayApiSdk.Model;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="TransactionTransferValidationRequestValidator.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using FluentValidation;
using Microsoft.Extensions.Options;
using RadixDlt.NetworkGateway.GatewayApi.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="StateAccountAuthorizedDepositorsPageRequest.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model;

public partial class StateAccountAuthorizedDepositorsPageRequest : IPaginableRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="StateAccountResourcePreferencesPageRequest.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model;

public partial class StateAccountResourcePreferencesPageRequest : IPaginableRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="AffectedGlobalEntitiesProcessor.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using RadixDlt.NetworkGateway.Abstractions;
using RadixDlt.NetworkGateway.Abstractions.Network;
using RadixDlt.NetworkGateway.PostgresIntegration.Models;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="KeyValueStoreTotalsHistory.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="KeyValueStoreQueries.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using Dapper;
using Microsoft.EntityFrameworkCore;
using RadixDlt.NetworkGateway.Abstractions;
Expand Down Expand Up @@ -200,27 +196,24 @@ LEFT JOIN LATERAL (
entries.value,
entries.is_locked,
entries.is_deleted,
CASE WHEN (ROW_NUMBER() OVER (ORDER BY definitions.cursor DESC)) = vars.page_limit OR entries.filter_out
THEN TRUE
ELSE FALSE
END AS filter_out,
ROW_NUMBER() OVER (ORDER BY definitions.cursor DESC) = vars.page_limit OR entries.filter_out AS filter_out,
CASE
WHEN (ROW_NUMBER() OVER (ORDER BY definitions.cursor DESC)) = vars.page_limit
THEN definitions.cursor
WHEN (ROW_NUMBER() OVER (ORDER BY definitions.cursor DESC)) != vars.page_limit AND definitions.is_last_candidate
THEN ROW(definitions.key_first_seen_state_version, definitions.id - 1)
END AS next_cursor_inclusive
FROM (
SELECT
d.id,
d.key,
d.cursor,
d.from_state_version AS key_first_seen_state_version,
(ROW_NUMBER() OVER (ORDER BY d.cursor DESC)) = vars.definition_read_limit AS is_last_candidate
FROM definitions_with_cursor d
WHERE d.key_value_store_entity_id = vars.key_value_store_entity_id AND ((NOT vars.use_cursor) OR d.cursor <= vars.start_cursor_inclusive)
ORDER BY d.cursor DESC
LIMIT vars.definition_read_limit
SELECT
d.id,
d.key,
d.cursor,
d.from_state_version AS key_first_seen_state_version,
(ROW_NUMBER() OVER (ORDER BY d.cursor DESC)) = vars.definition_read_limit AS is_last_candidate
FROM definitions_with_cursor d
WHERE d.key_value_store_entity_id = vars.key_value_store_entity_id AND ((NOT vars.use_cursor) OR d.cursor <= vars.start_cursor_inclusive)
ORDER BY d.cursor DESC
LIMIT vars.definition_read_limit
) definitions
INNER JOIN LATERAL (
SELECT
Expand Down Expand Up @@ -292,7 +285,7 @@ ORDER BY entries_per_entity.cursor DESC
);
}

internal static async Task<GatewayModel.StateKeyValueStoreDataResponse> KeyValueStoreData(
internal static async Task<GatewayModel.StateKeyValueStoreDataResponse> KeyValueStoreDataMultiLookupQuery(
ReadOnlyDbContext dbContext,
IDapperWrapper dapperWrapper,
Entity keyValueStoreEntity,
Expand Down Expand Up @@ -385,7 +378,7 @@ LIMIT 1
return new GatewayModel.StateKeyValueStoreDataResponse(ledgerState, keyValueStoreEntity.Address, items);
}

internal static async Task<KeyValueStoreSchemaResultRow> KeyValueStoreSchema(
internal static async Task<KeyValueStoreSchemaResultRow> KeyValueStoreSchemaLookupQuery(
ReadOnlyDbContext dbContext,
IDapperWrapper dapperWrapper,
long keyValueStoreId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,7 @@ LEFT JOIN LATERAL (
entries.value,
entries.is_locked,
entries.is_deleted,
CASE WHEN (ROW_NUMBER() OVER (ORDER BY definitions.cursor DESC)) = vars.per_entity_page_limit OR entries.filter_out
THEN TRUE
ELSE FALSE
END AS filter_out,
ROW_NUMBER() OVER (ORDER BY definitions.cursor DESC) = vars.per_entity_page_limit OR entries.filter_out AS filter_out,
CASE
WHEN (ROW_NUMBER() OVER (ORDER BY definitions.cursor DESC)) = vars.per_entity_page_limit
THEN definitions.cursor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
* permissions under this License.
*/

// <copyright file="AccountStateQuerier.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

using Dapper;
using Microsoft.EntityFrameworkCore;
using RadixDlt.NetworkGateway.Abstractions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public KeyValueStoreQuerier(
var networkId = (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id;
var keyValueStore = await _entityQuerier.GetNonVirtualEntity<InternalKeyValueStoreEntity>(_dbContext, keyValueStoreAddress, ledgerState, token);

var keyValueStoreSchema = await KeyValueStoreQueries.KeyValueStoreSchema(
var keyValueStoreSchema = await KeyValueStoreQueries.KeyValueStoreSchemaLookupQuery(
_dbContext,
_dapperWrapper,
keyValueStore.Id,
Expand Down Expand Up @@ -140,14 +140,14 @@ public KeyValueStoreQuerier(
var networkId = (await _networkConfigurationProvider.GetNetworkConfiguration(token)).Id;
var keyValueStore = await _entityQuerier.GetNonVirtualEntity<InternalKeyValueStoreEntity>(_dbContext, keyValueStoreAddress, ledgerState, token);

var keyValueStoreSchema = await KeyValueStoreQueries.KeyValueStoreSchema(
var keyValueStoreSchema = await KeyValueStoreQueries.KeyValueStoreSchemaLookupQuery(
_dbContext,
_dapperWrapper,
keyValueStore.Id,
ledgerState,
token);

return await KeyValueStoreQueries.KeyValueStoreData(
return await KeyValueStoreQueries.KeyValueStoreDataMultiLookupQuery(
_dbContext,
_dapperWrapper,
keyValueStore,
Expand Down

0 comments on commit 1470044

Please sign in to comment.