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

feat: query many identity balances at a time #2112

Merged
merged 9 commits into from
Sep 11, 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
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 @@
// 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 @@
];

// "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 Expand Up @@ -207,8 +209,8 @@
///
/// * `protobuf_file` - Path to the protobuf file to use as input.
/// * `out_dir` - Output directory where subdirectories for generated files will be created.
/// Depending on the features, either `client`, `server` or `client_server` subdirectory

Check warning on line 212 in packages/dapi-grpc/build.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dapi-grpc) / Linting

doc list item missing indentation

warning: doc list item missing indentation --> packages/dapi-grpc/build.rs:212:9 | 212 | /// Depending on the features, either `client`, `server` or `client_server` subdirectory | ^ | = help: if this is supposed to be its own paragraph, add a blank line = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation = note: `#[warn(clippy::doc_lazy_continuation)]` on by default help: indent this line | 212 | /// Depending on the features, either `client`, `server` or `client_server` subdirectory | ++
/// will be created inside `out_dir`.

Check warning on line 213 in packages/dapi-grpc/build.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dapi-grpc) / Linting

doc list item missing indentation

warning: doc list item missing indentation --> packages/dapi-grpc/build.rs:213:9 | 213 | /// will be created inside `out_dir`. | ^ | = help: if this is supposed to be its own paragraph, add a blank line = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation help: indent this line | 213 | /// will be created inside `out_dir`. | ++
fn new(protobuf_file: PathBuf, out_dir: PathBuf) -> Self {
let protobuf_file = abs_path(&protobuf_file);

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
Loading