wgtmac commented on code in PR #47: URL: https://github.com/apache/iceberg-cpp/pull/47#discussion_r2013329579
########## src/iceberg/table.h: ########## @@ -19,17 +19,93 @@ #pragma once +#include <map> +#include <memory> #include <string> +#include <vector> +#include "iceberg/error.h" +#include "iceberg/expected.h" #include "iceberg/iceberg_export.h" +#include "iceberg/type_fwd.h" namespace iceberg { -/// \brief The metadata of an Iceberg table. +/// \brief Represents an Iceberg table class ICEBERG_EXPORT Table { public: virtual ~Table() = default; - virtual std::string print() const = 0; + + /// \brief Return the full name for this table + virtual const std::string& name() const = 0; + + /// \brief Returns the UUID of the table + virtual const std::string& uuid() const = 0; + + /// \brief Refresh the current table metadata + virtual expected<void, Error> Refresh() = 0; + + /// \brief Return the schema for this table + virtual const std::shared_ptr<Schema>& schema() const = 0; + + /// \brief Return a map of schema for this table + virtual const std::map<int32_t, std::shared_ptr<Schema>>& schemas() const = 0; + + /// \brief Return the partition spec for this table + virtual const std::shared_ptr<PartitionSpec>& spec() const = 0; + + /// \brief Return a map of partition specs for this table + virtual const std::map<int32_t, std::shared_ptr<PartitionSpec>>& specs() const = 0; + + /// \brief Return the sort order for this table + virtual const std::shared_ptr<SortOrder>& sort_order() const = 0; + + /// \brief Return a map of sort order IDs to sort orders for this table + virtual const std::map<int32_t, std::shared_ptr<SortOrder>>& sort_orders() const = 0; + + /// \brief Return a map of string properties for this table + virtual const std::map<std::string, std::string>& properties() const = 0; + + /// \brief Return the table's base location + virtual const std::string& location() const = 0; + + /// \brief Return the table's current snapshot + virtual const std::shared_ptr<Snapshot>& current_snapshot() const = 0; + + /// \brief Get the snapshot of this table with the given id, or null if there is no + /// matching snapshot + /// + /// \param snapshot_id the ID of the snapshot to get + /// \return the Snapshot with the given id + virtual expected<std::shared_ptr<Snapshot>, Error> snapshot( + int64_t snapshot_id) const = 0; + + /// \brief Get the snapshots of this table + virtual const std::vector<std::shared_ptr<Snapshot>>& snapshots() const = 0; Review Comment: That's a good question. Maybe you can add it later? I think the current one makes sense because the `Table` object has a full state of `TableMetadata` so it anyway caches all `Snapshot`s in it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org