Skip to content

Commit

Permalink
cleanup(storage): refactor HeadersMap definition (#8924)
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan authored May 9, 2022
1 parent f7f6219 commit 4a8f321
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
1 change: 1 addition & 0 deletions google/cloud/storage/google_cloud_cpp_storage.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ google_cloud_cpp_storage_hdrs = [
"download_options.h",
"hash_mismatch_error.h",
"hashing_options.h",
"headers_map.h",
"hmac_key_metadata.h",
"iam_policy.h",
"idempotency_policy.h",
Expand Down
1 change: 1 addition & 0 deletions google/cloud/storage/google_cloud_cpp_storage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ add_library(
hash_mismatch_error.h
hashing_options.cc
hashing_options.h
headers_map.h
hmac_key_metadata.cc
hmac_key_metadata.h
iam_policy.cc
Expand Down
35 changes: 35 additions & 0 deletions google/cloud/storage/headers_map.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_HEADERS_MAP_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_HEADERS_MAP_H

#include "google/cloud/storage/version.h"
#include <map>
#include <string>

namespace google {
namespace cloud {
namespace storage {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/// Represents the headers returned in a streaming upload or download operation.
using HeadersMap = std::multimap<std::string, std::string>;

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace storage
} // namespace cloud
} // namespace google

#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_HEADERS_MAP_H
2 changes: 0 additions & 2 deletions google/cloud/storage/internal/grpc_object_read_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ namespace storage {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace internal {

using HeadersMap = std::multimap<std::string, std::string>;

GrpcObjectReadSource::GrpcObjectReadSource(std::unique_ptr<StreamingRpc> stream)
: stream_(std::move(stream)) {}

Expand Down
5 changes: 1 addition & 4 deletions google/cloud/storage/object_read_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_READ_STREAM_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_READ_STREAM_H

#include "google/cloud/storage/headers_map.h"
#include "google/cloud/storage/internal/object_read_streambuf.h"
#include "google/cloud/storage/version.h"
#include <istream>
#include <map>
#include <memory>
#include <string>

Expand All @@ -27,9 +27,6 @@ namespace cloud {
namespace storage {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/// Represents the headers returned in a streaming upload or download operation.
using HeadersMap = std::multimap<std::string, std::string>;

/**
* Defines a `std::basic_istream<char>` to read from a GCS Object.
*/
Expand Down
5 changes: 1 addition & 4 deletions google/cloud/storage/object_write_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_WRITE_STREAM_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_WRITE_STREAM_H

#include "google/cloud/storage/headers_map.h"
#include "google/cloud/storage/internal/object_write_streambuf.h"
#include "google/cloud/storage/version.h"
#include <map>
#include <memory>
#include <ostream>
#include <string>
Expand All @@ -27,9 +27,6 @@ namespace cloud {
namespace storage {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

/// Represents the headers returned in a streaming upload or download operation.
using HeadersMap = std::multimap<std::string, std::string>;

/**
* Defines a `std::basic_ostream<char>` to write to a GCS object.
*
Expand Down

0 comments on commit 4a8f321

Please sign in to comment.