Open PawelLipski opened 3 years ago
Huh okay, before you start further work here (as the effort/benefit ratio might not be the best for this issue)...
"candidates" for types that might be used
By used, you mean that you would detect all the types that extend any of these types and consider them to be persisted types whose schemas needs to be dumped? 🤔 Best if you could provide some small sandbox-like example here of a class and its corresponding dump in the comments
By used, you mean that you would detect all the types that extend any of these types and consider them to be persisted types whose schemas needs to be dumped?
No, current logic for typed "candidates" (genericsNames
- fqcns for typed):
val foundUsedClasses: List[(Type, Position)] = body.collect {
case x: TypeTree if genericsNames.contains(x.tpe.dealias.typeSymbol.fullName) =>
x.tpe.typeArgs.takeRight(2).map((_, x.pos))
}.flatten
So - from current source file we collect all usages of types from genericsNames
. And these usages mean that in this place we persist some Events / States.
My idea is to find "candidates" (fqcns) for akka classic - types that can be used to persist Events / States. It would be nice to find a repo that still uses akka classic for persistence to check, which types from classic are in fact used to do this.
Current solution for akka-typed:
Is based on code occurences of
Event
andState
type parameters (where "Event" and "State" are not real existing types but just meaningful names) - that's how these four types were chosen. That's how we know that these particular types fromakka-persistence-typed
are releated to persistent events and states.In case of akka-classic - we cannot do a similar thing - as "State" and "Event" keywords are not used as type parameters. In fact, if there are type parameters - there are two options:
A
is called "event: A" - so in these cases it looks obvious) or[Persistence]
is usedSo, from a quick research on the
akka-persistence
(classic) code base, here are my "candidates" for types that might be used:However, this is not a full list and research is not completed. @PawelLipski - what is your opinion on this? Or maybe you have some better idea?