2020-04-09 05:50:55 +08:00
|
|
|
/*
|
|
|
|
* SpecialKeySpace.actor.h
|
|
|
|
*
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
*
|
|
|
|
* Copyright 2013-2020 Apple Inc. and the FoundationDB project authors
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2020-03-04 10:35:24 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#if defined(NO_INTELLISENSE) && !defined(FDBCLIENT_SPECIALKEYSPACE_ACTOR_G_H)
|
|
|
|
#define FDBCLIENT_SPECIALKEYSPACE_ACTOR_G_H
|
|
|
|
#include "fdbclient/SpecialKeySpace.actor.g.h"
|
|
|
|
#elif !defined(FDBCLIENT_SPECIALKEYSPACE_ACTOR_H)
|
|
|
|
#define FDBCLIENT_SPECIALKEYSPACE_ACTOR_H
|
|
|
|
|
|
|
|
#include "flow/flow.h"
|
|
|
|
#include "flow/Arena.h"
|
|
|
|
#include "fdbclient/FDBTypes.h"
|
|
|
|
#include "fdbclient/KeyRangeMap.h"
|
|
|
|
#include "fdbclient/ReadYourWrites.h"
|
|
|
|
#include "flow/actorcompiler.h" // This must be the last #include.
|
|
|
|
|
2020-06-15 14:11:57 +08:00
|
|
|
class SpecialKeyRangeReadImpl {
|
2020-03-04 10:35:24 +08:00
|
|
|
public:
|
|
|
|
// Each derived class only needs to implement this simple version of getRange
|
2022-03-09 06:35:22 +08:00
|
|
|
//
|
|
|
|
// limitsHint can be used to reduce the amount of reading that the underlying
|
|
|
|
// implementation needs to do.
|
|
|
|
//
|
|
|
|
// NOTE: care needs to be taken when using limitsHint. If the range in question
|
|
|
|
// supports it, it is possible that some of the results may be removed when
|
|
|
|
// merged with mutations from the same transaction. If that happens, the final
|
|
|
|
// result may have fewer elements than the limit or even none at all if you didn't
|
|
|
|
// read the entire range.
|
|
|
|
//
|
|
|
|
// TODO: implement the range reading in a loop so that the underlying implementation
|
|
|
|
// can more naively fetch items up to the limit. If the merging deletes any entries,
|
|
|
|
// then the next set of entries can be read.
|
2022-03-07 13:52:39 +08:00
|
|
|
virtual Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const = 0;
|
2020-03-04 10:35:24 +08:00
|
|
|
|
2020-06-15 14:11:57 +08:00
|
|
|
explicit SpecialKeyRangeReadImpl(KeyRangeRef kr) : range(kr) {}
|
2020-03-04 10:35:24 +08:00
|
|
|
KeyRangeRef getKeyRange() const { return range; }
|
2020-06-12 12:31:05 +08:00
|
|
|
// true if the getRange call can emit more than one rpc calls,
|
|
|
|
// we cache the results to keep consistency in the same getrange lifetime
|
|
|
|
// TODO : give this function a more descriptive name
|
|
|
|
virtual bool isAsync() const { return false; }
|
2020-03-04 10:35:24 +08:00
|
|
|
|
2020-06-15 14:11:57 +08:00
|
|
|
virtual ~SpecialKeyRangeReadImpl() {}
|
2020-05-06 06:04:20 +08:00
|
|
|
|
2020-03-04 10:35:24 +08:00
|
|
|
protected:
|
2022-03-07 13:52:39 +08:00
|
|
|
// underlying key range for this function
|
|
|
|
KeyRange range;
|
2020-06-12 03:22:19 +08:00
|
|
|
};
|
|
|
|
|
2020-06-28 03:22:32 +08:00
|
|
|
class ManagementAPIError {
|
|
|
|
public:
|
2020-07-31 07:27:40 +08:00
|
|
|
static std::string toJsonString(bool retriable, const std::string& command, const std::string& msg) {
|
2020-06-28 03:22:32 +08:00
|
|
|
json_spirit::mObject errorObj;
|
2020-07-29 02:42:03 +08:00
|
|
|
errorObj["retriable"] = retriable;
|
|
|
|
errorObj["command"] = command;
|
|
|
|
errorObj["message"] = msg;
|
2020-06-28 03:22:32 +08:00
|
|
|
return json_spirit::write_string(json_spirit::mValue(errorObj), json_spirit::Output_options::raw_utf8);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ManagementAPIError(){};
|
|
|
|
};
|
|
|
|
|
2020-06-30 06:37:46 +08:00
|
|
|
class SpecialKeyRangeRWImpl : public SpecialKeyRangeReadImpl {
|
2020-06-16 03:47:27 +08:00
|
|
|
public:
|
2020-08-14 16:01:08 +08:00
|
|
|
virtual void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) {
|
|
|
|
ryw->getSpecialKeySpaceWriteMap().insert(key, std::make_pair(true, Optional<Value>(value)));
|
|
|
|
}
|
|
|
|
virtual void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) {
|
|
|
|
ryw->getSpecialKeySpaceWriteMap().insert(range, std::make_pair(true, Optional<Value>()));
|
|
|
|
}
|
|
|
|
virtual void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) {
|
|
|
|
ryw->getSpecialKeySpaceWriteMap().insert(key, std::make_pair(true, Optional<Value>()));
|
|
|
|
}
|
2022-03-07 13:52:39 +08:00
|
|
|
// all delayed async operations of writes in special-key-space
|
|
|
|
virtual Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) = 0;
|
|
|
|
|
2020-07-18 06:16:28 +08:00
|
|
|
// Given the special key to write, return the real key that needs to be modified
|
2020-08-21 04:50:35 +08:00
|
|
|
virtual Key decode(const KeyRef& key) const {
|
|
|
|
// Default implementation should never be used
|
|
|
|
ASSERT(false);
|
|
|
|
return key;
|
|
|
|
}
|
2020-07-31 17:18:49 +08:00
|
|
|
// Given the read key, return the corresponding special key
|
2020-08-21 04:50:35 +08:00
|
|
|
virtual Key encode(const KeyRef& key) const {
|
|
|
|
// Default implementation should never be used
|
|
|
|
ASSERT(false);
|
|
|
|
return key;
|
|
|
|
};
|
2020-06-16 03:47:27 +08:00
|
|
|
|
2020-06-24 02:21:03 +08:00
|
|
|
explicit SpecialKeyRangeRWImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {}
|
2020-06-16 03:47:27 +08:00
|
|
|
|
2021-01-26 09:55:43 +08:00
|
|
|
~SpecialKeyRangeRWImpl() override {}
|
2020-06-16 03:47:27 +08:00
|
|
|
};
|
|
|
|
|
2020-06-15 14:11:57 +08:00
|
|
|
class SpecialKeyRangeAsyncImpl : public SpecialKeyRangeReadImpl {
|
2020-06-12 03:22:19 +08:00
|
|
|
public:
|
2020-06-15 14:11:57 +08:00
|
|
|
explicit SpecialKeyRangeAsyncImpl(KeyRangeRef kr) : SpecialKeyRangeReadImpl(kr) {}
|
2020-06-12 03:22:19 +08:00
|
|
|
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override = 0;
|
2020-06-12 03:22:19 +08:00
|
|
|
|
|
|
|
// calling with a cache object to have consistent results if we need to call rpc
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint,
|
|
|
|
Optional<RangeResult>* cache) const {
|
|
|
|
return getRangeAsyncActor(this, ryw, kr, limitsHint, cache);
|
2020-06-12 03:22:19 +08:00
|
|
|
}
|
|
|
|
|
2020-06-12 12:31:05 +08:00
|
|
|
bool isAsync() const override { return true; }
|
|
|
|
|
2021-05-04 04:14:16 +08:00
|
|
|
ACTOR static Future<RangeResult> getRangeAsyncActor(const SpecialKeyRangeReadImpl* skrAyncImpl,
|
|
|
|
ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
2022-03-07 13:52:39 +08:00
|
|
|
GetRangeLimits limits,
|
2021-05-04 04:14:16 +08:00
|
|
|
Optional<RangeResult>* cache) {
|
2020-06-12 03:22:19 +08:00
|
|
|
ASSERT(skrAyncImpl->getKeyRange().contains(kr));
|
2020-06-12 12:31:05 +08:00
|
|
|
ASSERT(cache != nullptr);
|
|
|
|
if (!cache->present()) {
|
2020-06-12 03:22:19 +08:00
|
|
|
// For simplicity, every time we need to cache, we read the whole range
|
2020-06-12 12:31:05 +08:00
|
|
|
// Although sometimes the range can be narrowed,
|
|
|
|
// there is not a general way to do it in complicated scenarios
|
2022-03-07 13:52:39 +08:00
|
|
|
RangeResult result_ = wait(skrAyncImpl->getRange(ryw, skrAyncImpl->getKeyRange(), limits));
|
2020-06-12 03:22:19 +08:00
|
|
|
*cache = result_;
|
|
|
|
}
|
|
|
|
const auto& allResults = cache->get();
|
|
|
|
int start = 0, end = allResults.size();
|
2021-03-11 02:06:03 +08:00
|
|
|
while (start < allResults.size() && allResults[start].key < kr.begin)
|
|
|
|
++start;
|
|
|
|
while (end > 0 && allResults[end - 1].key >= kr.end)
|
|
|
|
--end;
|
2020-06-12 03:22:19 +08:00
|
|
|
if (start < end) {
|
2021-05-04 04:14:16 +08:00
|
|
|
RangeResult result = RangeResultRef(allResults.slice(start, end), false);
|
2020-06-12 03:22:19 +08:00
|
|
|
result.arena().dependsOn(allResults.arena());
|
|
|
|
return result;
|
|
|
|
} else
|
2021-05-04 04:14:16 +08:00
|
|
|
return RangeResult();
|
2020-06-12 03:22:19 +08:00
|
|
|
}
|
2020-03-04 10:35:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SpecialKeySpace {
|
|
|
|
public:
|
2020-05-13 05:52:37 +08:00
|
|
|
enum class MODULE {
|
2021-06-04 06:10:04 +08:00
|
|
|
ACTORLINEAGE, // Sampling data
|
|
|
|
ACTOR_PROFILER_CONF, // profiler configuration
|
2020-05-19 01:38:23 +08:00
|
|
|
CLUSTERFILEPATH,
|
2020-08-14 16:01:08 +08:00
|
|
|
CONFIGURATION, // Configuration of the cluster
|
2020-05-19 01:38:23 +08:00
|
|
|
CONNECTIONSTRING,
|
2020-07-25 02:38:56 +08:00
|
|
|
ERRORMSG, // A single key space contains a json string which describes the last error in special-key-space
|
2021-02-13 10:55:01 +08:00
|
|
|
GLOBALCONFIG, // Global configuration options synchronized to all nodes
|
2020-06-15 13:29:44 +08:00
|
|
|
MANAGEMENT, // Management-API
|
2020-05-19 01:38:23 +08:00
|
|
|
METRICS, // data-distribution metrics
|
2020-05-15 15:38:06 +08:00
|
|
|
TESTONLY, // only used by correctness tests
|
2020-12-01 06:57:17 +08:00
|
|
|
TRACING, // Distributed tracing options
|
2020-05-19 01:38:23 +08:00
|
|
|
TRANSACTION, // transaction related info, conflicting keys, read/write conflict range
|
2020-05-13 05:52:37 +08:00
|
|
|
STATUSJSON,
|
2020-05-19 01:38:23 +08:00
|
|
|
UNKNOWN, // default value for all unregistered range
|
|
|
|
WORKERINTERFACE,
|
2020-05-13 05:52:37 +08:00
|
|
|
};
|
2020-05-12 18:29:17 +08:00
|
|
|
|
2020-07-28 03:29:03 +08:00
|
|
|
enum class IMPLTYPE {
|
|
|
|
READONLY, // The underlying special key range can only be called with get and getRange
|
|
|
|
READWRITE // The underlying special key range can be called with get, getRange, set, clear
|
|
|
|
};
|
|
|
|
|
2020-07-07 05:02:22 +08:00
|
|
|
SpecialKeySpace(KeyRef spaceStartKey = Key(), KeyRef spaceEndKey = normalKeys.end, bool testOnly = true);
|
2020-06-24 02:21:03 +08:00
|
|
|
|
|
|
|
Future<Optional<Value>> get(ReadYourWritesTransaction* ryw, const Key& key);
|
|
|
|
|
2021-05-04 04:14:16 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeySelector begin,
|
|
|
|
KeySelector end,
|
|
|
|
GetRangeLimits limits,
|
2021-07-17 15:11:40 +08:00
|
|
|
Reverse = Reverse::False);
|
2020-06-30 06:37:46 +08:00
|
|
|
|
2020-07-07 05:02:22 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value);
|
|
|
|
|
2020-07-18 06:16:28 +08:00
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range);
|
2020-07-07 05:02:22 +08:00
|
|
|
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key);
|
|
|
|
|
2020-06-24 02:21:03 +08:00
|
|
|
Future<Void> commit(ReadYourWritesTransaction* ryw);
|
|
|
|
|
2021-03-11 02:06:03 +08:00
|
|
|
void registerKeyRange(SpecialKeySpace::MODULE module,
|
|
|
|
SpecialKeySpace::IMPLTYPE type,
|
|
|
|
const KeyRangeRef& kr,
|
2020-07-28 03:29:03 +08:00
|
|
|
SpecialKeyRangeReadImpl* impl);
|
|
|
|
|
2020-07-18 06:16:28 +08:00
|
|
|
Key decode(const KeyRef& key);
|
|
|
|
KeyRange decode(const KeyRangeRef& kr);
|
2020-05-15 08:30:48 +08:00
|
|
|
|
2020-06-15 14:11:57 +08:00
|
|
|
KeyRangeMap<SpecialKeyRangeReadImpl*>& getReadImpls() { return readImpls; }
|
2020-06-24 02:21:03 +08:00
|
|
|
KeyRangeMap<SpecialKeyRangeRWImpl*>& getRWImpls() { return writeImpls; }
|
2020-06-30 06:37:46 +08:00
|
|
|
KeyRangeMap<SpecialKeySpace::MODULE>& getModules() { return modules; }
|
2020-05-12 15:42:43 +08:00
|
|
|
KeyRangeRef getKeyRange() const { return range; }
|
2020-07-18 06:16:28 +08:00
|
|
|
static KeyRangeRef getModuleRange(SpecialKeySpace::MODULE module) { return moduleToBoundary.at(module); }
|
2022-03-07 13:52:39 +08:00
|
|
|
static KeyRangeRef getManagementApiCommandRange(const std::string& command) {
|
2020-07-18 06:16:28 +08:00
|
|
|
return managementApiCommandToRange.at(command);
|
|
|
|
}
|
2020-07-29 03:05:43 +08:00
|
|
|
static KeyRef getManagementApiCommandPrefix(const std::string& command) {
|
2020-07-18 06:16:28 +08:00
|
|
|
return managementApiCommandToRange.at(command).begin;
|
|
|
|
}
|
2021-06-04 06:10:04 +08:00
|
|
|
static KeyRangeRef getActorLineageApiCommandRange(const std::string& command) {
|
|
|
|
return actorLineageApiCommandToRange.at(command);
|
|
|
|
}
|
|
|
|
static KeyRef getActorLineageApiCommandPrefix(const std::string& command) {
|
|
|
|
return actorLineageApiCommandToRange.at(command).begin;
|
|
|
|
}
|
2020-07-18 03:32:42 +08:00
|
|
|
static Key getManagementApiCommandOptionSpecialKey(const std::string& command, const std::string& option);
|
2020-08-06 04:20:12 +08:00
|
|
|
static const std::set<std::string>& getManagementApiOptionsSet() { return options; }
|
2020-12-05 03:21:39 +08:00
|
|
|
static const std::set<std::string>& getTracingOptions() { return tracingOptions; }
|
2020-03-04 10:35:24 +08:00
|
|
|
|
|
|
|
private:
|
2020-05-21 04:55:07 +08:00
|
|
|
ACTOR static Future<Optional<Value>> getActor(SpecialKeySpace* sks, ReadYourWritesTransaction* ryw, KeyRef key);
|
2020-03-04 10:35:24 +08:00
|
|
|
|
2021-05-04 04:14:16 +08:00
|
|
|
ACTOR static Future<RangeResult> checkRYWValid(SpecialKeySpace* sks,
|
|
|
|
ReadYourWritesTransaction* ryw,
|
|
|
|
KeySelector begin,
|
|
|
|
KeySelector end,
|
|
|
|
GetRangeLimits limits,
|
2021-07-03 12:41:50 +08:00
|
|
|
Reverse reverse);
|
2021-05-04 04:14:16 +08:00
|
|
|
ACTOR static Future<RangeResult> getRangeAggregationActor(SpecialKeySpace* sks,
|
|
|
|
ReadYourWritesTransaction* ryw,
|
|
|
|
KeySelector begin,
|
|
|
|
KeySelector end,
|
|
|
|
GetRangeLimits limits,
|
2021-07-03 12:41:50 +08:00
|
|
|
Reverse reverse);
|
2020-06-15 14:11:57 +08:00
|
|
|
|
|
|
|
KeyRangeMap<SpecialKeyRangeReadImpl*> readImpls;
|
2020-06-30 06:37:46 +08:00
|
|
|
KeyRangeMap<SpecialKeySpace::MODULE> modules;
|
2020-06-24 02:21:03 +08:00
|
|
|
KeyRangeMap<SpecialKeyRangeRWImpl*> writeImpls;
|
2022-03-07 13:52:39 +08:00
|
|
|
|
|
|
|
// key space range, (\xff\xff, \xff\xff\xff) in prod and (, \xff) in test
|
|
|
|
KeyRange range;
|
2020-06-30 06:37:46 +08:00
|
|
|
|
|
|
|
static std::unordered_map<SpecialKeySpace::MODULE, KeyRange> moduleToBoundary;
|
2022-03-07 13:52:39 +08:00
|
|
|
|
|
|
|
// management command to its special keys' range
|
|
|
|
static std::unordered_map<std::string, KeyRange> managementApiCommandToRange;
|
2021-06-04 06:10:04 +08:00
|
|
|
static std::unordered_map<std::string, KeyRange> actorLineageApiCommandToRange;
|
2022-03-07 13:52:39 +08:00
|
|
|
|
|
|
|
// "<command>/<option>"
|
|
|
|
static std::set<std::string> options;
|
2020-12-05 03:21:39 +08:00
|
|
|
static std::set<std::string> tracingOptions;
|
2020-05-13 17:28:04 +08:00
|
|
|
|
2020-06-30 06:37:46 +08:00
|
|
|
// Initialize module boundaries, used to handle cross_module_read
|
2020-07-07 05:02:22 +08:00
|
|
|
void modulesBoundaryInit();
|
2020-03-04 10:35:24 +08:00
|
|
|
};
|
|
|
|
|
2020-09-09 02:08:48 +08:00
|
|
|
// Used for SpecialKeySpaceCorrectnessWorkload
|
|
|
|
class SKSCTestImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit SKSCTestImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-09-09 02:08:48 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2020-04-07 13:09:17 +08:00
|
|
|
// Use special key prefix "\xff\xff/transaction/conflicting_keys/<some_key>",
|
|
|
|
// to retrieve keys which caused latest not_committed(conflicting with another transaction) error.
|
|
|
|
// The returned key value pairs are interpretted as :
|
|
|
|
// prefix/<key1> : '1' - any keys equal or larger than this key are (probably) conflicting keys
|
|
|
|
// prefix/<key2> : '0' - any keys equal or larger than this key are (definitely) not conflicting keys
|
|
|
|
// Currently, the conflicting keyranges returned are original read_conflict_ranges or union of them.
|
2020-06-15 14:11:57 +08:00
|
|
|
class ConflictingKeysImpl : public SpecialKeyRangeReadImpl {
|
2020-04-04 07:11:20 +08:00
|
|
|
public:
|
2020-04-15 00:10:40 +08:00
|
|
|
explicit ConflictingKeysImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-04-04 07:11:20 +08:00
|
|
|
};
|
|
|
|
|
2020-06-15 14:11:57 +08:00
|
|
|
class ReadConflictRangeImpl : public SpecialKeyRangeReadImpl {
|
2020-04-29 00:00:06 +08:00
|
|
|
public:
|
|
|
|
explicit ReadConflictRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-04-29 00:00:06 +08:00
|
|
|
};
|
|
|
|
|
2020-06-15 14:11:57 +08:00
|
|
|
class WriteConflictRangeImpl : public SpecialKeyRangeReadImpl {
|
2020-04-29 01:34:10 +08:00
|
|
|
public:
|
|
|
|
explicit WriteConflictRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-04-29 01:34:10 +08:00
|
|
|
};
|
|
|
|
|
2020-06-12 03:22:19 +08:00
|
|
|
class DDStatsRangeImpl : public SpecialKeyRangeAsyncImpl {
|
2020-05-19 01:38:23 +08:00
|
|
|
public:
|
|
|
|
explicit DDStatsRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-05-19 01:38:23 +08:00
|
|
|
};
|
|
|
|
|
2020-07-17 09:15:35 +08:00
|
|
|
class ManagementCommandsOptionsImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit ManagementCommandsOptionsImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-07-17 09:15:35 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override;
|
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2021-06-10 08:04:05 +08:00
|
|
|
// Special key management api for excluding localities (exclude_locality)
|
2021-05-19 14:48:04 +08:00
|
|
|
class ExcludedLocalitiesRangeImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit ExcludedLocalitiesRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-05-19 14:48:04 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
|
|
|
Key decode(const KeyRef& key) const override;
|
|
|
|
Key encode(const KeyRef& key) const override;
|
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2021-06-10 08:04:05 +08:00
|
|
|
// Special key management api for excluding localities with failed option (failed_locality)
|
2021-05-19 14:48:04 +08:00
|
|
|
class FailedLocalitiesRangeImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit FailedLocalitiesRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-05-19 14:48:04 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
|
|
|
Key decode(const KeyRef& key) const override;
|
|
|
|
Key encode(const KeyRef& key) const override;
|
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2020-06-24 02:21:03 +08:00
|
|
|
class ExcludeServersRangeImpl : public SpecialKeyRangeRWImpl {
|
2020-06-15 13:29:44 +08:00
|
|
|
public:
|
|
|
|
explicit ExcludeServersRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-09-05 06:21:47 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
2020-07-31 17:18:49 +08:00
|
|
|
Key decode(const KeyRef& key) const override;
|
|
|
|
Key encode(const KeyRef& key) const override;
|
2020-06-28 03:22:32 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
2020-06-15 13:29:44 +08:00
|
|
|
};
|
|
|
|
|
2020-07-07 06:40:21 +08:00
|
|
|
class FailedServersRangeImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit FailedServersRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-09-05 06:21:47 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
2020-07-31 17:18:49 +08:00
|
|
|
Key decode(const KeyRef& key) const override;
|
|
|
|
Key encode(const KeyRef& key) const override;
|
2020-07-07 06:40:21 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2020-07-14 04:35:25 +08:00
|
|
|
class ExclusionInProgressRangeImpl : public SpecialKeyRangeAsyncImpl {
|
|
|
|
public:
|
|
|
|
explicit ExclusionInProgressRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-07-14 04:35:25 +08:00
|
|
|
};
|
|
|
|
|
2020-08-14 16:01:08 +08:00
|
|
|
class ProcessClassRangeImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit ProcessClassRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-08-14 16:01:08 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
2020-08-20 08:54:38 +08:00
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override;
|
2020-08-14 16:01:08 +08:00
|
|
|
};
|
|
|
|
|
2020-08-26 09:18:32 +08:00
|
|
|
class ProcessClassSourceRangeImpl : public SpecialKeyRangeReadImpl {
|
|
|
|
public:
|
|
|
|
explicit ProcessClassSourceRangeImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-08-26 09:18:32 +08:00
|
|
|
};
|
|
|
|
|
2020-10-09 05:23:02 +08:00
|
|
|
class LockDatabaseImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit LockDatabaseImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-10-09 05:23:02 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2020-10-23 02:08:54 +08:00
|
|
|
class ConsistencyCheckImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit ConsistencyCheckImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-10-23 02:08:54 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2021-02-13 10:55:01 +08:00
|
|
|
class GlobalConfigImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit GlobalConfigImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-02-13 10:55:01 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override;
|
2020-10-23 02:08:54 +08:00
|
|
|
};
|
|
|
|
|
2020-12-01 06:57:17 +08:00
|
|
|
class TracingOptionsImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit TracingOptionsImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2020-12-01 06:57:17 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override;
|
|
|
|
};
|
|
|
|
|
2021-01-30 03:45:52 +08:00
|
|
|
class CoordinatorsImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit CoordinatorsImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-01-30 03:45:52 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override;
|
|
|
|
};
|
|
|
|
|
2021-02-17 15:55:58 +08:00
|
|
|
class CoordinatorsAutoImpl : public SpecialKeyRangeReadImpl {
|
|
|
|
public:
|
|
|
|
explicit CoordinatorsAutoImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-02-17 15:55:58 +08:00
|
|
|
};
|
|
|
|
|
2021-02-18 17:27:14 +08:00
|
|
|
class AdvanceVersionImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit AdvanceVersionImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-02-18 17:27:14 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2021-02-20 04:22:00 +08:00
|
|
|
class ClientProfilingImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit ClientProfilingImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-02-20 04:22:00 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
2021-02-26 05:02:56 +08:00
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override;
|
2021-02-20 04:22:00 +08:00
|
|
|
};
|
|
|
|
|
2021-06-04 06:10:04 +08:00
|
|
|
class ActorLineageImpl : public SpecialKeyRangeReadImpl {
|
|
|
|
public:
|
|
|
|
explicit ActorLineageImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-06-04 06:10:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class ActorProfilerConf : public SpecialKeyRangeRWImpl {
|
|
|
|
bool didWrite = false;
|
|
|
|
std::map<std::string, std::string> config;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ActorProfilerConf(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-06-04 06:10:04 +08:00
|
|
|
void set(ReadYourWritesTransaction* ryw, const KeyRef& key, const ValueRef& value) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRangeRef& range) override;
|
|
|
|
void clear(ReadYourWritesTransaction* ryw, const KeyRef& key) override;
|
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2021-03-27 03:19:33 +08:00
|
|
|
class MaintenanceImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit MaintenanceImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-03-27 03:19:33 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
2021-06-04 06:10:04 +08:00
|
|
|
|
2021-03-27 03:19:33 +08:00
|
|
|
class DataDistributionImpl : public SpecialKeyRangeRWImpl {
|
|
|
|
public:
|
|
|
|
explicit DataDistributionImpl(KeyRangeRef kr);
|
2022-03-07 13:52:39 +08:00
|
|
|
Future<RangeResult> getRange(ReadYourWritesTransaction* ryw,
|
|
|
|
KeyRangeRef kr,
|
|
|
|
GetRangeLimits limitsHint) const override;
|
2021-03-27 03:19:33 +08:00
|
|
|
Future<Optional<std::string>> commit(ReadYourWritesTransaction* ryw) override;
|
|
|
|
};
|
|
|
|
|
2020-03-04 10:35:24 +08:00
|
|
|
#include "flow/unactorcompiler.h"
|
|
|
|
#endif
|