This is an automated email from the ASF dual-hosted git repository. erickguan pushed a commit to branch ruby-binding-io in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/ruby-binding-io by this push: new 4b9deb711 chore(bindings/ruby): use OpenDal as namespace 4b9deb711 is described below commit 4b9deb71153e7b0d75a0c144b62873f187dfed41 Author: Erick Guan <297343+erickg...@users.noreply.github.com> AuthorDate: Fri Aug 29 22:50:05 2025 +0200 chore(bindings/ruby): use OpenDal as namespace --- bindings/ruby/lib/opendal_ruby/entry.rb | 2 +- bindings/ruby/lib/opendal_ruby/io.rb | 2 +- bindings/ruby/lib/opendal_ruby/metadata.rb | 2 +- bindings/ruby/lib/opendal_ruby/operator.rb | 2 +- bindings/ruby/lib/opendal_ruby/operator_info.rb | 2 +- bindings/ruby/src/capability.rs | 2 +- bindings/ruby/src/io.rs | 14 +++++++------- bindings/ruby/src/lib.rs | 2 +- bindings/ruby/src/lister.rs | 4 ++-- bindings/ruby/src/metadata.rs | 2 +- bindings/ruby/src/middlewares.rs | 8 ++++---- bindings/ruby/src/operator.rs | 4 ++-- bindings/ruby/src/operator_info.rs | 2 +- bindings/ruby/test/blocking_op_test.rb | 8 ++++---- bindings/ruby/test/capability_test.rb | 2 +- bindings/ruby/test/io_test.rb | 2 +- bindings/ruby/test/lister_test.rb | 4 ++-- bindings/ruby/test/middlewares_test.rb | 8 ++++---- bindings/ruby/test/operator_info_test.rb | 2 +- 19 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bindings/ruby/lib/opendal_ruby/entry.rb b/bindings/ruby/lib/opendal_ruby/entry.rb index 2bbd91ddb..4c27215b5 100644 --- a/bindings/ruby/lib/opendal_ruby/entry.rb +++ b/bindings/ruby/lib/opendal_ruby/entry.rb @@ -17,7 +17,7 @@ # frozen_string_literal: true -module OpenDAL +module OpenDal class Entry # Returns the canonical data about an entry # @return [Hash] diff --git a/bindings/ruby/lib/opendal_ruby/io.rb b/bindings/ruby/lib/opendal_ruby/io.rb index 279e898b4..5e08ad8bd 100644 --- a/bindings/ruby/lib/opendal_ruby/io.rb +++ b/bindings/ruby/lib/opendal_ruby/io.rb @@ -17,7 +17,7 @@ # frozen_string_literal: true -module OpenDAL +module OpenDal class IO # Reads all lines from the stream into an array. # @raise [EOFError] when the end of the file is reached. diff --git a/bindings/ruby/lib/opendal_ruby/metadata.rb b/bindings/ruby/lib/opendal_ruby/metadata.rb index 1bc576cee..8194f530d 100644 --- a/bindings/ruby/lib/opendal_ruby/metadata.rb +++ b/bindings/ruby/lib/opendal_ruby/metadata.rb @@ -17,7 +17,7 @@ # frozen_string_literal: true -module OpenDAL +module OpenDal class Metadata FILE = "File" DIRECTORY = "Directory" diff --git a/bindings/ruby/lib/opendal_ruby/operator.rb b/bindings/ruby/lib/opendal_ruby/operator.rb index 416ecacf7..5c10fe39e 100644 --- a/bindings/ruby/lib/opendal_ruby/operator.rb +++ b/bindings/ruby/lib/opendal_ruby/operator.rb @@ -17,7 +17,7 @@ # frozen_string_literal: true -module OpenDAL +module OpenDal class Operator # Applies a middleware to the operator. # @param middleware [Middleware] diff --git a/bindings/ruby/lib/opendal_ruby/operator_info.rb b/bindings/ruby/lib/opendal_ruby/operator_info.rb index 8951d9be6..8f81288eb 100644 --- a/bindings/ruby/lib/opendal_ruby/operator_info.rb +++ b/bindings/ruby/lib/opendal_ruby/operator_info.rb @@ -17,7 +17,7 @@ # frozen_string_literal: true -module OpenDAL +module OpenDal class OperatorInfo def inspect "#<#{self.class.name} scheme: \"#{scheme}\", root: \"#{root}\">" diff --git a/bindings/ruby/src/capability.rs b/bindings/ruby/src/capability.rs index accbf1456..0c5fc3424 100644 --- a/bindings/ruby/src/capability.rs +++ b/bindings/ruby/src/capability.rs @@ -44,7 +44,7 @@ macro_rules! bind_methods_to_ruby { /// @yard /// Capability describes OpenDAL supported operations by current Operator. -#[magnus::wrap(class = "OpenDAL::Capability", free_immediately, size)] +#[magnus::wrap(class = "OpenDal::Capability", free_immediately, size)] pub struct Capability(ocore::Capability); impl Capability { diff --git a/bindings/ruby/src/io.rs b/bindings/ruby/src/io.rs index 645cbf6d1..4fad2136f 100644 --- a/bindings/ruby/src/io.rs +++ b/bindings/ruby/src/io.rs @@ -41,7 +41,7 @@ use magnus::Value; use crate::*; -// `Io` is the rust implementation for `OpenDAL::IO`. `Io` follows similar Ruby IO classes, such as: +// `Io` is the rust implementation for `OpenDal::IO`. `Io` follows similar Ruby IO classes, such as: // - IO // - StringIO // @@ -49,14 +49,14 @@ use crate::*; // TODO: implement encoding. // /// @yard -/// `OpenDAL::IO` is similar to Ruby's `IO` and `StringIO` for accessing files. +/// `OpenDal::IO` is similar to Ruby's `IO` and `StringIO` for accessing files. /// -/// You can't create an instance of `OpenDAL::IO` except using {OpenDAL::Operator#open}. +/// You can't create an instance of `OpenDal::IO` except using {OpenDal::Operator#open}. /// /// Constraints: /// - Only available for reading and writing /// - Writing doesn't support seek. -#[magnus::wrap(class = "OpenDAL::IO", free_immediately, size)] +#[magnus::wrap(class = "OpenDal::IO", free_immediately, size)] pub struct Io(RefCell<IoHandle>); enum FileState { @@ -81,7 +81,7 @@ pub fn format_io_error(ruby: &Ruby, err: std::io::Error) -> Error { } impl Io { - /// Creates a new `OpenDAL::IO` object in Ruby. + /// Creates a new `OpenDal::IO` object in Ruby. /// /// See [`Operator::open`] for more information. pub fn new( @@ -432,10 +432,10 @@ impl Io { // - puts } -/// Defines the `OpenDAL::IO` class in the given Ruby module and binds its methods. +/// Defines the `OpenDal::IO` class in the given Ruby module and binds its methods. /// /// This function uses Magnus's built-in Ruby thread-safety features to define the -/// `OpenDAL::IO` class and its methods in the provided Ruby module (`gem_module`). +/// `OpenDal::IO` class and its methods in the provided Ruby module (`gem_module`). /// /// # Ruby Object Lifetime and Safety /// diff --git a/bindings/ruby/src/lib.rs b/bindings/ruby/src/lib.rs index e38006209..f1783c54a 100644 --- a/bindings/ruby/src/lib.rs +++ b/bindings/ruby/src/lib.rs @@ -47,7 +47,7 @@ pub fn format_magnus_error(ruby: &Ruby, err: ocore::Error) -> Error { /// Apache OpenDALâ„¢ Ruby binding #[magnus::init] fn init(ruby: &Ruby) -> Result<(), Error> { - let gem_module = ruby.define_module("OpenDAL")?; + let gem_module = ruby.define_module("OpenDal")?; let _ = operator::include(ruby, &gem_module); let _ = metadata::include(ruby, &gem_module); let _ = capability::include(ruby, &gem_module); diff --git a/bindings/ruby/src/lister.rs b/bindings/ruby/src/lister.rs index fab413bdc..18b6c824e 100644 --- a/bindings/ruby/src/lister.rs +++ b/bindings/ruby/src/lister.rs @@ -38,7 +38,7 @@ use crate::*; /// @yard /// Entry returned by Lister to represent a path and it's relative metadata. -#[magnus::wrap(class = "OpenDAL::Entry", free_immediately, size)] +#[magnus::wrap(class = "OpenDal::Entry", free_immediately, size)] pub struct Entry(ocore::Entry); impl Entry { @@ -83,7 +83,7 @@ impl Entry { /// # Safety /// /// `Lister` is thread-safe. -#[magnus::wrap(class = "OpenDAL::Lister", free_immediately, size)] +#[magnus::wrap(class = "OpenDal::Lister", free_immediately, size)] pub struct Lister(Arc<Mutex<ocore::blocking::Lister>>); impl Iterator for Lister { diff --git a/bindings/ruby/src/metadata.rs b/bindings/ruby/src/metadata.rs index 073fad77a..ef07d5c73 100644 --- a/bindings/ruby/src/metadata.rs +++ b/bindings/ruby/src/metadata.rs @@ -31,7 +31,7 @@ use crate::*; /// @yard /// Metadata about the file. -#[magnus::wrap(class = "OpenDAL::Metadata", free_immediately, size)] +#[magnus::wrap(class = "OpenDal::Metadata", free_immediately, size)] pub struct Metadata(ocore::Metadata); impl Metadata { diff --git a/bindings/ruby/src/middlewares.rs b/bindings/ruby/src/middlewares.rs index 0e5c14499..e6f194db7 100644 --- a/bindings/ruby/src/middlewares.rs +++ b/bindings/ruby/src/middlewares.rs @@ -64,7 +64,7 @@ where /// Adds retry for temporary failed operations. /// /// See [`opendal::layers::RetryLayer`] for more information. -#[magnus::wrap(class = "OpenDAL::RetryMiddleware")] +#[magnus::wrap(class = "OpenDal::RetryMiddleware")] struct RetryMiddleware(Arc<Mutex<ocore::layers::RetryLayer>>); impl RetryMiddleware { @@ -81,7 +81,7 @@ impl RetryMiddleware { /// Adds concurrent request limit. /// /// See [`opendal::layers::ConcurrentLimitLayer`] for more information. -#[magnus::wrap(class = "OpenDAL::ConcurrentLimitMiddleware")] +#[magnus::wrap(class = "OpenDal::ConcurrentLimitMiddleware")] struct ConcurrentLimitMiddleware(Arc<Mutex<ocore::layers::ConcurrentLimitLayer>>); impl ConcurrentLimitMiddleware { @@ -100,7 +100,7 @@ impl ConcurrentLimitMiddleware { /// Adds a bandwidth rate limiter to the underlying services. /// /// See [`opendal::layers::ThrottleLayer`] for more information. -#[magnus::wrap(class = "OpenDAL::ThrottleMiddleware")] +#[magnus::wrap(class = "OpenDal::ThrottleMiddleware")] struct ThrottleMiddleware(Arc<Mutex<ocore::layers::ThrottleLayer>>); impl ThrottleMiddleware { @@ -128,7 +128,7 @@ fn parse_duration(ruby: &Ruby, val: f64) -> Result<Duration, Error> { /// Adds timeout for every operation to avoid slow or unexpected hang operations. /// /// See [`opendal::layers::TimeoutLayer`] for more information. -#[magnus::wrap(class = "OpenDAL::TimeoutMiddleware")] +#[magnus::wrap(class = "OpenDal::TimeoutMiddleware")] struct TimeoutMiddleware(Arc<Mutex<ocore::layers::TimeoutLayer>>); impl TimeoutMiddleware { diff --git a/bindings/ruby/src/operator.rs b/bindings/ruby/src/operator.rs index 0709a4e36..99ed7e095 100644 --- a/bindings/ruby/src/operator.rs +++ b/bindings/ruby/src/operator.rs @@ -45,7 +45,7 @@ use crate::*; /// @yard /// The entrypoint for operating with file services and files. -#[magnus::wrap(class = "OpenDAL::Operator", free_immediately, size)] +#[magnus::wrap(class = "OpenDal::Operator", free_immediately, size)] pub struct Operator { // We keep a reference to an `Operator` because: // 1. Some builder functions exist only with the `Operator` struct. @@ -232,7 +232,7 @@ impl Operator { /// @param path [String] file path /// @param mode [String] operation mode, e.g., `r`, `w`, or `rb`. /// @raise [ArgumentError] invalid mode, or when the mode is not unique - /// @return [OpenDAL::IO] + /// @return [OpenDal::IO] fn open(ruby: &Ruby, rb_self: &Self, args: &[Value]) -> Result<Io, Error> { let args = scan_args::<(String,), (Option<Value>, Option<Value>), (), (), RHash, ()>(args)?; let (path,) = args.required; diff --git a/bindings/ruby/src/operator_info.rs b/bindings/ruby/src/operator_info.rs index 1fa40db02..d767e72ef 100644 --- a/bindings/ruby/src/operator_info.rs +++ b/bindings/ruby/src/operator_info.rs @@ -29,7 +29,7 @@ use crate::capability::Capability; use crate::*; /// Metadata for operator, users can use this metadata to get information of operator. -#[magnus::wrap(class = "OpenDAL::OperatorInfo", free_immediately, size)] +#[magnus::wrap(class = "OpenDal::OperatorInfo", free_immediately, size)] pub struct OperatorInfo(pub ocore::OperatorInfo); impl OperatorInfo { diff --git a/bindings/ruby/test/blocking_op_test.rb b/bindings/ruby/test/blocking_op_test.rb index f0c1d71d2..846dd9acd 100644 --- a/bindings/ruby/test/blocking_op_test.rb +++ b/bindings/ruby/test/blocking_op_test.rb @@ -24,7 +24,7 @@ class OpenDalTest < ActiveSupport::TestCase setup do @root = Dir.mktmpdir File.write("#{@root}/sample", "Sample data for testing") - @op = OpenDAL::Operator.new("fs", {"root" => @root}) + @op = OpenDal::Operator.new("fs", {"root" => @root}) end teardown do @@ -53,7 +53,7 @@ class OpenDalTest < ActiveSupport::TestCase test "stat returns file metadata" do stat = @op.stat("sample") - assert stat.is_a?(OpenDAL::Metadata) + assert stat.is_a?(OpenDal::Metadata) assert_equal 23, stat.content_length assert stat.file? end @@ -105,8 +105,8 @@ class OpenDalTest < ActiveSupport::TestCase end test "middleware applies a middleware" do - @op.middleware(OpenDAL::RetryMiddleware.new) + @op.middleware(OpenDal::RetryMiddleware.new) - assert @op.is_a?(OpenDAL::Operator) + assert @op.is_a?(OpenDal::Operator) end end diff --git a/bindings/ruby/test/capability_test.rb b/bindings/ruby/test/capability_test.rb index f1bf43fe4..19a5ddddc 100644 --- a/bindings/ruby/test/capability_test.rb +++ b/bindings/ruby/test/capability_test.rb @@ -21,7 +21,7 @@ require "test_helper" class CapabilityTest < ActiveSupport::TestCase setup do - @op = OpenDAL::Operator.new("memory", nil) + @op = OpenDal::Operator.new("memory", nil) end test "has read capability" do diff --git a/bindings/ruby/test/io_test.rb b/bindings/ruby/test/io_test.rb index 851fa5726..b7bd15c98 100644 --- a/bindings/ruby/test/io_test.rb +++ b/bindings/ruby/test/io_test.rb @@ -30,7 +30,7 @@ class IOTest < ActiveSupport::TestCase A line after title EOF ) - @op = OpenDAL::Operator.new("fs", {"root" => @root}) + @op = OpenDal::Operator.new("fs", {"root" => @root}) @io_read = @op.open("sample", "r") @io_write = @op.open("sample_write", "w") end diff --git a/bindings/ruby/test/lister_test.rb b/bindings/ruby/test/lister_test.rb index fbac53772..bfeb043f5 100644 --- a/bindings/ruby/test/lister_test.rb +++ b/bindings/ruby/test/lister_test.rb @@ -26,7 +26,7 @@ class ListerTest < ActiveSupport::TestCase File.write("#{@root}/sample", "Sample data for testing") Dir.mkdir("#{@root}/sub") File.write("#{@root}/sub/sample", "Sample data for testing") - @op = OpenDAL::Operator.new("fs", {"root" => @root}) + @op = OpenDal::Operator.new("fs", {"root" => @root}) end test "lists the directory" do @@ -40,7 +40,7 @@ class ListerTest < ActiveSupport::TestCase test "list returns the entry" do entry = @op.list("/").first - assert entry.is_a?(OpenDAL::Entry) + assert entry.is_a?(OpenDal::Entry) assert entry.name.length > 0 end diff --git a/bindings/ruby/test/middlewares_test.rb b/bindings/ruby/test/middlewares_test.rb index bf239819e..8ab90748a 100644 --- a/bindings/ruby/test/middlewares_test.rb +++ b/bindings/ruby/test/middlewares_test.rb @@ -22,25 +22,25 @@ require "test_helper" class MiddlewaresTest < ActiveSupport::TestCase test "builds a retry middleware" do assert_nothing_raised do - OpenDAL::RetryMiddleware.new + OpenDal::RetryMiddleware.new end end test "builds a concurrent limit middleware" do assert_nothing_raised do - OpenDAL::ConcurrentLimitMiddleware.new(10) + OpenDal::ConcurrentLimitMiddleware.new(10) end end test "builds a throttle middleware" do assert_nothing_raised do - OpenDAL::ThrottleMiddleware.new(100, 10) + OpenDal::ThrottleMiddleware.new(100, 10) end end test "builds a timeout middleware" do assert_nothing_raised do - OpenDAL::TimeoutMiddleware.new(1.23, 1.0) + OpenDal::TimeoutMiddleware.new(1.23, 1.0) end end end diff --git a/bindings/ruby/test/operator_info_test.rb b/bindings/ruby/test/operator_info_test.rb index c22a22741..b287b4753 100644 --- a/bindings/ruby/test/operator_info_test.rb +++ b/bindings/ruby/test/operator_info_test.rb @@ -21,7 +21,7 @@ require "test_helper" class OperatorInfoTest < ActiveSupport::TestCase setup do - @op = OpenDAL::Operator.new("memory", {}) + @op = OpenDal::Operator.new("memory", {}) end test "returns meta information" do