Skip to content

Commit e2d6496

Browse files
authored
chore: consolidate json serde file names (#539)
We have the convention that only header files should use the `_internal` suffix, so that iceberg_install_all_headers does not install them. However, we have some existing .cc files with the _internal suffix, which should be fixed. This commit only addresses json_internal.h/.cc, since we discussed renaming them to json_serde_internal.h and json_serde.cc in #534
1 parent 6f1cdfd commit e2d6496

23 files changed

+30
-39
lines changed

src/iceberg/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ set(ICEBERG_SOURCES
4242
file_reader.cc
4343
file_writer.cc
4444
inheritable_metadata.cc
45-
json_internal.cc
45+
json_serde.cc
4646
location_provider.cc
4747
manifest/manifest_adapter.cc
4848
manifest/manifest_entry.cc

src/iceberg/catalog/rest/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set(ICEBERG_REST_SOURCES
2525
endpoint.cc
2626
error_handlers.cc
2727
http_client.cc
28-
json_internal.cc
28+
json_serde.cc
2929
resource_paths.cc
3030
rest_catalog.cc
3131
rest_util.cc

src/iceberg/catalog/rest/http_client.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
#include "iceberg/catalog/rest/constant.h"
2626
#include "iceberg/catalog/rest/error_handlers.h"
27-
#include "iceberg/catalog/rest/json_internal.h"
27+
#include "iceberg/catalog/rest/json_serde_internal.h"
2828
#include "iceberg/catalog/rest/rest_util.h"
29-
#include "iceberg/json_internal.h"
29+
#include "iceberg/json_serde_internal.h"
3030
#include "iceberg/result.h"
3131
#include "iceberg/util/macros.h"
3232

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
* under the License.
1818
*/
1919

20-
#include "iceberg/catalog/rest/json_internal.h"
21-
2220
#include <memory>
2321
#include <string>
2422
#include <utility>
2523
#include <vector>
2624

2725
#include <nlohmann/json.hpp>
2826

27+
#include "iceberg/catalog/rest/json_serde_internal.h"
2928
#include "iceberg/catalog/rest/types.h"
30-
#include "iceberg/json_internal.h"
29+
#include "iceberg/json_serde_internal.h"
3130
#include "iceberg/partition_spec.h"
3231
#include "iceberg/sort_order.h"
3332
#include "iceberg/table_identifier.h"

src/iceberg/catalog/rest/json_internal.h renamed to src/iceberg/catalog/rest/json_serde_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "iceberg/catalog/rest/types.h"
2626
#include "iceberg/result.h"
2727

28-
/// \file iceberg/catalog/rest/json_internal.h
28+
/// \file iceberg/catalog/rest/json_serde_internal.h
2929
/// JSON serialization and deserialization for Iceberg REST Catalog API types.
3030

3131
namespace iceberg::rest {

src/iceberg/catalog/rest/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ iceberg_rest_sources = files(
2323
'endpoint.cc',
2424
'error_handlers.cc',
2525
'http_client.cc',
26-
'json_internal.cc',
26+
'json_serde.cc',
2727
'resource_paths.cc',
2828
'rest_catalog.cc',
2929
'rest_util.cc',

src/iceberg/catalog/rest/rest_catalog.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
#include "iceberg/catalog/rest/endpoint.h"
3232
#include "iceberg/catalog/rest/error_handlers.h"
3333
#include "iceberg/catalog/rest/http_client.h"
34-
#include "iceberg/catalog/rest/json_internal.h"
34+
#include "iceberg/catalog/rest/json_serde_internal.h"
3535
#include "iceberg/catalog/rest/resource_paths.h"
3636
#include "iceberg/catalog/rest/rest_catalog.h"
3737
#include "iceberg/catalog/rest/rest_util.h"
3838
#include "iceberg/catalog/rest/types.h"
39-
#include "iceberg/json_internal.h"
39+
#include "iceberg/json_serde_internal.h"
4040
#include "iceberg/partition_spec.h"
4141
#include "iceberg/result.h"
4242
#include "iceberg/schema.h"
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
#include "iceberg/json_internal.h"
21-
2220
#include <algorithm>
2321
#include <cstdint>
2422
#include <format>
@@ -28,6 +26,7 @@
2826

2927
#include <nlohmann/json.hpp>
3028

29+
#include "iceberg/json_serde_internal.h"
3130
#include "iceberg/name_mapping.h"
3231
#include "iceberg/partition_field.h"
3332
#include "iceberg/partition_spec.h"
@@ -1397,15 +1396,9 @@ nlohmann::json ToJson(const TableUpdate& update) {
13971396
json[kRefName] = u.ref_name();
13981397
json[kSnapshotId] = u.snapshot_id();
13991398
json[kType] = ToString(u.type());
1400-
if (u.min_snapshots_to_keep().has_value()) {
1401-
json[kMinSnapshotsToKeep] = u.min_snapshots_to_keep().value();
1402-
}
1403-
if (u.max_snapshot_age_ms().has_value()) {
1404-
json[kMaxSnapshotAgeMs] = u.max_snapshot_age_ms().value();
1405-
}
1406-
if (u.max_ref_age_ms().has_value()) {
1407-
json[kMaxRefAgeMs] = u.max_ref_age_ms().value();
1408-
}
1399+
SetOptionalField(json, kMinSnapshotsToKeep, u.min_snapshots_to_keep());
1400+
SetOptionalField(json, kMaxSnapshotAgeMs, u.max_snapshot_age_ms());
1401+
SetOptionalField(json, kMaxRefAgeMs, u.max_ref_age_ms());
14091402
break;
14101403
}
14111404
case TableUpdate::Kind::kSetProperties: {

src/iceberg/manifest/v1_metadata.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <memory>
2121

22-
#include "iceberg/json_internal.h"
22+
#include "iceberg/json_serde_internal.h"
2323
#include "iceberg/manifest/manifest_entry.h"
2424
#include "iceberg/manifest/manifest_list.h"
2525
#include "iceberg/manifest/v1_metadata_internal.h"

0 commit comments

Comments
 (0)