Sha256: abf56a39f27fd53a6eeb369855ee4af68fd31b15ce4e70c1cc7a7386e8f23d88

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 * Copyright 2022-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
 *
 *     https://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 "scan_options.hxx"

#include "utils/movable_function.hxx"

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

#include <tl/expected.hpp>

#include <cinttypes>
#include <future>
#include <memory>
#include <optional>
#include <system_error>
#include <variant>
#include <vector>

namespace couchbase::core
{

class scan_result_impl;

class range_scan_item_iterator
{
  public:
    virtual ~range_scan_item_iterator() = default;
    virtual auto next() -> std::future<tl::expected<range_scan_item, std::error_code>> = 0;
    virtual void next(utils::movable_function<void(range_scan_item, std::error_code)> callback) = 0;
    virtual void cancel() = 0;
    virtual bool is_cancelled() = 0;
};

class scan_result
{
  public:
    explicit scan_result(std::shared_ptr<range_scan_item_iterator> iterator);
    [[nodiscard]] auto next() const -> tl::expected<range_scan_item, std::error_code>;
    void next(utils::movable_function<void(range_scan_item, std::error_code)> callback) const;
    void cancel();
    [[nodiscard]] auto is_cancelled() -> bool;

  private:
    std::shared_ptr<scan_result_impl> impl_{};
};
} // namespace couchbase::core

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
couchbase-3.4.5 ext/couchbase/core/scan_result.hxx
couchbase-3.4.4 ext/couchbase/core/scan_result.hxx