JayjeetAtGithub commented on a change in pull request #10913: URL: https://github.com/apache/arrow/pull/10913#discussion_r716109718
########## File path: cpp/src/skyhook/cls/cls_skyhook.cc ########## @@ -0,0 +1,258 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +#include <rados/objclass.h> +#include <memory> + +#include "skyhook/protocol/skyhook_protocol.h" + +#include "arrow/compute/exec/expression.h" +#include "arrow/dataset/dataset.h" +#include "arrow/dataset/file_ipc.h" +#include "arrow/dataset/file_parquet.h" +#include "arrow/io/interfaces.h" +#include "arrow/result.h" +#include "arrow/util/compression.h" + +CLS_VER(1, 0) +CLS_NAME(skyhook) + +cls_handle_t h_class; +cls_method_handle_t h_scan_op; + +/// \brief Log skyhook errors using RADOS object class SDK's logger. +void LogSkyhookError(const std::string& msg) { CLS_LOG(0, "error: %s", msg.c_str()); } + +/// \class RandomAccessObject +/// \brief An interface to provide a file-like view over RADOS objects. +class RandomAccessObject : public arrow::io::RandomAccessFile { + public: + explicit RandomAccessObject(cls_method_context_t hctx, int64_t file_size) { + hctx_ = hctx; + content_length_ = file_size; + chunks_ = std::vector<ceph::bufferlist*>(); + } + + ~RandomAccessObject() { Close(); } + + /// Check if the file stream is closed. + arrow::Status CheckClosed() const { Review comment: Done -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
