OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BufferSeg.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <list>
20 
21 #include "Shared/types.h"
22 
23 namespace Buffer_Namespace {
24 
25 class Buffer; // forward declaration
26 
27 // Memory Pages types in buffer pool
28 enum MemStatus { FREE, USED };
29 
30 struct BufferSeg {
32  size_t num_pages;
36  unsigned int pin_count;
37  int slab_num;
38  unsigned int last_touched;
39 
41  : mem_status(FREE), buffer(0), pin_count(0), slab_num(-1), last_touched(0) {}
42  BufferSeg(const int start_page, const size_t num_pages)
43  : start_page(start_page)
44  , num_pages(num_pages)
45  , mem_status(FREE)
46  , buffer(0)
47  , pin_count(0)
48  , slab_num(-1)
49  , last_touched(0) {}
50  BufferSeg(const int start_page, const size_t num_pages, const MemStatus mem_status)
51  : start_page(start_page)
52  , num_pages(num_pages)
53  , mem_status(mem_status)
54  , buffer(0)
55  , pin_count(0)
56  , slab_num(-1)
57  , last_touched(0) {}
58  BufferSeg(const int start_page,
59  const size_t num_pages,
60  const MemStatus mem_status,
61  const int last_touched)
62  : start_page(start_page)
63  , num_pages(num_pages)
64  , mem_status(mem_status)
65  , buffer(0)
66  , pin_count(0)
67  , slab_num(-1)
68  , last_touched(last_touched) {}
69 };
70 
71 using BufferList = std::list<BufferSeg>;
72 } // namespace Buffer_Namespace
std::vector< int > ChunkKey
Definition: types.h:35
BufferSeg(const int start_page, const size_t num_pages, const MemStatus mem_status)
Definition: BufferSeg.h:50
BufferSeg(const int start_page, const size_t num_pages)
Definition: BufferSeg.h:42
unsigned int last_touched
Definition: BufferSeg.h:38
std::list< BufferSeg > BufferList
Definition: BufferSeg.h:71
Note(s): Forbid Copying Idiom 4.1.
Definition: Buffer.h:42
BufferSeg(const int start_page, const size_t num_pages, const MemStatus mem_status, const int last_touched)
Definition: BufferSeg.h:58