@@ -87,6 +87,11 @@ class TTreeFileSystem : public VirtualRootFileSystemBase
87
87
{
88
88
return std::dynamic_pointer_cast<VirtualRootFileSystemBase>(shared_from_this ());
89
89
};
90
+
91
+ arrow::Result<std::shared_ptr<arrow::io::OutputStream>> OpenOutputStream (
92
+ const std::string& path,
93
+ const std::shared_ptr<const arrow::KeyValueMetadata>& metadata) override ;
94
+
90
95
virtual TTree* GetTree (arrow::dataset::FileSource source) = 0;
91
96
};
92
97
@@ -128,6 +133,10 @@ class TFileFileSystem : public VirtualRootFileSystemBase
128
133
129
134
std::shared_ptr<VirtualRootFileSystemBase> GetSubFilesystem (arrow::dataset::FileSource source) override ;
130
135
136
+ arrow::Result<std::shared_ptr<arrow::io::OutputStream>> OpenOutputStream (
137
+ const std::string& path,
138
+ const std::shared_ptr<const arrow::KeyValueMetadata>& metadata) override ;
139
+
131
140
// We can go back to the TFile in case this is needed.
132
141
TDirectoryFile* GetFile ()
133
142
{
@@ -218,6 +227,29 @@ class TTreeFileFormat : public arrow::dataset::FileFormat
218
227
const std::shared_ptr<arrow::dataset::FileFragment>& fragment) const override ;
219
228
};
220
229
230
+ // An arrow outputstream which allows to write to a ttree
231
+ class TTreeOutputStream : public arrow ::io::OutputStream
232
+ {
233
+ public:
234
+ TTreeOutputStream (TTree* t);
235
+
236
+ arrow::Status Close () override ;
237
+
238
+ arrow::Result<int64_t > Tell () const override ;
239
+
240
+ arrow::Status Write (const void * data, int64_t nbytes) override ;
241
+
242
+ bool closed () const override ;
243
+
244
+ TTree* GetTree ()
245
+ {
246
+ return mTree ;
247
+ }
248
+
249
+ private:
250
+ TTree* mTree ;
251
+ };
252
+
221
253
} // namespace o2::framework
222
254
223
255
#endif // O2_FRAMEWORK_ROOT_ARROW_FILESYSTEM_H_
0 commit comments