libfoedus-core
FOEDUS Core Library
log_reducer_ref.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
18 #ifndef FOEDUS_SNAPSHOT_LOG_REDUCER_REF_HPP_
19 #define FOEDUS_SNAPSHOT_LOG_REDUCER_REF_HPP_
20 
21 #include <stdint.h>
22 
23 #include <cstring>
24 #include <iosfwd>
25 #include <string>
26 
27 #include "foedus/cxx11.hpp"
28 #include "foedus/fwd.hpp"
29 #include "foedus/snapshot/fwd.hpp"
30 #include "foedus/storage/fwd.hpp"
32 
33 namespace foedus {
34 namespace snapshot {
35 
41  public:
48  }
49  LogReducerRef(Engine* engine, uint16_t node);
50 
51  uint16_t get_id() const;
52  std::string to_string() const;
53  void clear();
54  uint32_t get_total_storage_count() const;
56  friend std::ostream& operator<<(std::ostream& o, const LogReducerRef& v);
57 
74  void append_log_chunk(
75  storage::StorageId storage_id,
76  const char* send_buffer,
77  uint32_t log_count,
78  uint64_t send_buffer_size,
79  uint32_t shortest_key_length,
80  uint32_t longest_key_length);
81 
82  protected:
83  const Snapshot& get_cur_snapshot() const;
84  uint64_t get_buffer_size() const;
85  uint32_t get_current_buffer_index_atomic() const;
86  void* get_buffer(uint32_t index) const;
88  bool verify_log_chunk(
89  storage::StorageId storage_id,
90  const char* send_buffer,
91  uint32_t log_count,
92  uint64_t send_buffer_size) const;
93 
96  void* buffers_[2];
98 };
99 
100 } // namespace snapshot
101 } // namespace foedus
102 #endif // FOEDUS_SNAPSHOT_LOG_REDUCER_REF_HPP_
Definitions of IDs in this package and a few related constant values.
#define CXX11_NULLPTR
Used in public headers in place of "nullptr" of C++11.
Definition: cxx11.hpp:132
uint32_t StorageId
Unique ID for storage.
Definition: storage_id.hpp:55
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Forward declarations of classes in root package.
Forward declarations of classes in snapshot manager package.
const Snapshot & get_cur_snapshot() const
void append_log_chunk(storage::StorageId storage_id, const char *send_buffer, uint32_t log_count, uint64_t send_buffer_size, uint32_t shortest_key_length, uint32_t longest_key_length)
Append the log entries of one storage in the given buffer to this reducer's buffer.
A remote view of LogReducer from all engines.
Forward declarations of classes in storage package.
uint32_t get_current_buffer_index_atomic() const
LogReducerControlBlock * control_block_
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
friend std::ostream & operator<<(std::ostream &o, const LogReducerRef &v)
Just a marker to denote that the memory region represents a data page.
Definition: page.hpp:334
Represents one snapshot that converts all logs from base epoch to valid_until epoch into snapshot fil...
Definition: snapshot.hpp:37
void * get_buffer(uint32_t index) const
bool verify_log_chunk(storage::StorageId storage_id, const char *send_buffer, uint32_t log_count, uint64_t send_buffer_size) const
used only in debug mode
uint32_t get_total_storage_count() const