2 * Copyright (C) 2017 Cisco Inc.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // @author Changxue Deng <chadeng@cisco.com>
19 #ifndef __DBTraverseBase_H__
20 #define __DBTraverseBase_H__
27 typedef struct _DBTraverseNode
31 size_t node_link_offset;
33 size_t edgestr_offset;
34 size_t edgestr_link_offset;
37 size_t data_link_offset;
42 // An abstract base class for writer to traverse mabain DB
46 DBTraverseBase(const DB &db);
49 // Traverse DB via DFS
50 void TraverseDB(int arg = 0);
53 virtual void DoTask(int arg, DBTraverseNode &dbt_node) = 0;
54 void BufferCopy(size_t offset_dst, uint8_t *ptr_dst,
55 size_t offset_src, const uint8_t *ptr_src,
56 int size, DRMBase *drm);
58 // DBTraverseBase does not own these objects or pointers.
63 FreeList *index_free_lists;
64 FreeList *data_free_lists;
67 // Used for tracking index and data sizes that have been traversed.
72 void GetAlignmentSize(DBTraverseNode &dbt_node) const;
73 void ResizeRWBuffer(int size);