@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + TABLE_NAME_FIELD_NUMBER; hash = (53 * hash) + getTableName().hashCode(); hash = (37 * hash) + APP_PROFILE_ID_FIELD_NUMBER; hash = (53 * hash) + getAppProfileId().hashCode(); if (getEntriesCount() > 0) { hash = (37 * hash) + ENTRIES_FIELD_NUMBER; hash = (53 * hash) + getEntriesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
/** * Handle an RPC level failure by generating a {@link FailedMutation} for each expected entry. The * newly generated {@link FailedMutation}s will be combined with the permanentFailures to give the * caller the whole picture since the first call. This method will always throw a {@link * MutateRowsException}. */ private void handleAttemptError(Throwable rpcError) { ApiException entryError = createSyntheticErrorForRpcFailure(rpcError); ImmutableList.Builder<FailedMutation> allFailures = ImmutableList.builder(); MutateRowsRequest lastRequest = currentRequest; allFailures.addAll(permanentFailures); Builder builder = lastRequest.toBuilder().clearEntries(); List<Integer> newOriginalIndexes = Lists.newArrayList(); for (int i = 0; i < currentRequest.getEntriesCount(); i++) { int origIndex = getOriginalIndex(i); FailedMutation failedMutation = FailedMutation.create(origIndex, entryError); allFailures.add(failedMutation); if (!failedMutation.getError().isRetryable()) { permanentFailures.add(failedMutation); } else { // Schedule the mutation entry for the next RPC by adding it to the request builder and // recording its original index newOriginalIndexes.add(origIndex); builder.addEntries(lastRequest.getEntries(i)); } } currentRequest = builder.build(); originalIndexes = newOriginalIndexes; throw new MutateRowsException(rpcError, allFailures.build(), entryError.isRetryable()); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.v2.MutateRowsRequest)) { return super.equals(obj); } com.google.bigtable.v2.MutateRowsRequest other = (com.google.bigtable.v2.MutateRowsRequest) obj; boolean result = true; result = result && getTableName().equals(other.getTableName()); result = result && getAppProfileId().equals(other.getAppProfileId()); result = result && getEntriesList().equals(other.getEntriesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@Override public void appendRequest(MutateRowsRequest request) { if (builder == null) { builder = request.toBuilder(); } else { builder.addAllEntries(request.getEntriesList()); } }
MutateRowsRequest.newBuilder() .addEntries(Entry.newBuilder().setRowKey(ByteString.copyFromUtf8("0-ok"))) .addEntries(Entry.newBuilder().setRowKey(ByteString.copyFromUtf8("1-unavailable"))) assertThat(innerCallable.lastRequest.getEntriesCount()).isEqualTo(1); assertThat(innerCallable.lastRequest.getEntries(0).getRowKey()) .isEqualTo(ByteString.copyFromUtf8("1-unavailable"));
@Test public void requestBuilderTest() { RequestBuilder<MutateRowsRequest> builder = descriptor.getRequestBuilder(); MutateRowsRequest expected = createRequest(5); for (Entry entry : expected.getEntriesList()) { MutateRowsRequest singleReq = MutateRowsRequest.newBuilder() .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID)) .addEntries(entry) .build(); builder.appendRequest(singleReq); } MutateRowsRequest actual = builder.build(); assertThat(actual).isEqualTo(expected); }
/** * * * <pre> * The unique name of the table to which the mutations should be applied. * </pre> * * <code>string table_name = 1;</code> */ public Builder clearTableName() { tableName_ = getDefaultInstance().getTableName(); onChanged(); return this; } /**
/** * Creates a new {@link MutateRowsRequest} that's a subset of the original request that * corresponds to a set of indices. * * @param indiciesToRetry * @return the new {@link MutateRowsRequest}. */ private MutateRowsRequest createRetryRequest(List<Integer> indiciesToRetry) { MutateRowsRequest.Builder updatedRequest = MutateRowsRequest.newBuilder() .setTableName(originalRequest.getTableName()); mapToOriginalIndex = new int[indiciesToRetry.size()]; for (int i = 0; i < indiciesToRetry.size(); i++) { mapToOriginalIndex[i] = indiciesToRetry.get(i); updatedRequest.addEntries(originalRequest.getEntries(indiciesToRetry.get(i))); } return updatedRequest.build(); }
/** {@inheritDoc} */ @Override public long countElements(MutateRowsRequest request) { return request.getEntriesCount(); }
public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); }
public Builder mergeFrom(com.google.bigtable.v2.MutateRowsRequest other) { if (other == com.google.bigtable.v2.MutateRowsRequest.getDefaultInstance()) return this; if (!other.getTableName().isEmpty()) { tableName_ = other.tableName_; onChanged(); if (!other.getAppProfileId().isEmpty()) { appProfileId_ = other.appProfileId_; onChanged();
MutateRowsRequest lastRequest = currentRequest; Builder builder = lastRequest.toBuilder().clearEntries(); List<Integer> newOriginalIndexes = Lists.newArrayList(); builder.addEntries(lastRequest.getEntries((int) entry.getIndex()));
private RetryingMutateRowsOperation createMutateRowsOperation(MutateRowsRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); } CallOptions callOptions = getCallOptions(mutateRowsRpc.getMethodDescriptor(), request); Metadata metadata = createMetadata(request.getTableName()); return new RetryingMutateRowsOperation(retryOptions, request, mutateRowsRpc, callOptions, retryExecutorService, metadata, CLOCK); }
/** {@inheritDoc} */ @Override public List<MutateRowsResponse> mutateRows(MutateRowsRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); } return createMutateRowsOperation(request).getBlockingResult(); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.v2.MutateRowsRequest)) { return super.equals(obj); } com.google.bigtable.v2.MutateRowsRequest other = (com.google.bigtable.v2.MutateRowsRequest) obj; boolean result = true; result = result && getTableName() .equals(other.getTableName()); result = result && getEntriesList() .equals(other.getEntriesList()); return result; }
assertWithMessage("Unexpected request: " + request.toString()).that(expectedRpc).isNotNull(); for (Entry entry : request.getEntriesList()) { requestKeys.add(entry.getRowKey().toStringUtf8()); for (Entry requestEntry : request.getEntriesList()) { String key = requestEntry.getRowKey().toStringUtf8(); Code responseCode = expectedRpc.entries.get(key);
@Override public Map<String, String> extract(MutateRowsRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("table_name", String.valueOf(request.getTableName())); return params.build(); } })
/** * * * <pre> * This value specifies routing for replication. If not specified, the * "default" application profile will be used. * </pre> * * <code>string app_profile_id = 3;</code> */ public Builder clearAppProfileId() { appProfileId_ = getDefaultInstance().getAppProfileId(); onChanged(); return this; } /**
@java.lang.Override public com.google.bigtable.v2.MutateRowsRequest getDefaultInstanceForType() { return com.google.bigtable.v2.MutateRowsRequest.getDefaultInstance(); }