|
18 | 18 |
|
19 | 19 | import com.google.cloud.spanner.SpannerException; |
20 | 20 | import com.google.cloud.spanner.spi.v1.SpannerRpc.Option; |
| 21 | +import com.google.cloud.spanner.v1.stub.GrpcSpannerStub; |
| 22 | +import com.google.cloud.spanner.v1.stub.SpannerStub; |
| 23 | +import com.google.cloud.spanner.v1.stub.SpannerStubSettings; |
21 | 24 | import com.google.longrunning.Operation; |
22 | 25 | import com.google.protobuf.FieldMask; |
23 | 26 | import com.google.spanner.admin.database.v1.Database; |
|
34 | 37 | import com.google.spanner.v1.RollbackRequest; |
35 | 38 | import com.google.spanner.v1.Session; |
36 | 39 | import com.google.spanner.v1.Transaction; |
| 40 | +import java.io.IOException; |
37 | 41 | import java.util.List; |
38 | 42 | import java.util.Map; |
39 | 43 | import javax.annotation.Nullable; |
40 | 44 |
|
41 | | - |
42 | 45 | /** Implementation of Cloud Spanner remote calls using Gapic libraries. */ |
43 | 46 | public class GapicSpannerRpc implements SpannerRpc { |
| 47 | + private final SpannerStub stub; |
| 48 | + |
| 49 | + public GapicSpannerRpc() throws IOException { |
| 50 | + stub = GrpcSpannerStub.create(SpannerStubSettings.newBuilder().build()); |
| 51 | + } |
44 | 52 |
|
45 | 53 | @Override |
46 | 54 | public Paginated<InstanceConfig> listInstanceConfigs(int pageSize, @Nullable String pageToken) |
@@ -169,6 +177,8 @@ public PartitionResponse partitionQuery( |
169 | 177 | @Override |
170 | 178 | public PartitionResponse partitionRead( |
171 | 179 | PartitionReadRequest request, @Nullable Map<Option, ?> options) throws SpannerException { |
172 | | - throw new UnsupportedOperationException("Not implemented yet."); |
| 180 | + // TODO(pongad): Figure out metadata |
| 181 | + // TODO(pongad): Figure out channel affinity |
| 182 | + return stub.partitionReadCallable().call(request); |
173 | 183 | } |
174 | 184 | } |
0 commit comments