-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
heng
committed
Jun 28, 2019
1 parent
34eb36d
commit 2a441c5
Showing
23 changed files
with
1,986 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#ifndef META_PROCESSORS_COMMON_H_ | ||
#define META_PROCESSORS_COMMON_H_ | ||
|
||
#include "base/Base.h" | ||
|
||
namespace nebula { | ||
namespace meta { | ||
|
||
static const PartitionID kDefaultPartId = 0; | ||
static const GraphSpaceID kDefaultSpaceId = 0; | ||
|
||
using BalanceID = int64_t; | ||
|
||
class LockUtils { | ||
public: | ||
LockUtils() = delete; | ||
#define GENERATE_LOCK(Entry) \ | ||
static folly::SharedMutex& Entry##Lock() { \ | ||
static folly::SharedMutex l; \ | ||
return l; \ | ||
} | ||
|
||
GENERATE_LOCK(space); | ||
GENERATE_LOCK(id); | ||
GENERATE_LOCK(tag); | ||
GENERATE_LOCK(edge); | ||
GENERATE_LOCK(user); | ||
|
||
#undef GENERATE_LOCK | ||
}; | ||
|
||
|
||
} // namespace meta | ||
} // namespace nebula | ||
#endif // META_PROCESSORS_COMMON_H_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* Copyright (c) 2019 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License, | ||
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
#include "meta/processors/admin/AdminClient.h" | ||
|
||
namespace nebula { | ||
namespace meta { | ||
|
||
folly::Future<Status> AdminClient::transLeader(GraphSpaceID spaceId, | ||
PartitionID partId, | ||
const HostAddr& leader, | ||
const HostAddr& dst) { | ||
UNUSED(spaceId); | ||
UNUSED(partId); | ||
UNUSED(leader); | ||
UNUSED(dst); | ||
if (injector_) { | ||
return injector_->transLeader(); | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
folly::Future<Status> AdminClient::addPart(GraphSpaceID spaceId, | ||
PartitionID partId, | ||
const HostAddr& host, | ||
bool asLearner) { | ||
UNUSED(spaceId); | ||
UNUSED(partId); | ||
UNUSED(host); | ||
UNUSED(asLearner); | ||
if (injector_) { | ||
return injector_->addPart(); | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
folly::Future<Status> AdminClient::addLearner(GraphSpaceID spaceId, PartitionID partId) { | ||
UNUSED(spaceId); | ||
UNUSED(partId); | ||
if (injector_) { | ||
return injector_->addLearner(); | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
folly::Future<Status> AdminClient::waitingForCatchUpData(GraphSpaceID spaceId, | ||
PartitionID partId) { | ||
UNUSED(spaceId); | ||
UNUSED(partId); | ||
if (injector_) { | ||
return injector_->waitingForCatchUpData(); | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
folly::Future<Status> AdminClient::memberChange(GraphSpaceID spaceId, PartitionID partId) { | ||
UNUSED(spaceId); | ||
UNUSED(partId); | ||
if (injector_) { | ||
return injector_->memberChange(); | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
folly::Future<Status> AdminClient::updateMeta(GraphSpaceID spaceId, | ||
PartitionID partId, | ||
const HostAddr& leader, | ||
const HostAddr& dst) { | ||
UNUSED(spaceId); | ||
UNUSED(partId); | ||
UNUSED(leader); | ||
UNUSED(dst); | ||
if (injector_) { | ||
return injector_->updateMeta(); | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
folly::Future<Status> AdminClient::removePart(GraphSpaceID spaceId, | ||
PartitionID partId, | ||
const HostAddr& host) { | ||
UNUSED(spaceId); | ||
UNUSED(partId); | ||
UNUSED(host); | ||
if (injector_) { | ||
return injector_->removePart(); | ||
} | ||
return Status::OK(); | ||
} | ||
|
||
} // namespace meta | ||
} // namespace nebula | ||
|
Oops, something went wrong.