Skip to content
This repository was archived by the owner on Mar 11, 2023. It is now read-only.

GNOM/persistence Unknown Types and error handling #5

Open
Override-6 opened this issue Oct 8, 2021 · 0 comments
Open

GNOM/persistence Unknown Types and error handling #5

Override-6 opened this issue Oct 8, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Override-6
Copy link
Owner

Override-6 commented Oct 8, 2021

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
}
@Override-6 Override-6 added the enhancement New feature or request label Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant