| Index: storage/common/blob_storage/blob_storage_constants.h
|
| diff --git a/storage/common/blob_storage/blob_storage_constants.h b/storage/common/blob_storage/blob_storage_constants.h
|
| index b94e886f3de7bc9685442035789a2833dac6ed64..a606397eede4a8710ccb224616ae08c4eec55a02 100644
|
| --- a/storage/common/blob_storage/blob_storage_constants.h
|
| +++ b/storage/common/blob_storage/blob_storage_constants.h
|
| @@ -13,29 +13,49 @@
|
|
|
| namespace storage {
|
|
|
| +constexpr size_t kDefaultIPCMemorySize = 250u * 1024;
|
| +constexpr size_t kDefaultSharedMemorySize = 10u * 1024 * 1024;
|
| +constexpr size_t kDefaultMaxBlobInMemorySpace = 500u * 1024 * 1024;
|
| +constexpr uint64_t kDefaultMaxBlobDiskSpace = 0ull;
|
| +constexpr uint64_t kDefaultMinPageFileSize = 5ull * 1024 * 1024;
|
| +constexpr uint64_t kDefaultMaxPageFileSize = 100ull * 1024 * 1024;
|
| +
|
| // All sizes are in bytes.
|
| -struct BlobStorageLimits {
|
| +struct STORAGE_COMMON_EXPORT BlobStorageLimits {
|
| + // Returns if the current configuration is valid.
|
| + bool IsValid() const;
|
| +
|
| size_t memory_limit_before_paging() const {
|
| return max_blob_in_memory_space - min_page_file_size;
|
| }
|
|
|
| + // If disk space goes less than this we stop allocating more disk quota.
|
| + uint64_t min_available_external_disk_space() const {
|
| + return 2ull * memory_limit_before_paging();
|
| + }
|
| +
|
| + bool IsDiskSpaceConstrained() const {
|
| + return desired_max_disk_space != effective_max_disk_space;
|
| + }
|
| +
|
| // This is the maximum amount of memory we can send in an IPC.
|
| - size_t max_ipc_memory_size = 250 * 1024;
|
| + size_t max_ipc_memory_size = kDefaultIPCMemorySize;
|
| // This is the maximum size of a shared memory handle.
|
| - size_t max_shared_memory_size = 10 * 1024 * 1024;
|
| + size_t max_shared_memory_size = kDefaultSharedMemorySize;
|
|
|
| // This is the maximum amount of memory we can use to store blobs.
|
| - size_t max_blob_in_memory_space = 500 * 1024 * 1024;
|
| + size_t max_blob_in_memory_space = kDefaultMaxBlobInMemorySpace;
|
|
|
| // This is the maximum amount of disk space we can use.
|
| - // TODO(dmurph): Determine initial heuristic based on disk usage & arch.
|
| - uint64_t max_blob_disk_space = 0ull;
|
| + uint64_t desired_max_disk_space = kDefaultMaxBlobDiskSpace;
|
| + // This value will change based on the amount of free space on the device.
|
| + uint64_t effective_max_disk_space = kDefaultMaxBlobDiskSpace;
|
|
|
| // This is the minimum file size we can use when paging blob items to disk.
|
| // We combine items until we reach at least this size.
|
| - uint64_t min_page_file_size = 5 * 1024 * 1024;
|
| + uint64_t min_page_file_size = kDefaultMinPageFileSize;
|
| // This is the maximum file size we can create.
|
| - uint64_t max_file_size = 100 * 1024 * 1024;
|
| + uint64_t max_file_size = kDefaultMaxPageFileSize;
|
| };
|
|
|
| enum class IPCBlobItemRequestStrategy {
|
|
|