Skip to content

Commit 2c28dea

Browse files
committed
v4.x - Remove folly::Expected from API.
1 parent 69f0fb4 commit 2c28dea

24 files changed

+248
-286
lines changed

.github/workflows/build_dependencies.yml

Lines changed: 7 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -164,89 +164,36 @@ jobs:
164164
conan export --user oss --channel main import/nuraft_mesg
165165
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}
166166

167-
- name: Build Cache
167+
- name: Create and Test Package
168168
run: |
169+
sanitize=$([[ "${{ inputs.tooling }}" == "Sanitize" ]] && echo "True" || echo "False")
169170
pre=$([[ "${{ inputs.build-type }}" != "Debug" ]] && echo "-o iomgr/*:prerelease=${{ inputs.prerelease }}" || echo "")
170171
echo "Disk space usage"
171172
sudo df -h
172173
sudo ls -l /tmp
173174
sudo rm -rf $ANDROID_HOME
174175
echo "Disk space usage after cleanup"
175176
sudo df -h
176-
conan install \
177-
-c tools.build:skip_test=True \
177+
conan build \
178178
${pre} \
179179
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
180180
-o iomgr/*:testing=off \
181181
-o homestore/*:testing=off \
182+
-o homeobject/*:sanitize=${sanitize} \
182183
-s:h build_type=${{ inputs.build-type }} \
183-
-c tools.build:skip_test=True \
184+
-s:h compiler.cppstd=23 \
184185
--format=json \
185186
--build missing \
186187
. > ~/build.json
187188
conan list --graph ~/build.json --graph-binaries=build --format=json > ~/pkglist.json
188-
if: ${{ steps.restore-cache.outputs.cache-hit != 'true' }}
189+
if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }}
189190

190191
- name: Save Conan Cache
191192
uses: eBay/sisl/.github/actions/store_conan2@master
192193
with:
193194
key_prefix: HomeObjectDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.prerelease }}
194195
if: ${{ github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}
195196

196-
- name: Reload Sisl Cache
197-
uses: eBay/sisl/.github/actions/load_conan2@master
198-
with:
199-
load_any: 'True'
200-
key_prefix: SislDeps13-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
201-
if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}
202-
203-
- name: Reload IOMgr Cache
204-
uses: eBay/sisl/.github/actions/load_conan2@master
205-
with:
206-
load_any: 'True'
207-
key_prefix: IOMgrDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.prerelease }}
208-
if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}
209-
210-
- name: Reload NuRaftMesg Cache
211-
uses: eBay/sisl/.github/actions/load_conan2@master
212-
with:
213-
testing: 'False'
214-
path: import/nuraft_mesg
215-
key_prefix: NuMesgDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
216-
fail_on_cache_miss: true
217-
if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}
218-
219-
- name: Reload HomeStore Cache
220-
uses: eBay/sisl/.github/actions/load_conan2@master
221-
with:
222-
testing: 'False'
223-
path: import/homestore
224-
key_prefix: HomestoreDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.prerelease }}
225-
fail_on_cache_miss: true
226-
if: ${{ inputs.testing == 'True' && github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' }}
227-
228-
- name: Setup tmate session
229-
uses: mxschmitt/action-tmate@v3
230-
with:
231-
limit-access-to-actor: true
232-
detached: true
233-
if: ${{ inputs.testing == 'True' }}
234-
235-
- name: Create and Test Package
236-
run: |
237-
sanitize=$([[ "${{ inputs.tooling }}" == "Sanitize" ]] && echo "True" || echo "False")
238-
pre=$([[ "${{ inputs.build-type }}" != "Debug" ]] && echo "-o iomgr/*:prerelease=${{ inputs.prerelease }}" || echo "")
239-
conan create \
240-
${pre} \
241-
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
242-
-o iomgr/*:testing=off \
243-
-o homestore/*:testing=off \
244-
-o homeobject/*:sanitize=${sanitize} \
245-
-s:h build_type=${{ inputs.build-type }} \
246-
--build missing \
247-
.
248-
if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }}
249-
250197
- name: Code Coverage Run
251198
run: |
252199
pre=$([[ "${{ inputs.build-type }}" != "Debug" ]] && echo "-o iomgr/*:prerelease=${{ inputs.prerelease }}" || echo "")
@@ -257,6 +204,7 @@ jobs:
257204
-o homestore/*:testing=off \
258205
-o homeobject/*:coverage=True \
259206
-s:h build_type=${{ inputs.build-type }} \
207+
-s:h compiler.cppstd=23 \
260208
--build missing \
261209
.
262210
if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }}

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required (VERSION 3.11)
22
project (homeobject LANGUAGES CXX)
33

4-
set(CMAKE_CXX_STANDARD 20)
4+
set(CMAKE_CXX_STANDARD 23)
55

66
if (NOT DEFINED CMAKE_BUILD_TYPE)
77
set (CMAKE_BUILD_TYPE "Debug")

conanfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class HomeObjectConan(ConanFile):
1212
name = "homeobject"
13-
version = "3.0.6"
13+
version = "4.0.0"
1414

1515
homepage = "https://github.com/eBay/HomeObject"
1616
description = "Blob Store built on HomeReplication"
@@ -55,7 +55,7 @@ def requirements(self):
5555

5656
def validate(self):
5757
if self.info.settings.compiler.cppstd:
58-
check_min_cppstd(self, 20)
58+
check_min_cppstd(self, 23)
5959

6060
def layout(self):
6161
self.folders.source = "."

src/include/homeobject/common.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3+
#include <expected>
4+
35
#include <boost/uuid/uuid.hpp>
4-
#include <folly/Expected.h>
5-
#include <folly/Unit.h>
66
#pragma GCC diagnostic push
77
#pragma GCC diagnostic ignored "-Wuninitialized"
88
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
@@ -49,12 +49,12 @@ template < class E >
4949
class Manager {
5050
public:
5151
template < typename T >
52-
using Result = folly::Expected< T, E >;
52+
using Result = std::expected< T, E >;
5353
template < typename T >
5454
using AsyncResult = folly::SemiFuture< Result< T > >;
5555

56-
using NullResult = Result< folly::Unit >;
57-
using NullAsyncResult = AsyncResult< folly::Unit >;
56+
using NullResult = Result< void >;
57+
using NullAsyncResult = AsyncResult< void >;
5858

5959
virtual ~Manager() = default;
6060
};

src/lib/blob_manager.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@ std::shared_ptr< BlobManager > HomeObjectImpl::blob_manager() { return shared_fr
66

77
BlobManager::AsyncResult< Blob > HomeObjectImpl::get(shard_id_t shard, blob_id_t const& blob_id, uint64_t off,
88
uint64_t len, trace_id_t tid) const {
9-
return _get_shard(shard, tid).thenValue(
10-
[this, blob_id, off, len, tid](auto const e) -> BlobManager::AsyncResult< Blob > {
11-
if (!e) return folly::makeUnexpected(BlobError(BlobErrorCode::UNKNOWN_SHARD));
9+
return _get_shard(shard, tid)
10+
.thenValue([this, blob_id, off, len, tid](auto const e) -> BlobManager::AsyncResult< Blob > {
11+
if (!e) return std::unexpected(BlobError(BlobErrorCode::UNKNOWN_SHARD));
1212
return _get_blob(e.value(), blob_id, off, len, tid);
1313
});
1414
}
1515

1616
BlobManager::AsyncResult< blob_id_t > HomeObjectImpl::put(shard_id_t shard, Blob&& blob, trace_id_t tid) {
17-
return _get_shard(shard, tid).thenValue(
18-
[this, blob = std::move(blob), tid](auto const e) mutable -> BlobManager::AsyncResult< blob_id_t > {
19-
if (!e) return folly::makeUnexpected(BlobError(BlobErrorCode::UNKNOWN_SHARD));
20-
if (ShardInfo::State::SEALED == e.value().state) return folly::makeUnexpected(BlobError(BlobErrorCode::SEALED_SHARD));
21-
if (blob.body.size() == 0) return folly::makeUnexpected(BlobError(BlobErrorCode::INVALID_ARG));
17+
return _get_shard(shard, tid)
18+
.thenValue([this, blob = std::move(blob), tid](auto const e) mutable -> BlobManager::AsyncResult< blob_id_t > {
19+
if (!e) return std::unexpected(BlobError(BlobErrorCode::UNKNOWN_SHARD));
20+
if (ShardInfo::State::SEALED == e.value().state)
21+
return std::unexpected(BlobError(BlobErrorCode::SEALED_SHARD));
22+
if (blob.body.size() == 0) return std::unexpected(BlobError(BlobErrorCode::INVALID_ARG));
2223
return _put_blob(e.value(), std::move(blob), tid);
2324
});
2425
}
2526

2627
BlobManager::NullAsyncResult HomeObjectImpl::del(shard_id_t shard, blob_id_t const& blob, trace_id_t tid) {
2728
return _get_shard(shard, tid).thenValue([this, blob, tid](auto const e) mutable -> BlobManager::NullAsyncResult {
28-
if (!e) return folly::makeUnexpected(BlobError(BlobErrorCode::UNKNOWN_SHARD));
29+
if (!e) return std::unexpected(BlobError(BlobErrorCode::UNKNOWN_SHARD));
2930
return _del_blob(e.value(), blob, tid);
3031
});
3132
}

0 commit comments

Comments
 (0)