Sha256: 1750ce7982bc717401aa7ec9db4d55f76ad7a98c7ec7a43baf303db778bb70b3

Contents?: true

Size: 1.68 KB

Versions: 5

Compression:

Stored size: 1.68 KB

Contents

/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *   Copyright 2020-Present Couchbase, Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.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.
 */

#pragma once

#include <couchbase/mutation_result.hxx>
#include <couchbase/mutation_token.hxx>

#include <vector>

namespace couchbase
{
/**
 * Aggregation of one or more {@link mutation_token}s for specifying consistency requirements of
 * N1QL or FTS queries.
 *
 * @since 1.0.0
 * @committed
 */
class mutation_state
{
public:
  /**
   * @since 1.0.0
   * @committed
   */
  mutation_state() = default;

  /**
   * Copies mutation token from the given mutation result.
   *
   * @param result mutation result
   *
   * @since 1.0.0
   * @committed
   */
  void add(const mutation_result& result)
  {
    if (result.mutation_token().has_value()) {
      tokens_.push_back(result.mutation_token().value());
    }
  }

  /**
   * List of the mutation tokens
   *
   * @return tokens
   *
   * @since 1.0.0
   * @committed
   */
  [[nodiscard]] auto tokens() const -> const std::vector<mutation_token>&
  {
    return tokens_;
  }

private:
  std::vector<mutation_token> tokens_{ 0 };
};
} // namespace couchbase

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
couchbase-3.5.6 ext/couchbase/couchbase/mutation_state.hxx
couchbase-3.5.5 ext/couchbase/couchbase/mutation_state.hxx
couchbase-3.5.4 ext/couchbase/couchbase/mutation_state.hxx
couchbase-3.5.3 ext/couchbase/couchbase/mutation_state.hxx
couchbase-3.5.2 ext/couchbase/couchbase/mutation_state.hxx