This file is indexed.

/usr/include/mongo/db/durop.h is in mongodb-dev 1:2.4.9-1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
// @file durop.h class DurOp and descendants

/**
*    Copyright (C) 2010 10gen Inc.
*
*    This program is free software: you can redistribute it and/or  modify
*    it under the terms of the GNU Affero General Public License, version 3,
*    as published by the Free Software Foundation.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU Affero General Public License for more details.
*
*    You should have received a copy of the GNU Affero General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "dur_journalformat.h"
#include "../util/bufreader.h"
#include "../util/paths.h"

namespace mongo {

    class AlignedBuilder;

    namespace dur {

        /** DurOp - Operations we journal that aren't just basic writes.
         *
         *  Basic writes are logged as JEntry's, and indicated in ram temporarily as struct dur::WriteIntent.
         *  We don't make WriteIntent inherit from DurOp to keep it as lean as possible as there will be millions of
         *  them (we don't want a vtable for example there).
         *
         *  For each op we want to journal, we define a subclass.
         */
        class DurOp { /* copyable */
        public:
            // @param opcode a sentinel value near max unsigned which uniquely identifies the operation.
            // @see dur::JEntry
            DurOp(unsigned opcode) : _opcode(opcode) { }

            virtual ~DurOp() { }

            /** serialize the op out to a builder which will then be written (presumably) to the journal */
            void serialize(AlignedBuilder& ab);

            /** read a durop from journal file referenced by br.
                @param opcode the opcode which has already been written from the bufreader
            */
            static shared_ptr<DurOp> read(unsigned opcode, BufReader& br);

            /** replay the operation (during recovery)
                throws

                For now, these are not replayed during the normal WRITETODATAFILES phase, since these
                operations are handled in other parts of the code. At some point this may change.
            */
            virtual void replay() = 0;

            virtual string toString() = 0;

            /** if the op requires all file to be closed before doing its work, returns true. */
            virtual bool needFilesClosed() { return false; }

        protected:
            /** DurOp will have already written the opcode for you */
            virtual void _serialize(AlignedBuilder& ab) = 0;

        private:
            const unsigned _opcode;
        };

        /** indicates creation of a new file */
        class FileCreatedOp : public DurOp {
        public:
            FileCreatedOp(BufReader& log);
            /** param f filename to create with path */
            FileCreatedOp(const std::string& f, unsigned long long l);
            virtual void replay();
            virtual string toString();
            virtual bool needFilesClosed();
        protected:
            virtual void _serialize(AlignedBuilder& ab);
        private:
            RelativePath _p;
            unsigned long long _len; // size of file, not length of name
        };

        /** record drop of a database */
        class DropDbOp : public DurOp {
        public:
            DropDbOp(BufReader& log);
            DropDbOp(const std::string& db) :
                DurOp(JEntry::OpCode_DropDb), _db(db) { }
            virtual void replay();
            virtual string toString() { return string("DropDbOp ") + _db; }
            virtual bool needFilesClosed() { return true; }
        protected:
            virtual void _serialize(AlignedBuilder& ab);
        private:
            string _db;
        };

    }

}