• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef RELATIONAL_DB_SYNC_INTERFACE_H
16 #define RELATIONAL_DB_SYNC_INTERFACE_H
17 #ifdef RELATIONAL_STORE
18 
19 #include "query_sync_object.h"
20 #include "relational_schema_object.h"
21 #include "single_ver_kv_entry.h"
22 #include "sync_generic_interface.h"
23 #include "schema_negotiate.h"
24 
25 namespace DistributedDB {
26 class RelationalDBSyncInterface : public SyncGenericInterface {
27 public:
~RelationalDBSyncInterface()28     ~RelationalDBSyncInterface() override {};
29 
30     virtual RelationalSchemaObject GetSchemaInfo() const = 0;
31 
32     // Get batch meta data associated with the given key.
33     virtual int GetBatchMetaData(const std::vector<Key> &keys, std::vector<Entry> &entries) const = 0;
34     // Put batch meta data as a key-value entry vector
35     virtual int PutBatchMetaData(std::vector<Entry> &entries) = 0;
36 
37     virtual std::vector<QuerySyncObject> GetTablesQuery() = 0;
38 
39     virtual int LocalDataChanged(int notifyEvent, std::vector<QuerySyncObject> &queryObj) = 0;
40 
41     virtual int CreateDistributedDeviceTable(const std::string &device, const RelationalSyncStrategy &syncStrategy) = 0;
42 
43     virtual int RegisterSchemaChangedCallback(const std::function<void()> &callback) = 0;
44 };
45 }
46 #endif // RELATIONAL_STORE
47 #endif