private BigtableSettings(BigtableSettings existing) : base(existing)
 {
     GaxPreconditions.CheckNotNull(existing, nameof(existing));
     MutateRowSettings          = existing.MutateRowSettings;
     CheckAndMutateRowSettings  = existing.CheckAndMutateRowSettings;
     ReadModifyWriteRowSettings = existing.ReadModifyWriteRowSettings;
     OnCopy(existing);
 }
        /// <summary>
        /// Constructs a client wrapper for the Bigtable service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="BigtableSettings"/> used within this client </param>
        public BigtableClientImpl(Bigtable.BigtableClient grpcClient, BigtableSettings settings)
        {
            this.GrpcClient = grpcClient;
            BigtableSettings effectiveSettings = settings ?? BigtableSettings.GetDefault();
            ClientHelper     clientHelper      = new ClientHelper(effectiveSettings);

            _callMutateRow = clientHelper.BuildApiCall <MutateRowRequest, MutateRowResponse>(
                GrpcClient.MutateRowAsync, GrpcClient.MutateRow, effectiveSettings.MutateRowSettings);
            _callCheckAndMutateRow = clientHelper.BuildApiCall <CheckAndMutateRowRequest, CheckAndMutateRowResponse>(
                GrpcClient.CheckAndMutateRowAsync, GrpcClient.CheckAndMutateRow, effectiveSettings.CheckAndMutateRowSettings);
            _callReadModifyWriteRow = clientHelper.BuildApiCall <ReadModifyWriteRowRequest, ReadModifyWriteRowResponse>(
                GrpcClient.ReadModifyWriteRowAsync, GrpcClient.ReadModifyWriteRow, effectiveSettings.ReadModifyWriteRowSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
Exemplo n.º 3
0
 partial void OnCopy(BigtableSettings existing)
 {
     IdempotentMutateRowSettings = existing.IdempotentMutateRowSettings;
 }
Exemplo n.º 4
0
 partial void OnConstruction(Bigtable.BigtableClient grpcClient, BigtableSettings effectiveSettings, ClientHelper clientHelper)
 {
     _idempotentMutateRowSettings = effectiveSettings.IdempotentMutateRowSettings;
 }
 partial void OnConstruction(Bigtable.BigtableClient grpcClient, BigtableSettings effectiveSettings, ClientHelper clientHelper);
 partial void OnCopy(BigtableSettings existing);
 /// <summary>
 /// Creates a <see cref="BigtableClient"/> which uses the specified channel for remote operations.
 /// </summary>
 /// <param name="channel">The <see cref="Channel"/> for remote operations. Must not be null.</param>
 /// <param name="settings">Optional <see cref="BigtableSettings"/>.</param>
 /// <returns>The created <see cref="BigtableClient"/>.</returns>
 public static BigtableClient Create(Channel channel, BigtableSettings settings = null)
 {
     GaxPreconditions.CheckNotNull(channel, nameof(channel));
     Bigtable.BigtableClient grpcClient = new Bigtable.BigtableClient(channel);
     return(new BigtableClientImpl(grpcClient, settings));
 }
        /// <summary>
        /// Synchronously creates a <see cref="BigtableClient"/>, applying defaults for all unspecified settings,
        /// and creating a channel connecting to the given endpoint with application default credentials where
        /// necessary.
        /// </summary>
        /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param>
        /// <param name="settings">Optional <see cref="BigtableSettings"/>.</param>
        /// <returns>The created <see cref="BigtableClient"/>.</returns>
        public static BigtableClient Create(ServiceEndpoint endpoint = null, BigtableSettings settings = null)
        {
            Channel channel = s_channelPool.GetChannel(endpoint ?? DefaultEndpoint);

            return(Create(channel, settings));
        }
        // Note: we could have parameterless overloads of Create and CreateAsync,
        // documented to just use the default endpoint, settings and credentials.
        // Pros:
        // - Might be more reassuring on first use
        // - Allows method group conversions
        // Con: overloads!

        /// <summary>
        /// Asynchronously creates a <see cref="BigtableClient"/>, applying defaults for all unspecified settings,
        /// and creating a channel connecting to the given endpoint with application default credentials where
        /// necessary.
        /// </summary>
        /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param>
        /// <param name="settings">Optional <see cref="BigtableSettings"/>.</param>
        /// <returns>The task representing the created <see cref="BigtableClient"/>.</returns>
        public static async Task <BigtableClient> CreateAsync(ServiceEndpoint endpoint = null, BigtableSettings settings = null)
        {
            Channel channel = await s_channelPool.GetChannelAsync(endpoint ?? DefaultEndpoint).ConfigureAwait(false);

            return(Create(channel, settings));
        }