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

Kv store query alignment #794

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ Release built: _not released yet_
> - `/state/entity/page/non-fungibles/` (when using `non_fungible_include_nfids` opt-in)
> - `/state/entity/page/non-fungible-vaults/` (when using `non_fungible_include_nfids` opt-in)

### API Changes

### Bug fixes
- Added missing `total_count` property to `/state/validators/list` response.

### API Changes
- Restored previously removed `total_count` property to `/state/key-value-store/keys` endpoint.

### Database changes
- Refactored multiple aggregates. Queries follow a similar strategy as key value stores and utilize `_entry_definition`, `_entry_history`, and `_totals_history` tables to return data
Expand All @@ -50,7 +54,8 @@ Release built: _not released yet_
- New `non_fungible_vault_entry_definition` table, which holds information about non fungible held by a given vault.
- New `non_fungible_vault_entry_history` table which holds history of given non fungible inside vault.
- Renamed `entity_vault_history` to `vault_balance_history`. Holds information about vault content (amount of fungibles or count of non fungible ids inside vault) at a given state version.

- Key value store
- New `key_value_store_totals_history` table, which holds total count of all keys under a given store at a given state version.

## 1.7.3
Release built: 26.09.2024
Expand Down
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
41 changes: 20 additions & 21 deletions src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2317,16 +2317,14 @@ components:

TwoWayLinkedDappsCollection:
description: A collection of two-way linked (resolved & verified) dApps linked to the entity defining this collection.
allOf:
- $ref: "#/components/schemas/ResultSetCursorMixin"
- type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedDappsCollectionItem"
type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedDappsCollectionItem"
TwoWayLinkedDappsCollectionItem:
type: object
required:
Expand All @@ -2337,16 +2335,14 @@ components:

TwoWayLinkedEntitiesCollection:
description: A collection of two-way linked (resolved & verified) entities linked to the entity defining this collection.
allOf:
- $ref: "#/components/schemas/ResultSetCursorMixin"
- type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedEntitiesCollectionItem"
type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/TwoWayLinkedEntitiesCollectionItem"
TwoWayLinkedEntitiesCollectionItem:
type: object
required:
Expand Down Expand Up @@ -4055,11 +4051,14 @@ components:
StreamTransactionsResponse:
allOf:
- $ref: "#/components/schemas/LedgerStateMixin"
- $ref: "#/components/schemas/ResultSetCursorMixin"
- type: object
required:
- items
properties:
next_cursor:
description: If specified, contains a cursor to query next page of the `items` collection.
type: string
nullable: true
items:
description: The page of user transactions.
type: array
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 @@ -104,10 +104,9 @@ protected StreamTransactionsResponse() { }
/// Initializes a new instance of the <see cref="StreamTransactionsResponse" /> class.
/// </summary>
/// <param name="ledgerState">ledgerState (required).</param>
/// <param name="totalCount">Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection..</param>
/// <param name="nextCursor">If specified, contains a cursor to query next page of the &#x60;items&#x60; collection..</param>
/// <param name="items">The page of user transactions. (required).</param>
public StreamTransactionsResponse(LedgerState ledgerState = default(LedgerState), long? totalCount = default(long?), string nextCursor = default(string), List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
public StreamTransactionsResponse(LedgerState ledgerState = default(LedgerState), string nextCursor = default(string), List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
{
// to ensure "ledgerState" is required (not null)
if (ledgerState == null)
Expand All @@ -121,7 +120,6 @@ protected StreamTransactionsResponse() { }
throw new ArgumentNullException("items is a required property for StreamTransactionsResponse and cannot be null");
}
this.Items = items;
this.TotalCount = totalCount;
this.NextCursor = nextCursor;
}

Expand All @@ -131,13 +129,6 @@ protected StreamTransactionsResponse() { }
[DataMember(Name = "ledger_state", IsRequired = true, EmitDefaultValue = true)]
public LedgerState LedgerState { get; set; }

/// <summary>
/// Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.
/// </summary>
/// <value>Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.</value>
[DataMember(Name = "total_count", EmitDefaultValue = true)]
public long? TotalCount { get; set; }

/// <summary>
/// If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.
/// </summary>
Expand All @@ -161,7 +152,6 @@ public override string ToString()
StringBuilder sb = new StringBuilder();
sb.Append("class StreamTransactionsResponse {\n");
sb.Append(" LedgerState: ").Append(LedgerState).Append("\n");
sb.Append(" TotalCount: ").Append(TotalCount).Append("\n");
sb.Append(" NextCursor: ").Append(NextCursor).Append("\n");
sb.Append(" Items: ").Append(Items).Append("\n");
sb.Append("}\n");
Expand Down Expand Up @@ -204,11 +194,6 @@ public bool Equals(StreamTransactionsResponse input)
(this.LedgerState != null &&
this.LedgerState.Equals(input.LedgerState))
) &&
(
this.TotalCount == input.TotalCount ||
(this.TotalCount != null &&
this.TotalCount.Equals(input.TotalCount))
) &&
(
this.NextCursor == input.NextCursor ||
(this.NextCursor != null &&
Expand All @@ -235,10 +220,6 @@ public override int GetHashCode()
{
hashCode = (hashCode * 59) + this.LedgerState.GetHashCode();
}
if (this.TotalCount != null)
{
hashCode = (hashCode * 59) + this.TotalCount.GetHashCode();
}
if (this.NextCursor != null)
{
hashCode = (hashCode * 59) + this.NextCursor.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,26 @@ protected StreamTransactionsResponseAllOf() { }
/// <summary>
/// Initializes a new instance of the <see cref="StreamTransactionsResponseAllOf" /> class.
/// </summary>
/// <param name="nextCursor">If specified, contains a cursor to query next page of the &#x60;items&#x60; collection..</param>
/// <param name="items">The page of user transactions. (required).</param>
public StreamTransactionsResponseAllOf(List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
public StreamTransactionsResponseAllOf(string nextCursor = default(string), List<CommittedTransactionInfo> items = default(List<CommittedTransactionInfo>))
{
// to ensure "items" is required (not null)
if (items == null)
{
throw new ArgumentNullException("items is a required property for StreamTransactionsResponseAllOf and cannot be null");
}
this.Items = items;
this.NextCursor = nextCursor;
}

/// <summary>
/// If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.
/// </summary>
/// <value>If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.</value>
[DataMember(Name = "next_cursor", EmitDefaultValue = true)]
public string NextCursor { get; set; }

/// <summary>
/// The page of user transactions.
/// </summary>
Expand All @@ -129,6 +138,7 @@ public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class StreamTransactionsResponseAllOf {\n");
sb.Append(" NextCursor: ").Append(NextCursor).Append("\n");
sb.Append(" Items: ").Append(Items).Append("\n");
sb.Append("}\n");
return sb.ToString();
Expand Down Expand Up @@ -165,6 +175,11 @@ public bool Equals(StreamTransactionsResponseAllOf input)
return false;
}
return
(
this.NextCursor == input.NextCursor ||
(this.NextCursor != null &&
this.NextCursor.Equals(input.NextCursor))
) &&
(
this.Items == input.Items ||
this.Items != null &&
Expand All @@ -182,6 +197,10 @@ public override int GetHashCode()
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.NextCursor != null)
{
hashCode = (hashCode * 59) + this.NextCursor.GetHashCode();
}
if (this.Items != null)
{
hashCode = (hashCode * 59) + this.Items.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,35 +103,17 @@ protected TwoWayLinkedDappsCollection() { }
/// <summary>
/// Initializes a new instance of the <see cref="TwoWayLinkedDappsCollection" /> class.
/// </summary>
/// <param name="totalCount">Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection..</param>
/// <param name="nextCursor">If specified, contains a cursor to query next page of the &#x60;items&#x60; collection..</param>
/// <param name="items">items (required).</param>
public TwoWayLinkedDappsCollection(long? totalCount = default(long?), string nextCursor = default(string), List<TwoWayLinkedDappsCollectionItem> items = default(List<TwoWayLinkedDappsCollectionItem>))
public TwoWayLinkedDappsCollection(List<TwoWayLinkedDappsCollectionItem> items = default(List<TwoWayLinkedDappsCollectionItem>))
{
// to ensure "items" is required (not null)
if (items == null)
{
throw new ArgumentNullException("items is a required property for TwoWayLinkedDappsCollection and cannot be null");
}
this.Items = items;
this.TotalCount = totalCount;
this.NextCursor = nextCursor;
}

/// <summary>
/// Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.
/// </summary>
/// <value>Total number of items in underlying collection, fragment of which is available in &#x60;items&#x60; collection.</value>
[DataMember(Name = "total_count", EmitDefaultValue = true)]
public long? TotalCount { get; set; }

/// <summary>
/// If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.
/// </summary>
/// <value>If specified, contains a cursor to query next page of the &#x60;items&#x60; collection.</value>
[DataMember(Name = "next_cursor", EmitDefaultValue = true)]
public string NextCursor { get; set; }

/// <summary>
/// Gets or Sets Items
/// </summary>
Expand All @@ -146,8 +128,6 @@ public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class TwoWayLinkedDappsCollection {\n");
sb.Append(" TotalCount: ").Append(TotalCount).Append("\n");
sb.Append(" NextCursor: ").Append(NextCursor).Append("\n");
sb.Append(" Items: ").Append(Items).Append("\n");
sb.Append("}\n");
return sb.ToString();
Expand Down Expand Up @@ -184,16 +164,6 @@ public bool Equals(TwoWayLinkedDappsCollection input)
return false;
}
return
(
this.TotalCount == input.TotalCount ||
(this.TotalCount != null &&
this.TotalCount.Equals(input.TotalCount))
) &&
(
this.NextCursor == input.NextCursor ||
(this.NextCursor != null &&
this.NextCursor.Equals(input.NextCursor))
) &&
(
this.Items == input.Items ||
this.Items != null &&
Expand All @@ -211,14 +181,6 @@ public override int GetHashCode()
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.TotalCount != null)
{
hashCode = (hashCode * 59) + this.TotalCount.GetHashCode();
}
if (this.NextCursor != null)
{
hashCode = (hashCode * 59) + this.NextCursor.GetHashCode();
}
if (this.Items != null)
{
hashCode = (hashCode * 59) + this.Items.GetHashCode();
Expand Down
Loading
Loading