Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support aws cpp sdk #2

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## What type of PR is this:
- [ ] bug
- [ ] feature
- [ ] enhancement
- [ ] others

## Which issues of this PR fixes :
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

## Problem Summary(Required) :
<!-- (Please describe the changes you have made. In which scenarios will this bug be triggered and what measures have you taken to fix the bug?) -->
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Contributing to StarRocks

## Contributing to StarRocks
Welcome to StarRocks! To learn more about contributing to the StarRocks code repo, check out the [Contributor's Guide](https://github.com/StarRocks/community/tree/main/Contributors/guide).

The [StarRocks Community](https://github.com/StarRocks/community) repo contains information about how to get started, how the community organizes, and more.
Welcome to StarRocks community! To learn more about contributing to the StarRocks, check out the [Contributor's Guide](https://github.com/StarRocks/community/tree/main/Contributors/guide).

## Code of Conduct
The code of conduct is described in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)
Expand Down
17 changes: 17 additions & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ if (WITH_HDFS)
set_target_properties(hdfs PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_DIR}/lib/libhdfs.a)
endif()

if (WITH_AWS)
set(AWSSDK_ROOT_DIR ${THIRDPARTY_DIR})
find_package(AWSSDK REQUIRED COMPONENTS core s3 transfer)
include_directories(${AWSSDK_INCLUDE_DIRS})
endif()

add_library(libevent STATIC IMPORTED)
set_target_properties(libevent PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_DIR}/lib/libevent.a)

Expand Down Expand Up @@ -323,6 +329,10 @@ if (WITH_HDFS)
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DSTARROCKS_WITH_HDFS")
endif()

if (WITH_AWS)
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DSTARROCKS_WITH_AWS")
endif()

if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -faligned-new")
endif()
Expand Down Expand Up @@ -461,6 +471,13 @@ if (WITH_HDFS)
include_directories(${JAVA_HOME}/include/linux)
endif()

if (WITH_AWS)
set(STARROCKS_DEPENDENCIES ${STARROCKS_DEPENDENCIES}
${AWSSDK_LINK_LIBRARIES}
${AWSSDK_PLATFORM_DEPS}
)
endif()

# Set thirdparty libraries
set(STARROCKS_DEPENDENCIES
${STARROCKS_DEPENDENCIES}
Expand Down
6 changes: 6 additions & 0 deletions be/src/env/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ if (WITH_HDFS)
)
endif()

if (WITH_AWS)
set(EXEC_FILES ${EXEC_FILES}
s3_client.cpp
)
endif()

add_library(Env STATIC
${EXEC_FILES}
)
53 changes: 53 additions & 0 deletions be/src/env/cloud_storage_client.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// This file is licensed under the Elastic License 2.0. Copyright 2021 StarRocks Limited.

#pragma once

#include <string>

#include "common/status.h"

namespace starrocks {

// base class for cloud storage client
class CloudStorageClient {
public:
CloudStorageClient() = default;
virtual ~CloudStorageClient() = default;

/*
* Bucket Operation
*/
virtual Status create_bucket(const std::string& bucket_name) = 0;

virtual Status delete_bucket(const std::string& bucket_name) = 0;

/*
* Object Operation
*/
virtual Status put_object(const std::string& bucket_name, const std::string& object_key,
const std::string& object_path) = 0;

virtual Status put_string_object(const std::string& bucket_name, const std::string& object_key,
const std::string& object_value) = 0;

virtual Status get_object(const std::string& bucket_name, const std::string& object_key,
const std::string& object_path) = 0;

virtual Status get_object_range(const std::string& bucket_name, const std::string& object_key,
std::string* object_value, size_t offset, size_t length, size_t* read_bytes) = 0;

// `object_value` should already be allocated at least `length` bytes
virtual Status get_object_range(const std::string& bucket_name, const std::string& object_key,
char* object_value, size_t offset, size_t length, size_t* read_bytes) = 0;

virtual Status exist_object(const std::string& bucket_name, const std::string& object_key) = 0;

virtual Status get_object_size(const std::string& bucket_name, const std::string& object_key, size_t* size) = 0;

virtual Status delete_object(const std::string& bucket_name, const std::string& object_key) = 0;

virtual Status list_objects(const std::string& bucket_name, const std::string& object_prefix,
std::vector<std::string>* result) = 0;
};

} // namespace starrocks
Loading