-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve robustness of
ObjectRef
ownership info serialization (#203)
* Handle null-terminated ObjectRef fields * Move debug logic into `@debug` block * Earlier serialization debug message * Use safe_convert * Safe convert for object status * Drop special case for `isempty(owner_address_json)` * Support `==` for `Address` * Refactor `==` for `ObjectID` * Always return an `Address` with `owner_address` property * Update test to avoid using internal field * Store serialized owner address instead of JSON * Move `safe_convert` to `ray_julia_jll` * Support Julia serialization of `Address` * Support Julia serialization of `Message` * Support `==` for `Message` subtypes * Use `Address` serialization * Remove empty line * Add deepcopy test for owner_address
- Loading branch information
Showing
11 changed files
with
137 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Using `collect` and `ncodeunits` to ensure that the entire string is captured and not just | ||
# up to the first null character: https://github.com/JuliaInterop/CxxWrap.jl/pull/378 | ||
safe_convert(::Type{String}, str::StdString) = String(Vector{UInt8}(collect(str))) | ||
safe_convert(::Type{StdString}, str::String) = StdString(str, ncodeunits(str)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@testset "safe_convert" begin | ||
expected = "¿\0ÿ" | ||
cpp_expected = "¿\0ÿ" | ||
|
||
std_str = Ray.safe_convert(StdString, expected) | ||
@test length(std_str) == length(cpp_expected) | ||
@test collect(std_str) == collect(cpp_expected) | ||
@test ncodeunits(std_str) == ncodeunits(expected) | ||
@test codeunits(std_str) == codeunits(expected) | ||
|
||
str = Ray.safe_convert(String, std_str) | ||
@test length(str) == length(expected) | ||
@test collect(str) == collect(expected) | ||
@test ncodeunits(str) == ncodeunits(expected) | ||
@test codeunits(str) == codeunits(expected) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters