SpannerImpl(SpannerOptions options) { this(options.getSpannerRpcV1(), options.getPrefetchChunks(), options); }
BatchReadOnlyTransactionImpl(SpannerImpl spanner, SessionImpl session, TimestampBound bound) { super( checkNotNull(session), checkNotNull(bound), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); initTransaction(); }
BatchReadOnlyTransactionImpl( SpannerImpl spanner, SessionImpl session, BatchTransactionId batchTransactionId) { super( checkNotNull(session), checkNotNull(batchTransactionId).getTransactionId(), batchTransactionId.getTimestamp(), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); }
@Test public void testBatchReadOnlyTxnWithBound() throws Exception { Session sessionProto = Session.newBuilder().setName(SESSION_NAME).build(); when(gapicRpc.createSession( eq(DB_NAME), (Map<String, String>) anyMap(), optionsCaptor.capture())) .thenReturn(sessionProto); com.google.protobuf.Timestamp timestamp = Timestamps.parse(TIMESTAMP); Transaction txnMetadata = Transaction.newBuilder().setId(TXN_ID).setReadTimestamp(timestamp).build(); when(spannerOptions.getSpannerRpcV1()).thenReturn(gapicRpc); when(gapicRpc.beginTransaction(Mockito.<BeginTransactionRequest>any(), optionsCaptor.capture())) .thenReturn(txnMetadata); BatchReadOnlyTransaction batchTxn = client.batchReadOnlyTransaction(TimestampBound.strong()); assertThat(batchTxn.getBatchTransactionId().getSessionId()).isEqualTo(SESSION_NAME); assertThat(batchTxn.getBatchTransactionId().getTransactionId()).isEqualTo(TXN_ID); Timestamp t = Timestamp.parseTimestamp(TIMESTAMP); assertThat(batchTxn.getReadTimestamp()).isEqualTo(t); assertThat(batchTxn.getReadTimestamp()) .isEqualTo(batchTxn.getBatchTransactionId().getTimestamp()); }
SpannerImpl(SpannerOptions options) { this(options.getSpannerRpcV1(), options.getPrefetchChunks(), options); }
BatchReadOnlyTransactionImpl(SpannerImpl spanner, SessionImpl session, TimestampBound bound) { super( checkNotNull(session), checkNotNull(bound), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); initTransaction(); }
BatchReadOnlyTransactionImpl( SpannerImpl spanner, SessionImpl session, BatchTransactionId batchTransactionId) { super( checkNotNull(session), checkNotNull(batchTransactionId).getTransactionId(), batchTransactionId.getTimestamp(), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); }