1 /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 // vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: 3 #ident "$Id$" 4 /*====== 5 This file is part of PerconaFT. 6 7 8 Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. 9 10 PerconaFT is free software: you can redistribute it and/or modify 11 it under the terms of the GNU General Public License, version 2, 12 as published by the Free Software Foundation. 13 14 PerconaFT is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. 21 22 ---------------------------------------- 23 24 PerconaFT is free software: you can redistribute it and/or modify 25 it under the terms of the GNU Affero General Public License, version 3, 26 as published by the Free Software Foundation. 27 28 PerconaFT is distributed in the hope that it will be useful, 29 but WITHOUT ANY WARRANTY; without even the implied warranty of 30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 GNU Affero General Public License for more details. 32 33 You should have received a copy of the GNU Affero General Public License 34 along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. 35 36 ---------------------------------------- 37 38 Licensed under the Apache License, Version 2.0 (the "License"); 39 you may not use this file except in compliance with the License. 40 You may obtain a copy of the License at 41 42 http://www.apache.org/licenses/LICENSE-2.0 43 44 Unless required by applicable law or agreed to in writing, software 45 distributed under the License is distributed on an "AS IS" BASIS, 46 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 47 See the License for the specific language governing permissions and 48 limitations under the License. 49 ======= */ 50 51 #ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." 52 53 #pragma once 54 55 #include "ft/txn/txn.h" 56 57 #include "util/omt.h" 58 59 namespace toku { 60 61 class txnid_set { 62 public: 63 // effect: Creates an empty set. Does not malloc space for 64 // any entries yet. That is done lazily on add(). 65 void create(void); 66 67 // effect: Destroy the set's internals. 68 void destroy(void); 69 70 // returns: True if the given txnid is a member of the set. 71 bool contains(TXNID id) const; 72 73 // effect: Adds a given txnid to the set if it did not exist 74 void add(TXNID txnid); 75 76 // effect: Deletes a txnid from the set if it exists. 77 void remove(TXNID txnid); 78 79 // returns: Size of the set 80 size_t size(void) const; 81 82 // returns: The "i'th" id in the set, as if it were sorted. 83 TXNID get(size_t i) const; 84 85 private: 86 toku::omt<TXNID> m_txnids; 87 88 friend class txnid_set_unit_test; 89 }; 90 ENSURE_POD(txnid_set); 91 92 } /* namespace toku */ 93