deltalake-rb 0.2.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Cargo.lock +700 -384
- data/ext/deltalake/Cargo.toml +7 -6
- data/ext/deltalake/src/error.rs +11 -22
- data/ext/deltalake/src/lib.rs +581 -346
- data/ext/deltalake/src/ruby.rs +74 -0
- data/ext/deltalake/src/schema.rs +1 -0
- data/lib/deltalake/version.rb +1 -1
- metadata +4 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
use std::borrow::Cow;
|
|
2
|
+
use std::ffi::c_void;
|
|
3
|
+
use std::ptr::null_mut;
|
|
4
|
+
|
|
5
|
+
use magnus::{Error as RbErr, Ruby};
|
|
6
|
+
use rb_sys::rb_thread_call_without_gvl;
|
|
7
|
+
|
|
8
|
+
pub trait GvlExt {
|
|
9
|
+
fn detach<T, F>(&self, func: F) -> T
|
|
10
|
+
where
|
|
11
|
+
F: Send + FnOnce() -> T,
|
|
12
|
+
T: Send;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
impl GvlExt for Ruby {
|
|
16
|
+
fn detach<T, F>(&self, func: F) -> T
|
|
17
|
+
where
|
|
18
|
+
F: Send + FnOnce() -> T,
|
|
19
|
+
T: Send,
|
|
20
|
+
{
|
|
21
|
+
let mut data = CallbackData {
|
|
22
|
+
func: Some(func),
|
|
23
|
+
result: None,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
unsafe {
|
|
27
|
+
rb_thread_call_without_gvl(
|
|
28
|
+
Some(call_without_gvl::<F, T>),
|
|
29
|
+
&mut data as *mut _ as *mut c_void,
|
|
30
|
+
None,
|
|
31
|
+
null_mut(),
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
data.result.unwrap()
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
struct CallbackData<F, T> {
|
|
40
|
+
func: Option<F>,
|
|
41
|
+
result: Option<T>,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
extern "C" fn call_without_gvl<F, T>(data: *mut c_void) -> *mut c_void
|
|
45
|
+
where
|
|
46
|
+
F: FnOnce() -> T,
|
|
47
|
+
{
|
|
48
|
+
let data = unsafe { &mut *(data as *mut CallbackData<F, T>) };
|
|
49
|
+
let func = data.func.take().unwrap();
|
|
50
|
+
data.result = Some(func());
|
|
51
|
+
null_mut()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
macro_rules! create_builtin_exception {
|
|
55
|
+
($type:ident, $method:ident) => {
|
|
56
|
+
pub struct $type {}
|
|
57
|
+
|
|
58
|
+
impl $type {
|
|
59
|
+
pub fn new_err<T>(message: T) -> RbErr
|
|
60
|
+
where
|
|
61
|
+
T: Into<Cow<'static, str>>,
|
|
62
|
+
{
|
|
63
|
+
let ruby = Ruby::get().unwrap();
|
|
64
|
+
RbErr::new(ruby.$method(), message)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
create_builtin_exception!(RbException, exception_runtime_error);
|
|
71
|
+
create_builtin_exception!(RbIOError, exception_io_error);
|
|
72
|
+
create_builtin_exception!(RbNotImplementedError, exception_not_imp_error);
|
|
73
|
+
create_builtin_exception!(RbRuntimeError, exception_runtime_error);
|
|
74
|
+
create_builtin_exception!(RbValueError, exception_arg_error);
|
data/ext/deltalake/src/schema.rs
CHANGED
data/lib/deltalake/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: deltalake-rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -40,6 +40,7 @@ files:
|
|
|
40
40
|
- ext/deltalake/src/features.rs
|
|
41
41
|
- ext/deltalake/src/lib.rs
|
|
42
42
|
- ext/deltalake/src/merge.rs
|
|
43
|
+
- ext/deltalake/src/ruby.rs
|
|
43
44
|
- ext/deltalake/src/schema.rs
|
|
44
45
|
- ext/deltalake/src/utils.rs
|
|
45
46
|
- lib/deltalake-rb.rb
|
|
@@ -64,14 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
64
65
|
requirements:
|
|
65
66
|
- - ">="
|
|
66
67
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '3.
|
|
68
|
+
version: '3.3'
|
|
68
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
70
|
requirements:
|
|
70
71
|
- - ">="
|
|
71
72
|
- !ruby/object:Gem::Version
|
|
72
73
|
version: '0'
|
|
73
74
|
requirements: []
|
|
74
|
-
rubygems_version: 4.0.
|
|
75
|
+
rubygems_version: 4.0.10
|
|
75
76
|
specification_version: 4
|
|
76
77
|
summary: Delta Lake for Ruby
|
|
77
78
|
test_files: []
|