Resolve "Deprecate Providers package in favor of Worker"

This commit is contained in:
2025-10-09 15:53:02 +00:00
parent a1993c6c36
commit c512f51a57
26 changed files with 1695 additions and 2239 deletions

View File

@@ -79,7 +79,7 @@ func (p *actorPartition) loop() {
if !exists {
uniqueChannels := make(map[chan<- domain.Message]struct{})
for _, e := range p.rules {
if e.pattern.Satisfies(id) {
if e.pattern.Match(id) {
for ch := range e.channels {
uniqueChannels[ch] = struct{}{}
}
@@ -107,7 +107,7 @@ func (p *actorPartition) loop() {
}
case opRegister:
key := v.pattern.Canonical()
key := v.pattern.Key()
e, exists := p.rules[key]
if !exists {
e = &ruleEntry{pattern: v.pattern, channels: make(map[chan<- domain.Message]struct{})}
@@ -121,7 +121,7 @@ func (p *actorPartition) loop() {
e.channels[v.channel] = struct{}{}
for id, subs := range p.memo {
if v.pattern.Satisfies(id) && !slices.Contains(subs, v.channel) {
if v.pattern.Match(id) && !slices.Contains(subs, v.channel) {
p.memo[id] = append(subs, v.channel)
}
}
@@ -129,7 +129,7 @@ func (p *actorPartition) loop() {
v.done <- struct{}{}
case opDeregister:
key := v.pattern.Canonical()
key := v.pattern.Key()
e, ok := p.rules[key]
if !ok {
v.done <- struct{}{}
@@ -146,7 +146,7 @@ func (p *actorPartition) loop() {
}
for id, subs := range p.memo {
if v.pattern.Satisfies(id) {
if v.pattern.Match(id) {
for i := range subs {
if subs[i] == v.channel {
last := len(subs) - 1

View File

@@ -100,7 +100,7 @@ func (r *Router) Incoming() chan<- domain.Message { return r.incoming }
func (r *Router) RegisterPattern(pat domain.Pattern, ch chan<- domain.Message) {
// Inline ensurePartition
ns := pat.Namespace
ns, _, _, _ := pat.Parse() // Note: Error ignored, pattern assumed to be valid if passed to router
r.mu.RLock()
p := r.partitions[ns]
r.mu.RUnlock()
@@ -119,7 +119,8 @@ func (r *Router) RegisterPattern(pat domain.Pattern, ch chan<- domain.Message) {
func (r *Router) DeregisterPattern(pat domain.Pattern, ch chan<- domain.Message) {
r.mu.RLock()
p := r.partitions[pat.Namespace]
ns, _, _, _ := pat.Parse()
p := r.partitions[ns]
r.mu.RUnlock()
if p != nil {
p.deregisterRoute(pat, ch)