| 1881 | } |
| 1882 | |
| 1883 | Future<Optional<Value>> readValue(KeyRef key, IKeyValueStore::ReadType type, Optional<UID> debugID) override { |
| 1884 | if (!shouldThrottle(type, key)) { |
| 1885 | auto a = new Reader::ReadValueAction(key, debugID); |
| 1886 | auto res = a->result.getFuture(); |
| 1887 | readThreads->post(a); |
| 1888 | return res; |
| 1889 | } |
| 1890 | |
| 1891 | auto& semaphore = (type == IKeyValueStore::ReadType::FETCH) ? fetchSemaphore : readSemaphore; |
| 1892 | int maxWaiters = (type == IKeyValueStore::ReadType::FETCH) ? numFetchWaiters : numReadWaiters; |
| 1893 | |
| 1894 | checkWaiters(semaphore, maxWaiters); |
| 1895 | auto a = std::make_unique<Reader::ReadValueAction>(key, debugID); |
| 1896 | return read(a.release(), &semaphore, readThreads.getPtr(), &counters.failedToAcquire); |
| 1897 | } |
| 1898 | |
| 1899 | Future<Optional<Value>> readValuePrefix(KeyRef key, |
| 1900 | int maxLength, |