Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,25 @@ if(WITH_EXAMPLES)
add_subdirectory(examples)
endif()

option(WITH_CLOUD_EXAMPLES "build with cloud examples" OFF)
if(WITH_CLOUD_EXAMPLES)
set(EXAMPLES
cloud/examples/clone_example.cc
cloud/examples/cloud_dump.cc
cloud/examples/cloud_durable_example.cc
)
foreach(sourcefile ${EXAMPLES})
message(${sourcefile})
get_filename_component(exename ${sourcefile} NAME_WE)
add_executable(${exename}${ARTIFACT_SUFFIX} ${sourcefile})
target_link_libraries(${exename}${ARTIFACT_SUFFIX}
PRIVATE
${ROCKSDB_LIB}
${THIRDPARTY_LIBS}
)
endforeach()
endif()

option(WITH_BENCHMARK "build benchmark tests" OFF)
if(WITH_BENCHMARK)
add_subdirectory(${PROJECT_SOURCE_DIR}/microbench/)
Expand Down
9 changes: 7 additions & 2 deletions cloud/examples/clone_example.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2017-present, Rockset, Inc. All rights reserved.
#include <aws/core/Aws.h>

#include <cstdio>
#include <iostream>
#include <string>
Expand Down Expand Up @@ -43,7 +45,7 @@ Status CloneDB(const std::string& clone_name, const std::string& src_bucket,

// Create new AWS env
CloudFileSystem* cfs;
Status st = CloudFileSystem::NewAwsFileSystem(
Status st = CloudFileSystemEnv::NewAwsFileSystem(
FileSystem::Default(), src_bucket, src_object_path, kRegion, dest_bucket,
dest_object_path, kRegion, cloud_fs_options, nullptr, &cfs);
if (!st.ok()) {
Expand Down Expand Up @@ -79,6 +81,8 @@ Status CloneDB(const std::string& clone_name, const std::string& src_bucket,
}

int main() {
Aws::InitAPI(Aws::SDKOptions());

// cloud environment config options here
CloudFileSystemOptions cloud_fs_options;

Expand Down Expand Up @@ -108,7 +112,7 @@ int main() {

// Create a new AWS cloud env Status
CloudFileSystem* cfs;
Status s = CloudFileSystem::NewAwsFileSystem(
Status s = CloudFileSystemEnv::NewAwsFileSystem(
FileSystem::Default(), kBucketSuffix, kDBPath, kRegion, kBucketSuffix,
kDBPath, kRegion, cloud_fs_options, nullptr, &cfs);
if (!s.ok()) {
Expand Down Expand Up @@ -185,5 +189,6 @@ int main() {

fprintf(stdout, "Successfully used db at %s and clone at %s in bucket %s.\n",
kDBPath.c_str(), kClonePath.c_str(), bucketName.c_str());
Aws::ShutdownAPI(Aws::SDKOptions());
return 0;
}
7 changes: 6 additions & 1 deletion cloud/examples/cloud_dump.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2017-present, Rockset, Inc. All rights reserved.
#include <aws/core/Aws.h>

#include <cstdio>
#include <iostream>
#include <string>
Expand All @@ -20,6 +22,8 @@ std::string kBucketSuffix = "cloud.durable.example.";
std::string kRegion = "us-west-2";

int main() {
Aws::InitAPI(Aws::SDKOptions());

// cloud environment config options here
CloudFileSystemOptions cloud_fs_options;

Expand Down Expand Up @@ -53,7 +57,7 @@ int main() {

// Create a new AWS cloud env Status
CloudFileSystem* cfs;
Status s = CloudFileSystem::NewAwsFileSystem(
Status s = CloudFileSystemEnv::NewAwsFileSystem(
FileSystem::Default(), kBucketSuffix, kDBPath, kRegion, kBucketSuffix,
kDBPath, kRegion, cloud_fs_options, nullptr, &cfs);
if (!s.ok()) {
Expand Down Expand Up @@ -102,5 +106,6 @@ int main() {

fprintf(stdout, "Successfully read db at path %s in bucket %s.\n",
kDBPath.c_str(), bucketName.c_str());
Aws::ShutdownAPI(Aws::SDKOptions());
return 0;
}
7 changes: 6 additions & 1 deletion cloud/examples/cloud_durable_example.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Copyright (c) 2017-present, Rockset, Inc. All rights reserved.
#include <aws/core/Aws.h>

#include <cstdio>
#include <iostream>
#include <string>
Expand All @@ -23,6 +25,8 @@ static const bool flushAtEnd = true;
static const bool disableWAL = false;

int main() {
Aws::InitAPI(Aws::SDKOptions());

// cloud environment config options here
CloudFileSystemOptions cloud_fs_options;

Expand Down Expand Up @@ -56,7 +60,7 @@ int main() {

// Create a new AWS cloud env Status
CloudFileSystem* cfs;
Status s = CloudFileSystem::NewAwsFileSystem(
Status s = CloudFileSystemEnv::NewAwsFileSystem(
FileSystem::Default(), kBucketSuffix, kDBPath, kRegion, kBucketSuffix,
kDBPath, kRegion, cloud_fs_options, nullptr, &cfs);
if (!s.ok()) {
Expand Down Expand Up @@ -128,5 +132,6 @@ int main() {

fprintf(stdout, "Successfully used db at path %s in bucket %s.\n",
kDBPath.c_str(), bucketName.c_str());
Aws::ShutdownAPI(Aws::SDKOptions());
return 0;
}