-
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
5196791
commit 9d1280d
Showing
12 changed files
with
310 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package logger | ||
|
||
import ( | ||
"github.com/kercylan98/minotaur/minotaur/vivid" | ||
"github.com/kercylan98/minotaur/toolkit/log" | ||
) | ||
|
||
type Actor struct { | ||
*log.Logger | ||
} | ||
|
||
func (a *Actor) OnReceive(ctx vivid.MessageContext) { | ||
|
||
} |
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,22 +1,49 @@ | ||
package minotaur | ||
|
||
import "github.com/kercylan98/minotaur/minotaur/transport" | ||
import ( | ||
"github.com/kercylan98/minotaur/minotaur/transport" | ||
) | ||
|
||
type Option func(*Options) | ||
|
||
type Options struct { | ||
Network transport.Network // 网络 | ||
ActorSystemName string // Actor 系统名称 | ||
EventBusActorName string // 事件总线 Actor 名称 | ||
Network transport.Network // 网络 | ||
} | ||
|
||
// defaultApply 设置缺省值 | ||
func (o *Options) defaultApply() *Options { | ||
if o.ActorSystemName == "" { | ||
o.ActorSystemName = "minotaur" | ||
} | ||
if o.EventBusActorName == "" { | ||
o.EventBusActorName = "event_bus" | ||
} | ||
return o | ||
} | ||
|
||
func (o *Options) apply(options ...Option) *Options { | ||
for _, option := range options { | ||
option(o) | ||
} | ||
return o | ||
return o.defaultApply() | ||
} | ||
|
||
func WithNetwork(network transport.Network) Option { | ||
return func(o *Options) { | ||
o.Network = network | ||
} | ||
} | ||
|
||
func WithActorSystemName(name string) Option { | ||
return func(o *Options) { | ||
o.ActorSystemName = name | ||
} | ||
} | ||
|
||
func WithEventBusActorName(name string) Option { | ||
return func(o *Options) { | ||
o.EventBusActorName = name | ||
} | ||
} |
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 |
---|---|---|
@@ -1,17 +1 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
vivid "github.com/kercylan98/minotaur/vivid" | ||
) | ||
|
||
type TestFreeActor struct { | ||
name string | ||
} | ||
|
||
func main() { | ||
system := vivid.NewActorSystem("test-system") | ||
|
||
system.Shutdown() | ||
fmt.Println("System shutdown") | ||
} |
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.