This repository was archived by the owner on Mar 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Mar 11, 2023. It is now read-only.
GNOM/persistence Unknown Types and error handling #5
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Be able to configure in the PersistenceConfig
how different error or situation occurred during an object serialisation or deserialization should be handled
Goals
- Enhance the flexibility of the program
- Enhance the user's control over security
- Help the user to write an application that can communicate with applications of another version.
Motivations
The feature can be very interesting for runtime-added classes (Java modules, plugins) or for engines that runs an application
with different versions (ex: Server/Client).
Classes that does not exists on the current engine
If an engine receives a packet that contains
val config = new PersistenceConfigBuilder {
on unknownType "org.myapp.component.*" λ (tpe, remote) => null //null will be used instead
on unknownType "org.myapp.player.*" λ (tpe, remote) => UnknownObject(args) //UnknownObject alternative will be used instead
on unknownImplementation[MyInterface] λ (tpe, remote) => StubImplementation(args) //use a custom alternative
on unknownTypePersistence "org.myapp.component.*" λ (tpe, args, remote) => remote.askPersistence[UnsafeTypePersistence] //We will ask to the sender if it can send a version of the serialised object, serialised with an UnsafeTypePersistence
on failedObjectPersistence "org.myapp.*" λ (tpe, args, failure, remote) => throw failure.exception //throw the catched exception
on reference[TrafficReference] containedIn[ContainerObject] λ (obj, remote) => new Alternative() //all network objects referenced by a TrafficReference that are contained in any objects of type `ContainerObject` are to be replaced by an alternative
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request