-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d1280d
commit a10a132
Showing
14 changed files
with
108 additions
and
45 deletions.
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
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
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,26 @@ | ||
package vivid | ||
|
||
// ActorOfO 该接口用于根据 ActorOptions 创建 Actor 并返回 ActorRef | ||
// - 接口用于内部实现,外部无法直接实现 | ||
type ActorOfO interface { | ||
generate(of ActorOwner) ActorRef | ||
} | ||
|
||
type actorOfO[T Actor] struct { | ||
options []func(actorOptions *ActorOptions[T]) | ||
} | ||
|
||
func (o *actorOfO[T]) generate(of ActorOwner) ActorRef { | ||
var opts = new(ActorOptions[T]) | ||
for _, opt := range o.options { | ||
opt(opts) | ||
} | ||
return ActorOf(of, opts) | ||
} | ||
|
||
// OfO 创建一个 ActorOfO 对象 | ||
func OfO[T Actor](options ...func(actorOptions *ActorOptions[T])) ActorOfO { | ||
return &actorOfO[T]{ | ||
options: options, | ||
} | ||
} |
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,10 @@ | ||
package vivid | ||
|
||
// ActorOwner 提供了作为合格 Actor 所有者的接口定义 | ||
type ActorOwner interface { | ||
// GetSystem 获取 Actor 所属的 ActorSystem | ||
GetSystem() *ActorSystem | ||
|
||
// GetContext 获取 Actor 上下文 | ||
GetContext() ActorContext | ||
} |
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 |
---|---|---|
|
@@ -125,7 +125,6 @@ func (f *FIFO) reset() { | |
f.Stop() | ||
} else { | ||
f.cond.L.Unlock() | ||
return | ||
} | ||
|
||
f.cond.L.Lock() | ||
|
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