Class: GitDS::StageMemIndex
- Inherits:
-
StageIndex
- Object
- Grit::Index
- Index
- StageIndex
- GitDS::StageMemIndex
- Defined in:
- lib/git-ds/index.rb
Overview
In-memory staging index.
This replaces the StageIndex#build method with a nop, so that the index is not written to disk.
This is primarily useful in transactions or in methods such as Database#batch. Keepin the tree in-memory as long as necessary reduces disk writes and speeds up bulk insert/delete operations.
Instance Attribute Summary
Attributes inherited from StageIndex
Instance Method Summary collapse
-
#build ⇒ Object
Return the sha of the stage index on disk.
-
#force_sync ⇒ Object
Force a sync-to-disk.
-
#sync ⇒ Object
Replace standard sync with a no-op.
Methods inherited from StageIndex
#commit, #initialize, read, #read_tree, #write
Methods inherited from Index
#add, #add_db, #add_fs, #delete, #include?, #local_write_tree, #path_to_object, #write
Constructor Details
This class inherits a constructor from GitDS::StageIndex
Instance Method Details
#build ⇒ Object
Return the sha of the stage index on disk. This DOES NOT synchronize the in-memory index with the on-disk index.
248 249 250 |
# File 'lib/git-ds/index.rb', line 248 def build return @sha end |
#force_sync ⇒ Object
Force a sync-to-disk. This is used by batch mode to ensure a sync.
261 262 263 264 |
# File 'lib/git-ds/index.rb', line 261 def force_sync self.read_tree(self.write) @repo.exec_in_git_dir { `git read-tree #{@sha}` } end |
#sync ⇒ Object
Replace standard sync with a no-op.
255 256 |
# File 'lib/git-ds/index.rb', line 255 def sync end |