-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Scala 3 #534
Merged
Merged
Upgrade to Scala 3 #534
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
5b2cc2e
build.sbt and fmt migrated
Ragge-dev 59873c2
migrated zio-actors
Ragge-dev 1a5cbbd
migrated zio-persistence
Ragge-dev 9933ac8
migrated persistence-jdbc
Ragge-dev ce8c66c
migrated akka-interop
Ragge-dev 83b21c8
migrated-examples
Ragge-dev 55ba7e4
removed empty test file
Ragge-dev 94e26bb
generated new docs
Ragge-dev 1f50136
remove most workflows
Ragge-dev bddd5c5
Merge branch 'master' into scala3-migration
Ragge-dev 32ebf0c
Revert "remove most workflows"
Ragge-dev 182b407
Revert "generated new docs"
Ragge-dev 0318445
reverted ! interface
Ragge-dev fadb90e
private val inte BuildHelper
Ragge-dev 3f688d6
fix docs
Ragge-dev b0641e2
more docs warnings fixed
Ragge-dev ed79221
Fixes from compiler-flags, unused private functions
Ragge-dev 84fbe01
updated README
Ragge-dev 56bc515
type warnings fixed
Ragge-dev ad583aa
Fixed serialization....
Ragge-dev 4600139
Separate classes
Ragge-dev 520b7de
scala-2 folder
Ragge-dev 775bdf4
Add annotation for overridden Serialization method
Ragge-dev 214480b
formatting
Ragge-dev e0a9d0d
Get all versions to play together
Ragge-dev 62a8bcd
formatting
Ragge-dev 59bf563
genereted docs/README
Ragge-dev a91cc04
Added Scala 3.3.1 as CI build
Ragge-dev 1fc75f3
Add docs again to build
Ragge-dev 6ec9c49
formatting in scala-3 folder
Ragge-dev 1c6bb31
fix packages
Ragge-dev 2330daf
simplify
Ragge-dev 6ccbb0d
Break out as much common logic as possible
Ragge-dev 66c8473
only use refActorMap in ActorSystem, and change name to be consistent
Ragge-dev 17fd149
Helped scala 2.12 compiler
Ragge-dev b8dea2d
formating
Ragge-dev c360a1b
BaseActorSystem private
Ragge-dev b4ae21a
Fix docs not compiling
Ragge-dev ddbd16d
Break out logic for Context class
Ragge-dev ac4f75a
README finds version
Ragge-dev d3810eb
fix website-workflow import error
Ragge-dev e27c89b
sbt publishLocal fails. Reverted imports to ._
Ragge-dev 5ca9e51
removed unused file
Ragge-dev fc851f2
Removed more scala 3 syntax
Ragge-dev 22d04ea
bit sloppy, reverted more imports and wildcards
Ragge-dev 985201a
remove xSource3 flag for scala2.12
Ragge-dev cced3f2
Manges to move all business logic to BaseActorSystem
Ragge-dev 573f17d
reverted akka upgrade
Ragazoor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
version = "2.6.3" | ||
version = "3.7.15" | ||
maxColumn = 120 | ||
align = most | ||
align.preset = most | ||
continuationIndent.defnSite = 2 | ||
docstrings.style = Asterisk | ||
assumeStandardLibraryStripMargin = true | ||
docstrings = JavaDoc | ||
lineEndings = preserve | ||
includeCurlyBraceInSelectChains = false | ||
danglingParentheses = true | ||
danglingParentheses.preset = true | ||
spaces { | ||
inImportCurlyBraces = true | ||
} | ||
optIn.annotationNewlines = true | ||
|
||
rewrite.rules = [SortImports, RedundantBraces] | ||
runner.dialect = scala3 |
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,75 @@ | ||
package zio.actors | ||
|
||
import zio.actors.ActorSystemUtils._ | ||
import zio.actors.ActorsConfig._ | ||
import zio.{ Ref, Task, UIO, ZIO } | ||
|
||
import java.io._ | ||
|
||
/** | ||
* Object providing constructor for Actor System with optional remoting module. | ||
*/ | ||
object ActorSystem { | ||
|
||
/** | ||
* Constructor for Actor System | ||
* | ||
* @param sysName | ||
* \- Identifier for Actor System | ||
* @param configFile | ||
* \- Optional configuration for a remoting internal module. If not provided the actor system will only handle local | ||
* actors in terms of actor selection. When provided - remote messaging and remote actor selection is possible | ||
* @return | ||
* instantiated actor system | ||
*/ | ||
def apply(sysName: String, configFile: Option[File] = None): Task[ActorSystem] = | ||
for { | ||
initActorRefMap <- Ref.make(Map.empty[String, Actor[Any]]) | ||
config <- retrieveConfig(configFile) | ||
remoteConfig <- retrieveRemoteConfig(sysName, config) | ||
actorSystem <- ZIO.attempt(new ActorSystem(sysName, config, remoteConfig, initActorRefMap, parentActor = None)) | ||
_ <- ZIO | ||
.succeed(remoteConfig) | ||
.flatMap(_.fold[Task[Unit]](ZIO.unit)(c => actorSystem.receiveLoop(c.addr, c.port))) | ||
} yield actorSystem | ||
} | ||
|
||
/** | ||
* Type representing running instance of actor system provisioning actor herding, remoting and actor creation and | ||
* selection. | ||
*/ | ||
final class ActorSystem private[actors] ( | ||
override private[actors] val actorSystemName: String, | ||
override private[actors] val config: Option[String], | ||
private val remoteConfig: Option[RemoteConfig], | ||
private val initActorRefMap: Ref[Map[String, Actor[Any]]], | ||
private val parentActor: Option[String] | ||
) extends BaseActorSystem(actorSystemName, config, remoteConfig, parentActor) { | ||
|
||
override private[actors] def refActorMap[F[+_]]: Ref[Map[String, Actor[F]]] = | ||
initActorRefMap.asInstanceOf[Ref[Map[String, Actor[F]]]] | ||
|
||
override private[actors] def newActorSystem[F[+_]]( | ||
actorSystemName: String, | ||
config: Option[String], | ||
remoteConfig: Option[RemoteConfig], | ||
refActorMap: Ref[Map[String, Actor[F]]], | ||
parentActor: Option[String] | ||
): ActorSystem = | ||
new ActorSystem( | ||
actorSystemName, | ||
config, | ||
remoteConfig, | ||
refActorMap.asInstanceOf[Ref[Map[String, Actor[Any]]]], | ||
parentActor | ||
) | ||
|
||
override private[actors] def newChildrenRefSet[F[+_]]: UIO[Ref[Set[ActorRef[F]]]] = | ||
Ref.make(Set.empty[ActorRef[F]]) | ||
|
||
override private[actors] def newContext[F[+_]]( | ||
path: String, | ||
derivedSystem: ActorSystem, | ||
childrenSet: Ref[Set[ActorRef[F]]] | ||
): Context = new Context(path, derivedSystem, childrenSet.asInstanceOf[Ref[Set[ActorRef[Any]]]]) | ||
} |
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 @@ | ||
package zio.actors | ||
|
||
import zio.Ref | ||
|
||
/** | ||
* Context for actor used inside Stateful which provides self actor reference and actor creation/selection API | ||
*/ | ||
final class Context private[actors] ( | ||
private val path: String, | ||
private val actorSystem: ActorSystem, | ||
private val initChildrenRef: Ref[Set[ActorRef[Any]]] | ||
) extends BaseContext(path, actorSystem) { | ||
|
||
private[actors] def childrenRef[F[+_]]: Ref[Set[ActorRef[F]]] = initChildrenRef.asInstanceOf[Ref[Set[ActorRef[F]]]] | ||
|
||
} |
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,76 @@ | ||
package zio.actors | ||
|
||
import zio.actors.ActorSystemUtils.* | ||
import zio.actors.ActorsConfig.* | ||
import zio.{ Ref, Task, UIO, ZIO } | ||
|
||
import java.io.* | ||
|
||
/** | ||
* Object providing constructor for Actor System with optional remoting module. | ||
*/ | ||
object ActorSystem { | ||
|
||
/** | ||
* Constructor for Actor System | ||
* | ||
* @param sysName | ||
* \- Identifier for Actor System | ||
* @param configFile | ||
* \- Optional configuration for a remoting internal module. If not provided the actor system will only handle local | ||
* actors in terms of actor selection. When provided - remote messaging and remote actor selection is possible | ||
* @return | ||
* instantiated actor system | ||
*/ | ||
def apply(sysName: String, configFile: Option[File] = None): Task[ActorSystem] = | ||
for { | ||
initActorRefMap <- Ref.make(Map.empty[String, Actor[?]]) | ||
config <- retrieveConfig(configFile) | ||
remoteConfig <- retrieveRemoteConfig(sysName, config) | ||
actorSystem <- ZIO.attempt(new ActorSystem(sysName, config, remoteConfig, initActorRefMap, parentActor = None)) | ||
_ <- ZIO | ||
.succeed(remoteConfig) | ||
.flatMap(_.fold[Task[Unit]](ZIO.unit)(c => actorSystem.receiveLoop(c.addr, c.port))) | ||
} yield actorSystem | ||
} | ||
|
||
/** | ||
* Type representing running instance of actor system provisioning actor herding, remoting and actor creation and | ||
* selection. | ||
*/ | ||
final class ActorSystem private[actors] ( | ||
override private[actors] val actorSystemName: String, | ||
override private[actors] val config: Option[String], | ||
private val remoteConfig: Option[RemoteConfig], | ||
private val initActorRefMap: Ref[Map[String, Actor[?]]], | ||
private val parentActor: Option[String] | ||
) extends BaseActorSystem(actorSystemName, config, remoteConfig, parentActor) { | ||
|
||
override private[actors] def refActorMap[F[+_]]: Ref[Map[String, Actor[F]]] = | ||
initActorRefMap.asInstanceOf[Ref[Map[String, Actor[F]]]] | ||
|
||
override private[actors] def newActorSystem[F[+_]]( | ||
actorSystemName: String, | ||
config: Option[String], | ||
remoteConfig: Option[RemoteConfig], | ||
refActorMap: Ref[Map[String, Actor[F]]], | ||
parentActor: Option[String] | ||
): ActorSystem = | ||
new ActorSystem( | ||
actorSystemName, | ||
config, | ||
remoteConfig, | ||
refActorMap.asInstanceOf[Ref[Map[String, Actor[?]]]], | ||
parentActor | ||
) | ||
|
||
override private[actors] def newChildrenRefSet[F[+_]]: UIO[Ref[Set[ActorRef[F]]]] = | ||
Ref.make(Set.empty[ActorRef[F]]) | ||
|
||
override private[actors] def newContext[F[+_]]( | ||
path: String, | ||
derivedSystem: ActorSystem, | ||
childrenSet: Ref[Set[ActorRef[F]]] | ||
): Context = new Context(path, derivedSystem, childrenSet.asInstanceOf[Ref[Set[ActorRef[?]]]]) | ||
|
||
} |
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 @@ | ||
package zio.actors | ||
|
||
import zio.Ref | ||
|
||
/** | ||
* Context for actor used inside Stateful which provides self actor reference and actor creation/selection API | ||
*/ | ||
final class Context private[actors] ( | ||
private val path: String, | ||
private val actorSystem: ActorSystem, | ||
private val initChildrenRef: Ref[Set[ActorRef[?]]] | ||
) extends BaseContext(path, actorSystem) { | ||
|
||
override private[actors] def childrenRef[F[+_]]: Ref[Set[ActorRef[F]]] = | ||
initChildrenRef.asInstanceOf[Ref[Set[ActorRef[F]]]] | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I see it correctly the only version-specific difference is
Actor[Any]
vsActor[?]
here. Is Scala 2 not compiling with?
(or_
?)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct, I have made a few attempts on scala 2.13 but haven't been able to make it work... Get errors like:
I have also tried to make scala 3 compile with
Actor[Any]
but get errors like: