forked from vesoft-inc/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServerBasedSchemaManager.h
57 lines (40 loc) · 1.9 KB
/
ServerBasedSchemaManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Copyright (c) 2018 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_SERVERBASEDSCHEMAMANAGER_H_
#define META_SERVERBASEDSCHEMAMANAGER_H_
#include "base/Base.h"
#include <folly/RWSpinLock.h>
#include "meta/client/MetaClient.h"
#include "meta/SchemaManager.h"
namespace nebula {
namespace meta {
class ServerBasedSchemaManager : public SchemaManager {
public:
ServerBasedSchemaManager() = default;
~ServerBasedSchemaManager();
// return the newest one if ver less 0
std::shared_ptr<const SchemaProviderIf>
getTagSchema(GraphSpaceID space, TagID tag, SchemaVer ver = -1) override;
// Returns a negative number when the schema does not exist
StatusOr<SchemaVer> getLatestTagSchemaVersion(GraphSpaceID space, TagID tag) override;
// return the newest one if ver less 0
std::shared_ptr<const SchemaProviderIf>
getEdgeSchema(GraphSpaceID space, EdgeType edge, SchemaVer ver = -1) override;
// Returns a negative number when the schema does not exist
StatusOr<SchemaVer> getLatestEdgeSchemaVersion(GraphSpaceID space, EdgeType edge) override;
StatusOr<GraphSpaceID> toGraphSpaceID(folly::StringPiece spaceName) override;
StatusOr<TagID> toTagID(GraphSpaceID space, folly::StringPiece tagName) override;
StatusOr<std::string> toTagName(GraphSpaceID space, TagID tagId) override;
StatusOr<EdgeType> toEdgeType(GraphSpaceID space, folly::StringPiece typeName) override;
StatusOr<std::string> toEdgeName(GraphSpaceID space, EdgeType edgeType) override;
StatusOr<std::vector<std::string>> getAllEdge(GraphSpaceID space) override;
void init(MetaClient *client) override;
private:
MetaClient *metaClient_{nullptr};
};
} // namespace meta
} // namespace nebula
#endif // META_SERVERBASEDSCHEMAMANAGER_H_