mirror of https://gitee.com/bigwinds/arangodb
removed dead code
This commit is contained in:
parent
8f7da8f062
commit
2986ec2a64
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "Basics/Common.h"
|
||||
#include "Basics/ReadLocker.h"
|
||||
#include "Basics/StringBuffer.h"
|
||||
#include "Basics/StringUtils.h"
|
||||
#include "Cluster/ServerState.h"
|
||||
#include "Cluster/ClusterInfo.h"
|
||||
|
@ -249,30 +248,6 @@ class CollectionNameResolver {
|
|||
return name.size();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a collection name for a collection id, this implements
|
||||
/// some magic in the cluster case: a DBserver in a cluster will automatically
|
||||
/// translate the local collection ID into a cluster wide collection name.
|
||||
///
|
||||
/// the name is copied into <buffer>. the caller is responsible for allocating
|
||||
/// a big-enough buffer (that is, at least 64 bytes). no NUL byte is appended
|
||||
/// to the buffer. the length of the collection name is returned.
|
||||
/// TODO: remove this
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void getCollectionName(TRI_voc_cid_t cid,
|
||||
arangodb::basics::StringBuffer& buffer) const {
|
||||
auto const& it = _resolvedIds.find(cid);
|
||||
|
||||
if (it != _resolvedIds.end()) {
|
||||
buffer.appendText((*it).second.c_str(), (*it).second.size());
|
||||
return;
|
||||
}
|
||||
|
||||
std::string name(getCollectionName(cid));
|
||||
buffer.appendText(name.c_str(), name.size());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a cluster-wide collection name for a cluster-wide
|
||||
/// collection id
|
||||
|
@ -335,37 +310,6 @@ class CollectionNameResolver {
|
|||
return strlen("_unknown");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief look up a cluster-wide collection name for a cluster-wide
|
||||
/// collection id
|
||||
/// TODO: remove this
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void getCollectionNameCluster(TRI_voc_cid_t cid,
|
||||
arangodb::basics::StringBuffer& buffer) const {
|
||||
if (!ServerState::instance()->isRunningInCluster()) {
|
||||
return getCollectionName(cid, buffer);
|
||||
}
|
||||
|
||||
int tries = 0;
|
||||
|
||||
while (tries++ < 2) {
|
||||
std::shared_ptr<CollectionInfo> ci =
|
||||
ClusterInfo::instance()->getCollection(
|
||||
_vocbase->_name, arangodb::basics::StringUtils::itoa(cid));
|
||||
std::string name = ci->name();
|
||||
|
||||
if (name.empty()) {
|
||||
ClusterInfo::instance()->flush();
|
||||
continue;
|
||||
}
|
||||
buffer.appendText(name);
|
||||
return;
|
||||
}
|
||||
|
||||
buffer.appendText("_unknown");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return collection name if given string is either the name or
|
||||
/// a string with the (numerical) collection id, this returns the cluster
|
||||
|
@ -382,6 +326,7 @@ class CollectionNameResolver {
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief vocbase base pointer
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -343,7 +343,8 @@ static void ExistsVocbaseVPack(
|
|||
std::string collectionName;
|
||||
|
||||
int res;
|
||||
{ VPackObjectBuilder guard(&builder);
|
||||
{
|
||||
VPackObjectBuilder guard(&builder);
|
||||
res = ParseDocumentOrDocumentHandle(
|
||||
isolate, vocbase, transactionContext->getResolver(), col,
|
||||
collectionName, builder, true, args[0]);
|
||||
|
@ -511,7 +512,8 @@ static void DocumentVocbase(
|
|||
VPackBuilder builder;
|
||||
std::string collectionName;
|
||||
|
||||
{ VPackObjectBuilder guard(&builder);
|
||||
{
|
||||
VPackObjectBuilder guard(&builder);
|
||||
int res = ParseDocumentOrDocumentHandle(
|
||||
isolate, vocbase, transactionContext->getResolver(), col,
|
||||
collectionName, builder, true, args[0]);
|
||||
|
@ -744,7 +746,8 @@ static void RemoveVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
VPackBuilder builder;
|
||||
std::string collectionName;
|
||||
|
||||
{ VPackObjectBuilder guard(&builder);
|
||||
{
|
||||
VPackObjectBuilder guard(&builder);
|
||||
int res = ParseDocumentOrDocumentHandle(
|
||||
isolate, vocbase, transactionContext->getResolver(), col, collectionName, builder,
|
||||
!options.ignoreRevs, args[0]);
|
||||
|
|
|
@ -3353,50 +3353,6 @@ static void JS_ListEndpoints(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief parse vertex handle from a v8 value (string | object)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_ParseVertex(v8::FunctionCallbackInfo<v8::Value> const& args,
|
||||
CollectionNameResolver const* resolver, TRI_voc_cid_t& cid,
|
||||
std::unique_ptr<char[]>& key,
|
||||
v8::Handle<v8::Value> const val) {
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
TRI_ASSERT(key.get() == nullptr);
|
||||
|
||||
// reset everything
|
||||
std::string collectionName;
|
||||
TRI_voc_rid_t rid = 0;
|
||||
|
||||
// try to extract the collection name, key, and revision from the object
|
||||
// passed
|
||||
if (!ExtractDocumentHandle(isolate, val, collectionName, key, rid)) {
|
||||
return TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD;
|
||||
}
|
||||
|
||||
// we have at least a key, we also might have a collection name
|
||||
TRI_ASSERT(key.get() != nullptr);
|
||||
|
||||
if (collectionName.empty()) {
|
||||
// we do not know the collection
|
||||
return TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD;
|
||||
}
|
||||
|
||||
if (ServerState::instance()->isDBServer()) {
|
||||
cid = resolver->getCollectionIdCluster(collectionName);
|
||||
} else {
|
||||
cid = resolver->getCollectionIdLocal(collectionName);
|
||||
}
|
||||
|
||||
if (cid == 0) {
|
||||
return TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND;
|
||||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the private WRP_VOCBASE_COL_TYPE value
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -41,14 +41,6 @@ class CollectionNameResolver;
|
|||
class JSLoader;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief parse vertex handle from a v8 value (string | object)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_ParseVertex(v8::FunctionCallbackInfo<v8::Value> const& args,
|
||||
arangodb::CollectionNameResolver const*, TRI_voc_cid_t&,
|
||||
std::unique_ptr<char[]>&, v8::Handle<v8::Value> const);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return the private WRP_VOCBASE_COL_TYPE value
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue