futureverse / marshal

[PROTOTYPE] R package: marshal - Framework to Marshal Objects to be Used in Another R Processes
https://marshal.futureverse.org/
Other
15 stars 1 forks source link

Package 'marshal': serialize objects #1

Closed HenrikBengtsson closed 3 years ago

HenrikBengtsson commented 3 years ago

https://en.m.wikipedia.org/wiki/Marshalling_(computer_science)

This package should provide an API for serializing and un-serializing R objects.

It should use S3 generic functions so it can be extended and customized downstream.

It could also have plug-in support for different types of serialization protocols.

Marshalling and de-marshalling comes before serialization.

The API should also provide methods that compared objects to known accept and reject lists. It sounds be possible to update these lists too.

This package should also provide methods to scan for references such as external pointers.

HenrikBengtsson commented 3 years ago

raw <- marshal(x)
y <- demarshal(raw)
HenrikBengtsson commented 3 years ago

NonMarshableCondition:

HenrikBengtsson commented 3 years ago

Use an R connection object as an initial use case;

str(con)
## Classes 'file', 'connection'  atomic [1:1] 3
##   ..- attr(*, "conn_id")=<externalptr> 
register_non_exportable(function(obj) {
  NonExportable("A connection cannot be exported to another R process", object = obj)
}, inherits = c("connection"), atomic=TRUE, externalptr = TRUE)