mirror of https://gitee.com/bigwinds/arangodb
Add API for Transaction::indexScan.
This commit is contained in:
parent
092d96db08
commit
5fccaecc67
|
@ -0,0 +1,78 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
||||||
|
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// 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.
|
||||||
|
///
|
||||||
|
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Max Neunhoeffer
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef ARANGOD_UTILS_OPERATION_CURSOR_H
|
||||||
|
#define ARANGOD_UTILS_OPERATION_CURSOR_H 1
|
||||||
|
|
||||||
|
#include "Basics/Common.h"
|
||||||
|
#include "Utils/OperationResult.h"
|
||||||
|
#include "Indexes/Index.h"
|
||||||
|
#include "Indexes/IndexIterator.h"
|
||||||
|
|
||||||
|
#include <velocypack/Buffer.h>
|
||||||
|
#include <velocypack/Options.h>
|
||||||
|
#include <velocypack/Slice.h>
|
||||||
|
#include <velocypack/velocypack-aliases.h>
|
||||||
|
|
||||||
|
namespace arangodb {
|
||||||
|
|
||||||
|
struct OperationCursor : public OperationResult {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::unique_ptr<IndexIterator> _indexIterator;
|
||||||
|
bool _hasMore;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit OperationCursor(int code)
|
||||||
|
: OperationResult(code), _hasMore(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
OperationCursor(int code, std::string const& message)
|
||||||
|
: OperationResult(code, message), _hasMore(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
OperationCursor(std::shared_ptr<VPackBuffer<uint8_t>> buffer,
|
||||||
|
VPackCustomTypeHandler* handler,
|
||||||
|
std::string const& message,
|
||||||
|
int code,
|
||||||
|
bool wasSynchronous)
|
||||||
|
: OperationResult(buffer, handler, message, code, wasSynchronous),
|
||||||
|
_hasMore(true) {
|
||||||
|
}
|
||||||
|
|
||||||
|
~OperationCursor() {
|
||||||
|
// TODO: handle destruction of customTypeHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasMore() {
|
||||||
|
return _hasMore;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getMore(uint64_t count);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -34,6 +34,7 @@
|
||||||
#include "Utils/DocumentHelper.h"
|
#include "Utils/DocumentHelper.h"
|
||||||
#include "Utils/OperationOptions.h"
|
#include "Utils/OperationOptions.h"
|
||||||
#include "Utils/OperationResult.h"
|
#include "Utils/OperationResult.h"
|
||||||
|
#include "Utils/OperationCursor.h"
|
||||||
#include "Utils/TransactionContext.h"
|
#include "Utils/TransactionContext.h"
|
||||||
#include "VocBase/collection.h"
|
#include "VocBase/collection.h"
|
||||||
#include "VocBase/Ditch.h"
|
#include "VocBase/Ditch.h"
|
||||||
|
@ -118,6 +119,22 @@ class Transaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief Type of cursor
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
enum class CursorType {
|
||||||
|
ALL = 0,
|
||||||
|
ANY,
|
||||||
|
EDGE,
|
||||||
|
GEO1,
|
||||||
|
GEO2,
|
||||||
|
HASH,
|
||||||
|
FULLTEXT,
|
||||||
|
SKIPLIST
|
||||||
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief return database of transaction
|
/// @brief return database of transaction
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -710,6 +727,15 @@ class Transaction {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief factory for OperationCursor objects
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
OperationCursor indexScan(std::string const& collection,
|
||||||
|
CursorType cursorType,
|
||||||
|
std::string const& indexId,
|
||||||
|
std::shared_ptr<std::vector<VPackSlice>> search);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief test if a collection is already locked
|
/// @brief test if a collection is already locked
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue