You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2017/08/11 21:49:50 UTC

[2/2] kudu git commit: log block manager: Reorder class declaration of LogWritableBlock

log block manager: Reorder class declaration of LogWritableBlock

Reordered class declaration of LogWritableBlock to avoid the
intermingling of LogBlockContainer and LogWritableBlock definitions
in future when adding new methods.

Change-Id: I0a5192cccac1931fd1f65b11fa0739090e8368e2
Reviewed-on: http://gerrit.cloudera.org:8080/7595
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/ce6ecc5a
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/ce6ecc5a
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/ce6ecc5a

Branch: refs/heads/master
Commit: ce6ecc5a51ae2c25b5b47fe9a05b989586cbfd93
Parents: 12084b3
Author: hahao <ha...@cloudera.com>
Authored: Fri Aug 4 16:02:58 2017 -0700
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Fri Aug 11 21:49:17 2017 +0000

----------------------------------------------------------------------
 src/kudu/fs/log_block_manager.cc | 134 +++++++++++++++++-----------------
 1 file changed, 69 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/ce6ecc5a/src/kudu/fs/log_block_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/log_block_manager.cc b/src/kudu/fs/log_block_manager.cc
index 85ded3c..c1bba27 100644
--- a/src/kudu/fs/log_block_manager.cc
+++ b/src/kudu/fs/log_block_manager.cc
@@ -221,6 +221,74 @@ class LogBlock : public RefCountedThreadSafe<LogBlock> {
 };
 
 ////////////////////////////////////////////////////////////
+// LogWritableBlock (declaration)
+////////////////////////////////////////////////////////////
+
+// A log-backed block that has been opened for writing.
+//
+// There's no reference to a LogBlock as this block has yet to be
+// persisted.
+class LogWritableBlock : public WritableBlock {
+ public:
+  enum SyncMode {
+    SYNC,
+    NO_SYNC
+  };
+
+  LogWritableBlock(LogBlockContainer* container, BlockId block_id,
+                   int64_t block_offset);
+
+  virtual ~LogWritableBlock();
+
+  virtual Status Close() OVERRIDE;
+
+  virtual Status Abort() OVERRIDE;
+
+  virtual const BlockId& id() const OVERRIDE;
+
+  virtual BlockManager* block_manager() const OVERRIDE;
+
+  virtual Status Append(const Slice& data) OVERRIDE;
+
+  virtual Status AppendV(const vector<Slice>& data) OVERRIDE;
+
+  virtual Status FlushDataAsync() OVERRIDE;
+
+  virtual size_t BytesAppended() const OVERRIDE;
+
+  virtual State state() const OVERRIDE;
+
+  // Actually close the block, possibly synchronizing its dirty data and
+  // metadata to disk.
+  Status DoClose(SyncMode mode);
+
+  // Write this block's metadata to disk.
+  //
+  // Does not synchronize the written data; that takes place in Close().
+  Status AppendMetadata();
+
+ private:
+  // The owning container. Must outlive the block.
+  LogBlockContainer* container_;
+
+  // The block's identifier.
+  const BlockId block_id_;
+
+  // The block's offset within the container. Known from the moment the
+  // block is created.
+  const int64_t block_offset_;
+
+  // The block's length. Changes with each Append().
+  int64_t block_length_;
+
+  // The state of the block describing where it is in the write lifecycle,
+  // for example, has it been synchronized to disk?
+  WritableBlock::State state_;
+
+  DISALLOW_COPY_AND_ASSIGN(LogWritableBlock);
+};
+
+////////////////////////////////////////////////////////////
 // LogBlockContainer
 ////////////////////////////////////////////////////////////
 
@@ -1079,73 +1147,9 @@ void LogBlock::Delete() {
 }
 
 ////////////////////////////////////////////////////////////
-// LogWritableBlock
+// LogWritableBlock (definition)
 ////////////////////////////////////////////////////////////
 
-// A log-backed block that has been opened for writing.
-//
-// There's no reference to a LogBlock as this block has yet to be
-// persisted.
-class LogWritableBlock : public WritableBlock {
- public:
-  enum SyncMode {
-    SYNC,
-    NO_SYNC
-  };
-
-  LogWritableBlock(LogBlockContainer* container, BlockId block_id,
-                   int64_t block_offset);
-
-  virtual ~LogWritableBlock();
-
-  virtual Status Close() OVERRIDE;
-
-  virtual Status Abort() OVERRIDE;
-
-  virtual const BlockId& id() const OVERRIDE;
-
-  virtual BlockManager* block_manager() const OVERRIDE;
-
-  virtual Status Append(const Slice& data) OVERRIDE;
-
-  virtual Status AppendV(const vector<Slice>& data) OVERRIDE;
-
-  virtual Status FlushDataAsync() OVERRIDE;
-
-  virtual size_t BytesAppended() const OVERRIDE;
-
-  virtual State state() const OVERRIDE;
-
-  // Actually close the block, possibly synchronizing its dirty data and
-  // metadata to disk.
-  Status DoClose(SyncMode mode);
-
-  // Write this block's metadata to disk.
-  //
-  // Does not synchronize the written data; that takes place in Close().
-  Status AppendMetadata();
-
- private:
-  // The owning container. Must outlive the block.
-  LogBlockContainer* container_;
-
-  // The block's identifier.
-  const BlockId block_id_;
-
-  // The block's offset within the container. Known from the moment the
-  // block is created.
-  const int64_t block_offset_;
-
-  // The block's length. Changes with each Append().
-  int64_t block_length_;
-
-  // The state of the block describing where it is in the write lifecycle,
-  // for example, has it been synchronized to disk?
-  WritableBlock::State state_;
-
-  DISALLOW_COPY_AND_ASSIGN(LogWritableBlock);
-};
-
 LogWritableBlock::LogWritableBlock(LogBlockContainer* container,
                                    BlockId block_id, int64_t block_offset)
     : container_(container),