class PendingChange
Defined at line 67 of file ../../src/storage/minfs/allocator/allocator.h
PendingChange tracks pending allocations and will prevent elements from being allocated twice.
After a change has been committed (passed to a transaction), deallocated elements can still be
reserved until the transaction actually writes the transaction to the journal. This is because we
want to prevent data writes going to those blocks until after that.
There can be multiple PendingChange objects per transaction, but, at time of writing, there is
only one PendingChange for allocations and one PendingChange for deallocations for each allocator
we support (blocks and inodes), so that's 4 per transaction in total.
This class is not thread-safe and should only be accessed by Allocator, under its lock.
Public Methods
void ~PendingChange ()
Defined at line 24 of file ../../src/storage/minfs/allocator/allocator_common.cc
size_t GetReservedCount ()
Returns the number of items that need to be reserved for this change. Reserved is where the
bitmap indicates the items are free, but they can't be used for some reason.
Defined at line 26 of file ../../src/storage/minfs/allocator/allocator_common.cc
size_t GetNextUnreserved (size_t start)
Returns the next unreserved item starting from |start|.
Defined at line 36 of file ../../src/storage/minfs/allocator/allocator_common.cc
void PendingChange (const PendingChange & )
Not copyable or movable.
Defined at line 74 of file ../../src/storage/minfs/allocator/allocator.h
PendingChange & operator= (const PendingChange & )
Defined at line 75 of file ../../src/storage/minfs/allocator/allocator.h
Kind kind ()
Defined at line 77 of file ../../src/storage/minfs/allocator/allocator.h
bool is_committed ()
The change is committed when the change has been made to the persistent bitmap.
Defined at line 80 of file ../../src/storage/minfs/allocator/allocator.h
void set_committed (bool v)
Defined at line 81 of file ../../src/storage/minfs/allocator/allocator.h
size_t item_count ()
Returns the number of items this change covers.
Defined at line 91 of file ../../src/storage/minfs/allocator/allocator.h
bitmap::RleBitmap & bitmap ()
Access to the underlying bitmap.
Defined at line 94 of file ../../src/storage/minfs/allocator/allocator.h
Protected Methods
void PendingChange (Allocator * allocator, Kind kind)
Defined at line 19 of file ../../src/storage/minfs/allocator/allocator_common.cc
Enumerations
enum Kind
| Name | Value |
|---|---|
| kAllocation | 0 |
| kDeallocation | 1 |
Defined at line 69 of file ../../src/storage/minfs/allocator/allocator.h