MongoDB  2.7.0
damage_vector.h
1 /* Copyright 2013 10gen Inc.
2  *
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 
16 #pragma once
17 
18 #include <vector>
19 
20 #include "mongo/platform/cstdint.h"
21 
22 namespace mongo {
23 namespace mutablebson {
24 
25  // A damage event represents a change of size 'size' byte at starting at offset
26  // 'target_offset' in some target buffer, with the replacement data being 'size' bytes of
27  // data from the 'source' offset. The base addresses against which these offsets are to be
28  // applied are not captured here.
29  struct DamageEvent {
30  typedef uint32_t OffsetSizeType;
31 
32  // Offset of source data (in some buffer held elsewhere).
33  OffsetSizeType sourceOffset;
34 
35  // Offset of target data (in some buffer held elsewhere).
36  OffsetSizeType targetOffset;
37 
38  // Size of the damage region.
39  size_t size;
40  };
41 
42  typedef std::vector<DamageEvent> DamageVector;
43 
44 } // namespace mutablebson
45 } // namespace mongo
Definition: damage_vector.h:29