Skip to content

Commit 1268fd2

Browse files
laramielcopybara-github
authored andcommitted
Import AWS libraries for future use in S3 driver
This was heavily modified from the original GitHub PR #149 PiperOrigin-RevId: 651917637 Change-Id: I484addac73efc8a633683224f378db565ba230c1
1 parent 44bf357 commit 1268fd2

31 files changed

+1174
-2
lines changed

tensorstore/internal/container/block_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class BlockQueue;
5252

5353
// SQBlock is a buffer used as a backing SimpleDeque.
5454
template <typename T, typename Allocator>
55-
struct SQBlock {
55+
class SQBlock {
5656
private:
5757
using BlockAllocator =
5858
typename std::allocator_traits<Allocator>::template rebind_alloc<SQBlock>;

tensorstore/internal/container/single_producer_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class SingleProducerQueue;
6060
// SPQArray is a circular buffer used as a backing store for
6161
// SingleProducerQueue.
6262
template <typename T, typename Allocator>
63-
struct SPQArray {
63+
class SPQArray {
6464
private:
6565
static_assert(std::is_trivially_destructible_v<T>);
6666

tensorstore/kvstore/s3/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,13 @@ tensorstore_cc_test(
366366
"@com_google_googletest//:gtest_main",
367367
],
368368
)
369+
370+
tensorstore_cc_test(
371+
name = "aws_api_test",
372+
size = "small",
373+
srcs = ["aws_api_test.cc"],
374+
deps = [
375+
"@aws_crt_cpp",
376+
"@com_google_googletest//:gtest_main",
377+
],
378+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2024 The TensorStore Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include <gmock/gmock.h>
16+
#include <gtest/gtest.h>
17+
#include <aws/crt/Api.h>
18+
19+
TEST(AwsApiTest, Basic) {
20+
::Aws::Crt::ApiHandle api_handle;
21+
EXPECT_THAT(api_handle.GetCrtVersion().major, ::testing::Eq(0));
22+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Description:
2+
# AWS C Auth
3+
4+
package(default_visibility = ["//visibility:public"])
5+
6+
licenses(["notice"]) # Apache 2.0
7+
8+
exports_files(["LICENSE"])
9+
10+
cc_library(
11+
name = "aws_c_auth",
12+
srcs = glob([
13+
"source/*.c",
14+
]),
15+
hdrs = glob([
16+
"include/aws/auth/**/*.h",
17+
]),
18+
includes = ["include"],
19+
deps = [
20+
"@aws_c_http",
21+
"@aws_c_sdkutils",
22+
],
23+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2024 The TensorStore Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
16+
load("//third_party:repo.bzl", "third_party_http_archive")
17+
18+
def repo():
19+
maybe(
20+
third_party_http_archive,
21+
name = "aws_c_auth",
22+
sha256 = "f249a12a6ac319e929c005fb7efd5534c83d3af3a3a53722626ff60a494054bb",
23+
strip_prefix = "aws-c-auth-0.7.22",
24+
urls = [
25+
"https://storage.googleapis.com/tensorstore-bazel-mirror/github.com/awslabs/aws-c-auth/archive/refs/tags/v0.7.22.tar.gz",
26+
],
27+
build_file = Label("//third_party:aws_c_auth/aws_c_auth.BUILD.bazel"),
28+
cmake_name = "aws_c_auth",
29+
cmake_target_mapping = {
30+
"@aws_c_auth//:aws_c_auth": "aws_c_auth::aws_c_auth",
31+
},
32+
bazel_to_cmake = {},
33+
)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Description:
2+
# AWS s2n tls
3+
4+
load("@tensorstore//bazel:utils.bzl", "package_relative_path")
5+
6+
package(default_visibility = ["//visibility:public"])
7+
8+
licenses(["notice"]) # Apache 2.0
9+
10+
cc_library(
11+
name = "aws_c_cal",
12+
srcs = glob([
13+
"source/*.c",
14+
]) + select({
15+
"@platforms//os:windows": glob([
16+
"source/windows/*.c",
17+
]),
18+
"@platforms//os:linux": glob([
19+
"source/unix/*.c",
20+
]),
21+
"@platforms//os:osx": glob([
22+
"source/darwin/*.c",
23+
"source/darwin/*.h",
24+
]),
25+
}),
26+
hdrs = glob([
27+
"include/aws/cal/*.h",
28+
"include/aws/cal/private/*.h",
29+
]),
30+
copts = select({
31+
"@platforms//os:osx": [
32+
"-I" + package_relative_path("source/darwin"),
33+
],
34+
"//conditions:default": [],
35+
}),
36+
includes = ["include"],
37+
linkopts = select({
38+
"@platforms//os:windows": [
39+
"-DEFAULTLIB:bcrypt.lib",
40+
],
41+
"@platforms//os:macos": [
42+
"-framework CoreFoundation",
43+
"-framework Security",
44+
],
45+
"//conditions:default": [],
46+
}) + select({
47+
":compiler_mingw_gcc": [
48+
"-lbcrypt",
49+
],
50+
"//conditions:default": [],
51+
}),
52+
deps = [
53+
"@aws_c_common",
54+
"@com_google_boringssl//:crypto",
55+
],
56+
)
57+
58+
[
59+
alias(
60+
name = name,
61+
actual = "@tensorstore//:{target}".format(target = name),
62+
)
63+
for name in [
64+
"compiler_mingw_gcc",
65+
]
66+
]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2024 The TensorStore Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
16+
load("//third_party:repo.bzl", "third_party_http_archive")
17+
18+
def repo():
19+
maybe(
20+
third_party_http_archive,
21+
name = "aws_c_cal",
22+
sha256 = "9c51afbece6aa7a4a3e40b99c242884c1744d7f949a3f720cea41d247ac2d06a",
23+
strip_prefix = "aws-c-cal-0.7.0",
24+
urls = [
25+
"https://storage.googleapis.com/tensorstore-bazel-mirror/github.com/awslabs/aws-c-cal/archive/refs/tags/v0.7.0.tar.gz",
26+
],
27+
build_file = Label("//third_party:aws_c_cal/aws_c_cal.BUILD.bazel"),
28+
cmake_name = "aws_c_cal",
29+
cmake_target_mapping = {
30+
"@aws_c_cal//:aws_c_cal": "aws_c_cal::aws_c_cal",
31+
},
32+
bazel_to_cmake = {},
33+
)

0 commit comments

Comments
 (0)