@@ -37,7 +37,7 @@ class TableScan;
3737class TableRead ;
3838
3939// / A table provides basic abstraction for table type.
40- class PAIMON_EXPORT Table {
40+ class PAIMON_EXPORT Table : public std::enable_shared_from_this<Table> {
4141 public:
4242 // / Creates a table by loading the latest schema from the specified table path.
4343 // /
@@ -84,27 +84,35 @@ class PAIMON_EXPORT Table {
8484 }
8585
8686 // / Creates a scan of this table from a finished scan context, standing in for
87- // / `TableScan::Create`.
87+ // / `TableScan::Create`. The scan is handed the table's shared owner, so it shares the
88+ // / caller's hold on the table.
8889 // / @param context The finished scan context.
89- // / @return The scan, or the error `TableScan::Create` reports.
90+ // / @return The scan, or the error `TableScan::Create` reports. A table no `shared_ptr` holds
91+ // / cannot hand itself over and reports that.
9092 Result<std::unique_ptr<TableScan>> NewScan (std::unique_ptr<ScanContext> context) const ;
9193
9294 // / Creates a read of this table from a finished read context, standing in for
93- // / `TableRead::Create`.
95+ // / `TableRead::Create`. The read is handed the table's shared owner, so it shares the
96+ // / caller's hold on the table.
9497 // / @param context The finished read context.
95- // / @return The read, or the error `TableRead::Create` reports.
98+ // / @return The read, or the error `TableRead::Create` reports. A table no `shared_ptr` holds
99+ // / cannot hand itself over and reports that.
96100 Result<std::unique_ptr<TableRead>> NewRead (std::unique_ptr<ReadContext> context) const ;
97101
98102 // / Creates a write of this table from a finished write context, standing in for
99- // / `FileStoreWrite::Create`.
103+ // / `FileStoreWrite::Create`. The write is handed the table's shared owner, so it shares the
104+ // / caller's hold on the table.
100105 // / @param context The finished write context.
101- // / @return The write, or the error `FileStoreWrite::Create` reports.
106+ // / @return The write, or the error `FileStoreWrite::Create` reports. A table no `shared_ptr`
107+ // / holds cannot hand itself over and reports that.
102108 Result<std::unique_ptr<FileStoreWrite>> NewWrite (std::unique_ptr<WriteContext> context) const ;
103109
104110 // / Creates a commit of this table from a finished commit context, standing in for
105- // / `FileStoreCommit::Create`.
111+ // / `FileStoreCommit::Create`. The commit is handed the table's shared owner, so it shares
112+ // / the caller's hold on the table.
106113 // / @param context The finished commit context.
107- // / @return The commit, or the error `FileStoreCommit::Create` reports.
114+ // / @return The commit, or the error `FileStoreCommit::Create` reports. A table no
115+ // / `shared_ptr` holds cannot hand itself over and reports that.
108116 Result<std::unique_ptr<FileStoreCommit>> NewCommit (
109117 std::unique_ptr<CommitContext> context) const ;
110118
0 commit comments