All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.topicus.jdbc.shaded.com.google.cloud.spanner.DatabaseClientImpl Maven / Gradle / Ivy

There is a newer version: 1.1.6
Show newest version
/*
 * Copyright 2017 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in nl.topicus.jdbc.shaded.com.liance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.nl.topicus.jdbc.shaded.org.licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.topicus.jdbc.shaded.com.google.cloud.spanner;

import nl.topicus.jdbc.shaded.com.google.cloud.Timestamp;
import nl.topicus.jdbc.shaded.com.google.nl.topicus.jdbc.shaded.com.on.util.concurrent.ListenableFuture;

class DatabaseClientImpl implements DatabaseClient {

  private final SessionPool pool;

  DatabaseClientImpl(SessionPool pool) {
    this.pool = pool;
  }

  @Override
  public Timestamp write(Iterable mutations) throws SpannerException {
    return pool.getReadWriteSession().write(mutations);
  }

  @Override
  public Timestamp writeAtLeastOnce(Iterable mutations) throws SpannerException {
    return pool.getReadSession().writeAtLeastOnce(mutations);
  }

  @Override
  public ReadContext singleUse() {
    return pool.getReadSession().singleUse();
  }

  @Override
  public ReadContext singleUse(TimestampBound bound) {
    return pool.getReadSession().singleUse(bound);
  }

  @Override
  public ReadOnlyTransaction singleUseReadOnlyTransaction() {
    return pool.getReadSession().singleUseReadOnlyTransaction();
  }

  @Override
  public ReadOnlyTransaction singleUseReadOnlyTransaction(TimestampBound bound) {
    return pool.getReadSession().singleUseReadOnlyTransaction(bound);
  }

  @Override
  public ReadOnlyTransaction readOnlyTransaction() {
    return pool.getReadSession().readOnlyTransaction();
  }

  @Override
  public ReadOnlyTransaction readOnlyTransaction(TimestampBound bound) {
    return pool.getReadSession().readOnlyTransaction(bound);
  }

  @Override
  public TransactionRunner readWriteTransaction() {
    return pool.getReadWriteSession().readWriteTransaction();
  }

  ListenableFuture closeAsync() {
    return pool.closeAsync();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy