Skip to content

Commit e497ec4

Browse files
committed
fix review
1 parent 9edd089 commit e497ec4

File tree

4 files changed

+48
-99
lines changed

4 files changed

+48
-99
lines changed

src/iceberg/catalog/rest/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ iceberg_rest_dep = declare_dependency(
4646
meson.override_dependency('iceberg-rest', iceberg_rest_dep)
4747
pkg.generate(iceberg_rest_lib)
4848

49-
install_headers(['rest_catalog.h'], subdir: 'iceberg/catalog/rest')
49+
install_headers(['rest_catalog.h', 'types.h'], subdir: 'iceberg/catalog/rest')

src/iceberg/catalog/rest/request_types.h

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/iceberg/catalog/rest/rest_catalog.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#include <cpr/cpr.h>
2525

26+
#include "iceberg/catalog/rest/types.h"
27+
2628
namespace iceberg::catalog::rest {
2729

2830
RestCatalog::RestCatalog(const std::string& base_url) : base_url_(std::move(base_url)) {}

src/iceberg/catalog/rest/response_types.h renamed to src/iceberg/catalog/rest/types.h

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,66 @@
1919

2020
#pragma once
2121

22+
#include <memory>
2223
#include <optional>
2324
#include <string>
2425
#include <unordered_map>
2526
#include <vector>
2627

2728
#include "iceberg/catalog/rest/iceberg_rest_export.h"
2829
#include "iceberg/table_identifier.h"
29-
#include "iceberg/table_metadata.h"
30+
#include "iceberg/type_fwd.h"
31+
32+
/// \file iceberg/catalog/rest/types.h
33+
/// Request and response types for Iceberg REST Catalog API.
3034

3135
namespace iceberg::rest {
3236

37+
/// \brief Request to create a namespace.
38+
struct ICEBERG_REST_EXPORT CreateNamespaceRequest {
39+
Namespace namespace_; // required
40+
std::unordered_map<std::string, std::string> properties;
41+
};
42+
43+
/// \brief Update or delete namespace properties request.
44+
struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesRequest {
45+
std::vector<std::string> removals;
46+
std::unordered_map<std::string, std::string> updates;
47+
};
48+
49+
/// \brief Request to create a table.
50+
struct ICEBERG_REST_EXPORT CreateTableRequest {
51+
std::string name; // required
52+
std::string location;
53+
std::shared_ptr<Schema> schema; // required
54+
std::shared_ptr<PartitionSpec> partition_spec;
55+
std::shared_ptr<SortOrder> write_order;
56+
std::optional<bool> stage_create;
57+
std::unordered_map<std::string, std::string> properties;
58+
};
59+
60+
/// \brief Request to register a table.
61+
struct ICEBERG_REST_EXPORT RegisterTableRequest {
62+
std::string name; // required
63+
std::string metadata_location; // required
64+
bool overwrite = false;
65+
};
66+
67+
/// \brief Request to rename a table.
68+
struct ICEBERG_REST_EXPORT RenameTableRequest {
69+
TableIdentifier source; // required
70+
TableIdentifier destination; // required
71+
};
72+
3373
/// \brief An opaque token that allows clients to make use of pagination for list APIs.
3474
using PageToken = std::string;
3575

3676
/// \brief Result body for table create/load/register APIs.
37-
/// \details Matches **components/schemas/LoadTableResult** in the REST spec.
3877
struct ICEBERG_REST_EXPORT LoadTableResult {
3978
std::optional<std::string> metadata_location;
40-
TableMetadata metadata; // required
79+
std::shared_ptr<TableMetadata> metadata; // required // required
4180
std::unordered_map<std::string, std::string> config;
42-
// TODO(Li Feiyang): Add std::vector<StorageCredential> storage_credentials;
81+
// TODO(Li Feiyang): Add std::shared_ptr<StorageCredential> storage_credential;
4382
};
4483

4584
/// \brief Alias of LoadTableResult used as the body of CreateTableResponse
@@ -48,42 +87,34 @@ using CreateTableResponse = LoadTableResult;
4887
/// \brief Alias of LoadTableResult used as the body of LoadTableResponse
4988
using LoadTableResponse = LoadTableResult;
5089

51-
/// \brief Alias of LoadTableResult used as the body of RegisterTableResponse
52-
using RegisterTableResponse = LoadTableResult;
53-
5490
/// \brief Response body for listing namespaces.
55-
/// Contains all namespaces and an optional pagination token.
5691
struct ICEBERG_REST_EXPORT ListNamespacesResponse {
57-
std::optional<PageToken> next_page_token;
92+
PageToken next_page_token;
5893
std::vector<Namespace> namespaces;
5994
};
6095

6196
/// \brief Response body after creating a namespace.
62-
/// \details Contains the created namespace and its resolved properties.
6397
struct ICEBERG_REST_EXPORT CreateNamespaceResponse {
6498
Namespace namespace_; // required
6599
std::unordered_map<std::string, std::string> properties;
66100
};
67101

68102
/// \brief Response body for loading namespace properties.
69-
/// \details Contains stored properties, may be null if unsupported by the server.
70103
struct ICEBERG_REST_EXPORT GetNamespaceResponse {
71104
Namespace namespace_; // required
72105
std::unordered_map<std::string, std::string> properties;
73106
};
74107

75108
/// \brief Response body after updating namespace properties.
76-
/// \details Lists keys that were updated, removed, or missing.
77109
struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse {
78110
std::vector<std::string> updated; // required
79111
std::vector<std::string> removed; // required
80112
std::vector<std::string> missing;
81113
};
82114

83115
/// \brief Response body for listing tables in a namespace.
84-
/// \details Contains all table identifiers and an optional pagination token.
85116
struct ICEBERG_REST_EXPORT ListTablesResponse {
86-
std::optional<PageToken> next_page_token;
117+
PageToken next_page_token;
87118
std::vector<TableIdentifier> identifiers;
88119
};
89120

0 commit comments

Comments
 (0)