Skip to content

Commit

Permalink
feat: query many identity balances at a time (#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer authored Sep 11, 2024
1 parent f6c111c commit 3efa6c9
Show file tree
Hide file tree
Showing 42 changed files with 6,771 additions and 424 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions packages/dapi-grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
// Derive features for versioned messages
//
// "GetConsensusParamsRequest" is excluded as this message does not support proofs
const VERSIONED_REQUESTS: [&str; 26] = [
const VERSIONED_REQUESTS: [&str; 27] = [
"GetDataContractHistoryRequest",
"GetDataContractRequest",
"GetDataContractsRequest",
"GetDocumentsRequest",
"GetIdentitiesByPublicKeyHashesRequest",
"GetIdentitiesRequest",
"GetIdentitiesBalancesRequest",
"GetIdentityNonceRequest",
"GetIdentityContractNonceRequest",
"GetIdentityBalanceAndRevisionRequest",
Expand All @@ -77,13 +78,14 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
];

// "GetConsensusParamsResponse" is excluded as this message does not support proofs
const VERSIONED_RESPONSES: [&str; 27] = [
const VERSIONED_RESPONSES: [&str; 28] = [
"GetDataContractHistoryResponse",
"GetDataContractResponse",
"GetDataContractsResponse",
"GetDocumentsResponse",
"GetIdentitiesByPublicKeyHashesResponse",
"GetIdentitiesResponse",
"GetIdentitiesBalancesResponse",
"GetIdentityBalanceAndRevisionResponse",
"GetIdentityBalanceResponse",
"GetIdentityNonceResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,37 @@ org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceResponse> getGetI
return getGetIdentityBalanceMethod;
}

private static volatile io.grpc.MethodDescriptor<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest,
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse> getGetIdentitiesBalancesMethod;

@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "getIdentitiesBalances",
requestType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest.class,
responseType = org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest,
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse> getGetIdentitiesBalancesMethod() {
io.grpc.MethodDescriptor<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse> getGetIdentitiesBalancesMethod;
if ((getGetIdentitiesBalancesMethod = PlatformGrpc.getGetIdentitiesBalancesMethod) == null) {
synchronized (PlatformGrpc.class) {
if ((getGetIdentitiesBalancesMethod = PlatformGrpc.getGetIdentitiesBalancesMethod) == null) {
PlatformGrpc.getGetIdentitiesBalancesMethod = getGetIdentitiesBalancesMethod =
io.grpc.MethodDescriptor.<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest, org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "getIdentitiesBalances"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse.getDefaultInstance()))
.setSchemaDescriptor(new PlatformMethodDescriptorSupplier("getIdentitiesBalances"))
.build();
}
}
}
return getGetIdentitiesBalancesMethod;
}

private static volatile io.grpc.MethodDescriptor<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionRequest,
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionResponse> getGetIdentityBalanceAndRevisionMethod;

Expand Down Expand Up @@ -980,6 +1011,13 @@ public void getIdentityBalance(org.dash.platform.dapi.v0.PlatformOuterClass.GetI
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentityBalanceMethod(), responseObserver);
}

/**
*/
public void getIdentitiesBalances(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest request,
io.grpc.stub.StreamObserver<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetIdentitiesBalancesMethod(), responseObserver);
}

/**
*/
public void getIdentityBalanceAndRevision(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionRequest request,
Expand Down Expand Up @@ -1193,6 +1231,13 @@ public void getStatus(org.dash.platform.dapi.v0.PlatformOuterClass.GetStatusRequ
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceRequest,
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceResponse>(
this, METHODID_GET_IDENTITY_BALANCE)))
.addMethod(
getGetIdentitiesBalancesMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest,
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse>(
this, METHODID_GET_IDENTITIES_BALANCES)))
.addMethod(
getGetIdentityBalanceAndRevisionMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
Expand Down Expand Up @@ -1414,6 +1459,14 @@ public void getIdentityBalance(org.dash.platform.dapi.v0.PlatformOuterClass.GetI
getChannel().newCall(getGetIdentityBalanceMethod(), getCallOptions()), request, responseObserver);
}

/**
*/
public void getIdentitiesBalances(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest request,
io.grpc.stub.StreamObserver<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getGetIdentitiesBalancesMethod(), getCallOptions()), request, responseObserver);
}

/**
*/
public void getIdentityBalanceAndRevision(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionRequest request,
Expand Down Expand Up @@ -1661,6 +1714,13 @@ public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceResponse g
getChannel(), getGetIdentityBalanceMethod(), getCallOptions(), request);
}

/**
*/
public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse getIdentitiesBalances(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getGetIdentitiesBalancesMethod(), getCallOptions(), request);
}

/**
*/
public org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionResponse getIdentityBalanceAndRevision(org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionRequest request) {
Expand Down Expand Up @@ -1894,6 +1954,14 @@ public com.google.common.util.concurrent.ListenableFuture<org.dash.platform.dapi
getChannel().newCall(getGetIdentityBalanceMethod(), getCallOptions()), request);
}

/**
*/
public com.google.common.util.concurrent.ListenableFuture<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse> getIdentitiesBalances(
org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getGetIdentitiesBalancesMethod(), getCallOptions()), request);
}

/**
*/
public com.google.common.util.concurrent.ListenableFuture<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionResponse> getIdentityBalanceAndRevision(
Expand Down Expand Up @@ -2085,27 +2153,28 @@ public com.google.common.util.concurrent.ListenableFuture<org.dash.platform.dapi
private static final int METHODID_GET_IDENTITY_NONCE = 4;
private static final int METHODID_GET_IDENTITY_CONTRACT_NONCE = 5;
private static final int METHODID_GET_IDENTITY_BALANCE = 6;
private static final int METHODID_GET_IDENTITY_BALANCE_AND_REVISION = 7;
private static final int METHODID_GET_PROOFS = 8;
private static final int METHODID_GET_DATA_CONTRACT = 9;
private static final int METHODID_GET_DATA_CONTRACT_HISTORY = 10;
private static final int METHODID_GET_DATA_CONTRACTS = 11;
private static final int METHODID_GET_DOCUMENTS = 12;
private static final int METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH = 13;
private static final int METHODID_WAIT_FOR_STATE_TRANSITION_RESULT = 14;
private static final int METHODID_GET_CONSENSUS_PARAMS = 15;
private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_STATE = 16;
private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_VOTE_STATUS = 17;
private static final int METHODID_GET_EPOCHS_INFO = 18;
private static final int METHODID_GET_CONTESTED_RESOURCES = 19;
private static final int METHODID_GET_CONTESTED_RESOURCE_VOTE_STATE = 20;
private static final int METHODID_GET_CONTESTED_RESOURCE_VOTERS_FOR_IDENTITY = 21;
private static final int METHODID_GET_CONTESTED_RESOURCE_IDENTITY_VOTES = 22;
private static final int METHODID_GET_VOTE_POLLS_BY_END_DATE = 23;
private static final int METHODID_GET_PREFUNDED_SPECIALIZED_BALANCE = 24;
private static final int METHODID_GET_TOTAL_CREDITS_IN_PLATFORM = 25;
private static final int METHODID_GET_PATH_ELEMENTS = 26;
private static final int METHODID_GET_STATUS = 27;
private static final int METHODID_GET_IDENTITIES_BALANCES = 7;
private static final int METHODID_GET_IDENTITY_BALANCE_AND_REVISION = 8;
private static final int METHODID_GET_PROOFS = 9;
private static final int METHODID_GET_DATA_CONTRACT = 10;
private static final int METHODID_GET_DATA_CONTRACT_HISTORY = 11;
private static final int METHODID_GET_DATA_CONTRACTS = 12;
private static final int METHODID_GET_DOCUMENTS = 13;
private static final int METHODID_GET_IDENTITY_BY_PUBLIC_KEY_HASH = 14;
private static final int METHODID_WAIT_FOR_STATE_TRANSITION_RESULT = 15;
private static final int METHODID_GET_CONSENSUS_PARAMS = 16;
private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_STATE = 17;
private static final int METHODID_GET_PROTOCOL_VERSION_UPGRADE_VOTE_STATUS = 18;
private static final int METHODID_GET_EPOCHS_INFO = 19;
private static final int METHODID_GET_CONTESTED_RESOURCES = 20;
private static final int METHODID_GET_CONTESTED_RESOURCE_VOTE_STATE = 21;
private static final int METHODID_GET_CONTESTED_RESOURCE_VOTERS_FOR_IDENTITY = 22;
private static final int METHODID_GET_CONTESTED_RESOURCE_IDENTITY_VOTES = 23;
private static final int METHODID_GET_VOTE_POLLS_BY_END_DATE = 24;
private static final int METHODID_GET_PREFUNDED_SPECIALIZED_BALANCE = 25;
private static final int METHODID_GET_TOTAL_CREDITS_IN_PLATFORM = 26;
private static final int METHODID_GET_PATH_ELEMENTS = 27;
private static final int METHODID_GET_STATUS = 28;

private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
Expand Down Expand Up @@ -2152,6 +2221,10 @@ public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserv
serviceImpl.getIdentityBalance((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceRequest) request,
(io.grpc.stub.StreamObserver<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceResponse>) responseObserver);
break;
case METHODID_GET_IDENTITIES_BALANCES:
serviceImpl.getIdentitiesBalances((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesRequest) request,
(io.grpc.stub.StreamObserver<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentitiesBalancesResponse>) responseObserver);
break;
case METHODID_GET_IDENTITY_BALANCE_AND_REVISION:
serviceImpl.getIdentityBalanceAndRevision((org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionRequest) request,
(io.grpc.stub.StreamObserver<org.dash.platform.dapi.v0.PlatformOuterClass.GetIdentityBalanceAndRevisionResponse>) responseObserver);
Expand Down Expand Up @@ -2304,6 +2377,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
.addMethod(getGetIdentityNonceMethod())
.addMethod(getGetIdentityContractNonceMethod())
.addMethod(getGetIdentityBalanceMethod())
.addMethod(getGetIdentitiesBalancesMethod())
.addMethod(getGetIdentityBalanceAndRevisionMethod())
.addMethod(getGetProofsMethod())
.addMethod(getGetDataContractMethod())
Expand Down
Loading

0 comments on commit 3efa6c9

Please sign in to comment.