Repository: arrow Updated Branches: refs/heads/master 57b537a3c -> 16dd87164
ARROW-650: [GLib] Follow ReadableFileInterface -> RnadomAccessFile change Author: Kouhei Sutou <k...@clear-code.com> Closes #399 from kou/glib-follow-random-access-change and squashes the following commits: d46a1cb [Kouhei Sutou] [GLib] Follow ReadableFileInterface -> RnadomAccessFile change Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/16dd8716 Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/16dd8716 Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/16dd8716 Branch: refs/heads/master Commit: 16dd87164d7ab756dc6c5eaabd22ef767edca037 Parents: 57b537a Author: Kouhei Sutou <k...@clear-code.com> Authored: Sat Mar 18 18:14:49 2017 +0100 Committer: Uwe L. Korn <uw...@xhochy.com> Committed: Sat Mar 18 18:14:49 2017 +0100 ---------------------------------------------------------------------- c_glib/arrow-glib/Makefile.am | 6 +- c_glib/arrow-glib/arrow-io-glib.h | 2 +- c_glib/arrow-glib/arrow-io-glib.hpp | 2 +- c_glib/arrow-glib/io-memory-mapped-file.cpp | 14 +-- c_glib/arrow-glib/io-random-access-file.cpp | 128 +++++++++++++++++++++++ c_glib/arrow-glib/io-random-access-file.h | 55 ++++++++++ c_glib/arrow-glib/io-random-access-file.hpp | 38 +++++++ c_glib/arrow-glib/io-readable-file.cpp | 127 ---------------------- c_glib/arrow-glib/io-readable-file.h | 55 ---------- c_glib/arrow-glib/io-readable-file.hpp | 38 ------- c_glib/arrow-glib/ipc-file-reader.cpp | 6 +- c_glib/arrow-glib/ipc-file-reader.h | 4 +- c_glib/doc/reference/arrow-glib-docs.sgml | 2 +- 13 files changed, 239 insertions(+), 238 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/Makefile.am ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/Makefile.am b/c_glib/arrow-glib/Makefile.am index 61137a0..7699594 100644 --- a/c_glib/arrow-glib/Makefile.am +++ b/c_glib/arrow-glib/Makefile.am @@ -242,8 +242,8 @@ libarrow_io_glib_la_headers = \ io-input-stream.h \ io-memory-mapped-file.h \ io-output-stream.h \ + io-random-access-file.h \ io-readable.h \ - io-readable-file.h \ io-writeable.h \ io-writeable-file.h @@ -261,8 +261,8 @@ libarrow_io_glib_la_sources = \ io-input-stream.cpp \ io-memory-mapped-file.cpp \ io-output-stream.cpp \ + io-random-access-file.cpp \ io-readable.cpp \ - io-readable-file.cpp \ io-writeable.cpp \ io-writeable-file.cpp \ $(libarrow_io_glib_la_headers) \ @@ -276,8 +276,8 @@ libarrow_io_glib_la_cpp_headers = \ io-input-stream.hpp \ io-memory-mapped-file.hpp \ io-output-stream.hpp \ + io-random-access-file.hpp \ io-readable.hpp \ - io-readable-file.hpp \ io-writeable.hpp \ io-writeable-file.hpp http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/arrow-io-glib.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/arrow-io-glib.h b/c_glib/arrow-glib/arrow-io-glib.h index e02aa9b..4d49a98 100644 --- a/c_glib/arrow-glib/arrow-io-glib.h +++ b/c_glib/arrow-glib/arrow-io-glib.h @@ -26,7 +26,7 @@ #include <arrow-glib/io-input-stream.h> #include <arrow-glib/io-memory-mapped-file.h> #include <arrow-glib/io-output-stream.h> +#include <arrow-glib/io-random-access-file.h> #include <arrow-glib/io-readable.h> -#include <arrow-glib/io-readable-file.h> #include <arrow-glib/io-writeable.h> #include <arrow-glib/io-writeable-file.h> http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/arrow-io-glib.hpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/arrow-io-glib.hpp b/c_glib/arrow-glib/arrow-io-glib.hpp index 378f202..3e7636c 100644 --- a/c_glib/arrow-glib/arrow-io-glib.hpp +++ b/c_glib/arrow-glib/arrow-io-glib.hpp @@ -25,6 +25,6 @@ #include <arrow-glib/io-input-stream.hpp> #include <arrow-glib/io-memory-mapped-file.hpp> #include <arrow-glib/io-output-stream.hpp> +#include <arrow-glib/io-random-access-file.hpp> #include <arrow-glib/io-readable.hpp> -#include <arrow-glib/io-readable-file.hpp> #include <arrow-glib/io-writeable.hpp> http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/io-memory-mapped-file.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/io-memory-mapped-file.cpp b/c_glib/arrow-glib/io-memory-mapped-file.cpp index aa6ae2a..12c9a6c 100644 --- a/c_glib/arrow-glib/io-memory-mapped-file.cpp +++ b/c_glib/arrow-glib/io-memory-mapped-file.cpp @@ -29,7 +29,7 @@ #include <arrow-glib/io-input-stream.hpp> #include <arrow-glib/io-memory-mapped-file.hpp> #include <arrow-glib/io-readable.hpp> -#include <arrow-glib/io-readable-file.hpp> +#include <arrow-glib/io-random-access-file.hpp> #include <arrow-glib/io-writeable.hpp> #include <arrow-glib/io-writeable-file.hpp> @@ -97,8 +97,8 @@ garrow_io_input_stream_interface_init(GArrowIOInputStreamInterface *iface) iface->get_raw = garrow_io_memory_mapped_file_get_raw_input_stream_interface; } -static std::shared_ptr<arrow::io::ReadableFileInterface> -garrow_io_memory_mapped_file_get_raw_readable_file_interface(GArrowIOReadableFile *file) +static std::shared_ptr<arrow::io::RandomAccessFile> +garrow_io_memory_mapped_file_get_raw_random_access_file_interface(GArrowIORandomAccessFile *file) { auto memory_mapped_file = GARROW_IO_MEMORY_MAPPED_FILE(file); auto arrow_memory_mapped_file = @@ -107,9 +107,9 @@ garrow_io_memory_mapped_file_get_raw_readable_file_interface(GArrowIOReadableFil } static void -garrow_io_readable_file_interface_init(GArrowIOReadableFileInterface *iface) +garrow_io_random_access_file_interface_init(GArrowIORandomAccessFileInterface *iface) { - iface->get_raw = garrow_io_memory_mapped_file_get_raw_readable_file_interface; + iface->get_raw = garrow_io_memory_mapped_file_get_raw_random_access_file_interface; } static std::shared_ptr<arrow::io::Writeable> @@ -152,8 +152,8 @@ G_DEFINE_TYPE_WITH_CODE(GArrowIOMemoryMappedFile, garrow_io_readable_interface_init) G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_INPUT_STREAM, garrow_io_input_stream_interface_init) - G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_READABLE_FILE, - garrow_io_readable_file_interface_init) + G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_RANDOM_ACCESS_FILE, + garrow_io_random_access_file_interface_init) G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE, garrow_io_writeable_interface_init) G_IMPLEMENT_INTERFACE(GARROW_IO_TYPE_WRITEABLE_FILE, http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/io-random-access-file.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/io-random-access-file.cpp b/c_glib/arrow-glib/io-random-access-file.cpp new file mode 100644 index 0000000..552b879 --- /dev/null +++ b/c_glib/arrow-glib/io-random-access-file.cpp @@ -0,0 +1,128 @@ +/* + * 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. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <arrow/api.h> + +#include <arrow-glib/error.hpp> +#include <arrow-glib/io-random-access-file.hpp> + +G_BEGIN_DECLS + +/** + * SECTION: io-random-access-file + * @title: GArrowIORandomAccessFile + * @short_description: File input interface + * + * #GArrowIORandomAccessFile is an interface for file input. + */ + +G_DEFINE_INTERFACE(GArrowIORandomAccessFile, + garrow_io_random_access_file, + G_TYPE_OBJECT) + +static void +garrow_io_random_access_file_default_init (GArrowIORandomAccessFileInterface *iface) +{ +} + +/** + * garrow_io_random_access_file_get_size: + * @file: A #GArrowIORandomAccessFile. + * @error: (nullable): Return location for a #GError or %NULL. + * + * Returns: The size of the file. + */ +guint64 +garrow_io_random_access_file_get_size(GArrowIORandomAccessFile *file, + GError **error) +{ + auto *iface = GARROW_IO_RANDOM_ACCESS_FILE_GET_IFACE(file); + auto arrow_random_access_file = iface->get_raw(file); + int64_t size; + + auto status = arrow_random_access_file->GetSize(&size); + if (status.ok()) { + return size; + } else { + garrow_error_set(error, status, "[io][random-access-file][get-size]"); + return 0; + } +} + +/** + * garrow_io_random_access_file_get_support_zero_copy: + * @file: A #GArrowIORandomAccessFile. + * + * Returns: Whether zero copy read is supported or not. + */ +gboolean +garrow_io_random_access_file_get_support_zero_copy(GArrowIORandomAccessFile *file) +{ + auto *iface = GARROW_IO_RANDOM_ACCESS_FILE_GET_IFACE(file); + auto arrow_random_access_file = iface->get_raw(file); + + return arrow_random_access_file->supports_zero_copy(); +} + +/** + * garrow_io_random_access_file_read_at: + * @file: A #GArrowIORandomAccessFile. + * @position: The read start position. + * @n_bytes: The number of bytes to be read. + * @n_read_bytes: (out): The read number of bytes. + * @buffer: (array length=n_bytes): The buffer to be read data. + * @error: (nullable): Return location for a #GError or %NULL. + * + * Returns: %TRUE on success, %FALSE if there was an error. + */ +gboolean +garrow_io_random_access_file_read_at(GArrowIORandomAccessFile *file, + gint64 position, + gint64 n_bytes, + gint64 *n_read_bytes, + guint8 *buffer, + GError **error) +{ + const auto arrow_random_access_file = + garrow_io_random_access_file_get_raw(file); + + auto status = arrow_random_access_file->ReadAt(position, + n_bytes, + n_read_bytes, + buffer); + if (status.ok()) { + return TRUE; + } else { + garrow_error_set(error, status, "[io][random-access-file][read-at]"); + return FALSE; + } +} + +G_END_DECLS + +std::shared_ptr<arrow::io::RandomAccessFile> +garrow_io_random_access_file_get_raw(GArrowIORandomAccessFile *random_access_file) +{ + auto *iface = GARROW_IO_RANDOM_ACCESS_FILE_GET_IFACE(random_access_file); + return iface->get_raw(random_access_file); +} http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/io-random-access-file.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/io-random-access-file.h b/c_glib/arrow-glib/io-random-access-file.h new file mode 100644 index 0000000..e980ab2 --- /dev/null +++ b/c_glib/arrow-glib/io-random-access-file.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#pragma once + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define GARROW_IO_TYPE_RANDOM_ACCESS_FILE \ + (garrow_io_random_access_file_get_type()) +#define GARROW_IO_RANDOM_ACCESS_FILE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_IO_TYPE_RANDOM_ACCESS_FILE, \ + GArrowIORandomAccessFileInterface)) +#define GARROW_IO_IS_RANDOM_ACCESS_FILE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + GARROW_IO_TYPE_RANDOM_ACCESS_FILE)) +#define GARROW_IO_RANDOM_ACCESS_FILE_GET_IFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE((obj), \ + GARROW_IO_TYPE_RANDOM_ACCESS_FILE, \ + GArrowIORandomAccessFileInterface)) + +typedef struct _GArrowIORandomAccessFile GArrowIORandomAccessFile; +typedef struct _GArrowIORandomAccessFileInterface GArrowIORandomAccessFileInterface; + +GType garrow_io_random_access_file_get_type(void) G_GNUC_CONST; + +guint64 garrow_io_random_access_file_get_size(GArrowIORandomAccessFile *file, + GError **error); +gboolean garrow_io_random_access_file_get_support_zero_copy(GArrowIORandomAccessFile *file); +gboolean garrow_io_random_access_file_read_at(GArrowIORandomAccessFile *file, + gint64 position, + gint64 n_bytes, + gint64 *n_read_bytes, + guint8 *buffer, + GError **error); + +G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/io-random-access-file.hpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/io-random-access-file.hpp b/c_glib/arrow-glib/io-random-access-file.hpp new file mode 100644 index 0000000..7c97c9e --- /dev/null +++ b/c_glib/arrow-glib/io-random-access-file.hpp @@ -0,0 +1,38 @@ +/* + * 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. + */ + +#pragma once + +#include <arrow/io/interfaces.h> + +#include <arrow-glib/io-random-access-file.h> + +/** + * GArrowIORandomAccessFileInterface: + * + * It wraps `arrow::io::RandomAccessFile`. + */ +struct _GArrowIORandomAccessFileInterface +{ + GTypeInterface parent_iface; + + std::shared_ptr<arrow::io::RandomAccessFile> (*get_raw)(GArrowIORandomAccessFile *file); +}; + +std::shared_ptr<arrow::io::RandomAccessFile> garrow_io_random_access_file_get_raw(GArrowIORandomAccessFile *random_access_file); http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/io-readable-file.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/io-readable-file.cpp b/c_glib/arrow-glib/io-readable-file.cpp deleted file mode 100644 index 014fd7a..0000000 --- a/c_glib/arrow-glib/io-readable-file.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <arrow/api.h> - -#include <arrow-glib/error.hpp> -#include <arrow-glib/io-readable-file.hpp> - -G_BEGIN_DECLS - -/** - * SECTION: io-readable-file - * @title: GArrowIOReadableFile - * @short_description: File input interface - * - * #GArrowIOReadableFile is an interface for file input. - */ - -G_DEFINE_INTERFACE(GArrowIOReadableFile, - garrow_io_readable_file, - G_TYPE_OBJECT) - -static void -garrow_io_readable_file_default_init (GArrowIOReadableFileInterface *iface) -{ -} - -/** - * garrow_io_readable_file_get_size: - * @file: A #GArrowIOReadableFile. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: The size of the file. - */ -guint64 -garrow_io_readable_file_get_size(GArrowIOReadableFile *file, - GError **error) -{ - auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(file); - auto arrow_readable_file = iface->get_raw(file); - int64_t size; - - auto status = arrow_readable_file->GetSize(&size); - if (status.ok()) { - return size; - } else { - garrow_error_set(error, status, "[io][readable-file][get-size]"); - return 0; - } -} - -/** - * garrow_io_readable_file_get_support_zero_copy: - * @file: A #GArrowIOReadableFile. - * - * Returns: Whether zero copy read is supported or not. - */ -gboolean -garrow_io_readable_file_get_support_zero_copy(GArrowIOReadableFile *file) -{ - auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(file); - auto arrow_readable_file = iface->get_raw(file); - - return arrow_readable_file->supports_zero_copy(); -} - -/** - * garrow_io_readable_file_read_at: - * @file: A #GArrowIOReadableFile. - * @position: The read start position. - * @n_bytes: The number of bytes to be read. - * @n_read_bytes: (out): The read number of bytes. - * @buffer: (array length=n_bytes): The buffer to be read data. - * @error: (nullable): Return location for a #GError or %NULL. - * - * Returns: %TRUE on success, %FALSE if there was an error. - */ -gboolean -garrow_io_readable_file_read_at(GArrowIOReadableFile *file, - gint64 position, - gint64 n_bytes, - gint64 *n_read_bytes, - guint8 *buffer, - GError **error) -{ - const auto arrow_readable_file = garrow_io_readable_file_get_raw(file); - - auto status = arrow_readable_file->ReadAt(position, - n_bytes, - n_read_bytes, - buffer); - if (status.ok()) { - return TRUE; - } else { - garrow_error_set(error, status, "[io][readable-file][read-at]"); - return FALSE; - } -} - -G_END_DECLS - -std::shared_ptr<arrow::io::ReadableFileInterface> -garrow_io_readable_file_get_raw(GArrowIOReadableFile *readable_file) -{ - auto *iface = GARROW_IO_READABLE_FILE_GET_IFACE(readable_file); - return iface->get_raw(readable_file); -} http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/io-readable-file.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/io-readable-file.h b/c_glib/arrow-glib/io-readable-file.h deleted file mode 100644 index 1dcb13e..0000000 --- a/c_glib/arrow-glib/io-readable-file.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define GARROW_IO_TYPE_READABLE_FILE \ - (garrow_io_readable_file_get_type()) -#define GARROW_IO_READABLE_FILE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_IO_TYPE_READABLE_FILE, \ - GArrowIOReadableFileInterface)) -#define GARROW_IO_IS_READABLE_FILE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_IO_TYPE_READABLE_FILE)) -#define GARROW_IO_READABLE_FILE_GET_IFACE(obj) \ - (G_TYPE_INSTANCE_GET_INTERFACE((obj), \ - GARROW_IO_TYPE_READABLE_FILE, \ - GArrowIOReadableFileInterface)) - -typedef struct _GArrowIOReadableFile GArrowIOReadableFile; -typedef struct _GArrowIOReadableFileInterface GArrowIOReadableFileInterface; - -GType garrow_io_readable_file_get_type(void) G_GNUC_CONST; - -guint64 garrow_io_readable_file_get_size(GArrowIOReadableFile *file, - GError **error); -gboolean garrow_io_readable_file_get_support_zero_copy(GArrowIOReadableFile *file); -gboolean garrow_io_readable_file_read_at(GArrowIOReadableFile *file, - gint64 position, - gint64 n_bytes, - gint64 *n_read_bytes, - guint8 *buffer, - GError **error); - -G_END_DECLS http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/io-readable-file.hpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/io-readable-file.hpp b/c_glib/arrow-glib/io-readable-file.hpp deleted file mode 100644 index 83d8628..0000000 --- a/c_glib/arrow-glib/io-readable-file.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include <arrow/io/interfaces.h> - -#include <arrow-glib/io-readable-file.h> - -/** - * GArrowIOReadableFileInterface: - * - * It wraps `arrow::io::ReadableFileInterface`. - */ -struct _GArrowIOReadableFileInterface -{ - GTypeInterface parent_iface; - - std::shared_ptr<arrow::io::ReadableFileInterface> (*get_raw)(GArrowIOReadableFile *file); -}; - -std::shared_ptr<arrow::io::ReadableFileInterface> garrow_io_readable_file_get_raw(GArrowIOReadableFile *readable_file); http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/ipc-file-reader.cpp ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/ipc-file-reader.cpp b/c_glib/arrow-glib/ipc-file-reader.cpp index b9e408c..223be85 100644 --- a/c_glib/arrow-glib/ipc-file-reader.cpp +++ b/c_glib/arrow-glib/ipc-file-reader.cpp @@ -27,7 +27,7 @@ #include <arrow-glib/record-batch.hpp> #include <arrow-glib/schema.hpp> -#include <arrow-glib/io-readable-file.hpp> +#include <arrow-glib/io-random-access-file.hpp> #include <arrow-glib/ipc-file-reader.hpp> #include <arrow-glib/ipc-metadata-version.hpp> @@ -139,12 +139,12 @@ garrow_ipc_file_reader_class_init(GArrowIPCFileReaderClass *klass) * #GArrowIPCFileReader or %NULL on error. */ GArrowIPCFileReader * -garrow_ipc_file_reader_open(GArrowIOReadableFile *file, +garrow_ipc_file_reader_open(GArrowIORandomAccessFile *file, GError **error) { std::shared_ptr<arrow::ipc::FileReader> arrow_file_reader; auto status = - arrow::ipc::FileReader::Open(garrow_io_readable_file_get_raw(file), + arrow::ipc::FileReader::Open(garrow_io_random_access_file_get_raw(file), &arrow_file_reader); if (status.ok()) { return garrow_ipc_file_reader_new_raw(&arrow_file_reader); http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/arrow-glib/ipc-file-reader.h ---------------------------------------------------------------------- diff --git a/c_glib/arrow-glib/ipc-file-reader.h b/c_glib/arrow-glib/ipc-file-reader.h index 22915f8..15eba8e 100644 --- a/c_glib/arrow-glib/ipc-file-reader.h +++ b/c_glib/arrow-glib/ipc-file-reader.h @@ -22,7 +22,7 @@ #include <arrow-glib/record-batch.h> #include <arrow-glib/schema.h> -#include <arrow-glib/io-readable-file.h> +#include <arrow-glib/io-random-access-file.h> #include <arrow-glib/ipc-metadata-version.h> @@ -70,7 +70,7 @@ struct _GArrowIPCFileReaderClass GType garrow_ipc_file_reader_get_type(void) G_GNUC_CONST; -GArrowIPCFileReader *garrow_ipc_file_reader_open(GArrowIOReadableFile *file, +GArrowIPCFileReader *garrow_ipc_file_reader_open(GArrowIORandomAccessFile *file, GError **error); GArrowSchema *garrow_ipc_file_reader_get_schema(GArrowIPCFileReader *file_reader); http://git-wip-us.apache.org/repos/asf/arrow/blob/16dd8716/c_glib/doc/reference/arrow-glib-docs.sgml ---------------------------------------------------------------------- diff --git a/c_glib/doc/reference/arrow-glib-docs.sgml b/c_glib/doc/reference/arrow-glib-docs.sgml index 9f504be..a732e09 100644 --- a/c_glib/doc/reference/arrow-glib-docs.sgml +++ b/c_glib/doc/reference/arrow-glib-docs.sgml @@ -121,7 +121,7 @@ <title>Input</title> <xi:include href="xml/io-readable.xml"/> <xi:include href="xml/io-input-stream.xml"/> - <xi:include href="xml/io-readable-file.xml"/> + <xi:include href="xml/io-random-access-file.xml"/> </chapter> <chapter id="io-output"> <title>Output</title>