Skip to content
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

Update processer word spelling #190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion actor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ receiver. The envelope is used to route the message to the correct actor.

A process is an abstraction over the actor. Todo: Describe the process.

## Processer
## Processor

Todo: Not really sure.

Expand Down
4 changes: 2 additions & 2 deletions actor/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func (e *Engine) SpawnFunc(f func(*Context), kind string, opts ...OptFunc) *PID
return e.Spawn(newFuncReceiver(f), kind, opts...)
}

// SpawnProc spawns the give Processer. This function is useful when working
// SpawnProc spawns the give Processor. This function is useful when working
// with custom created Processes. Take a look at the streamWriter as an example.
func (e *Engine) SpawnProc(p Processer) *PID {
func (e *Engine) SpawnProc(p Processor) *PID {
e.Registry.add(p)
return p.PID()
}
Expand Down
6 changes: 3 additions & 3 deletions actor/inbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ func NewScheduler(throughput int) Scheduler {

type Inboxer interface {
Send(Envelope)
Start(Processer)
Start(Processor)
Stop() error
}

type Inbox struct {
rb *ringbuffer.RingBuffer[Envelope]
proc Processer
proc Processor
scheduler Scheduler
procStatus int32
}
Expand Down Expand Up @@ -96,7 +96,7 @@ func (in *Inbox) run() {
}
}

func (in *Inbox) Start(proc Processer) {
func (in *Inbox) Start(proc Processor) {
// transition to "starting" and then "idle" to ensure no race condition on in.proc
if atomic.CompareAndSwapInt32(&in.procStatus, stopped, starting) {
in.proc = proc
Expand Down
18 changes: 9 additions & 9 deletions actor/inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func TestInboxSendAndProcess(t *testing.T) {
inbox := NewInbox(10)
processedMessages := make(chan Envelope, 10)
mockProc := MockProcesser{
mockProc := MockProcessor{
processFunc: func(envelopes []Envelope) {
for _, e := range envelopes {
processedMessages <- e
Expand All @@ -34,7 +34,7 @@ func TestInboxSendAndProcessMany(t *testing.T) {
for i := 0; i < 100000; i++ {
inbox := NewInbox(10)
processedMessages := make(chan Envelope, 10)
mockProc := MockProcesser{
mockProc := MockProcessor{
processFunc: func(envelopes []Envelope) {
for _, e := range envelopes {
processedMessages <- e
Expand All @@ -57,24 +57,24 @@ func TestInboxSendAndProcessMany(t *testing.T) {
}
}

type MockProcesser struct {
type MockProcessor struct {
processFunc func([]Envelope)
}

func (m MockProcesser) Start() {}
func (m MockProcesser) PID() *PID {
func (m MockProcessor) Start() {}
func (m MockProcessor) PID() *PID {
return nil
}
func (m MockProcesser) Send(*PID, any, *PID) {}
func (m MockProcesser) Invoke(envelopes []Envelope) {
func (m MockProcessor) Send(*PID, any, *PID) {}
func (m MockProcessor) Invoke(envelopes []Envelope) {
m.processFunc(envelopes)
}
func (m MockProcesser) Shutdown() {}
func (m MockProcessor) Shutdown() {}

func TestInboxStop(t *testing.T) {
inbox := NewInbox(10)
done := make(chan struct{})
mockProc := MockProcesser{
mockProc := MockProcessor{
processFunc: func(envelopes []Envelope) {
inbox.Stop()
done <- struct{}{}
Expand Down
4 changes: 2 additions & 2 deletions actor/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type Envelope struct {
Sender *PID
}

// Processer is an interface the abstracts the way a process behaves.
type Processer interface {
// Processor is an interface the abstracts the way a process behaves.
type Processor interface {
Start()
PID() *PID
Send(*PID, any, *PID)
Expand Down
16 changes: 8 additions & 8 deletions actor/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ const LocalLookupAddr = "local"

type Registry struct {
mu sync.RWMutex
lookup map[string]Processer
lookup map[string]Processor
engine *Engine
}

func newRegistry(e *Engine) *Registry {
return &Registry{
lookup: make(map[string]Processer, 1024),
lookup: make(map[string]Processor, 1024),
engine: e,
}
}
Expand All @@ -36,10 +36,10 @@ func (r *Registry) Remove(pid *PID) {
delete(r.lookup, pid.ID)
}

// get returns the processer for the given PID, if it exists.
// get returns the Processor for the given PID, if it exists.
// If it doesn't exist, nil is returned so the caller must check for that
// and direct the message to the deadletter processer instead.
func (r *Registry) get(pid *PID) Processer {
// and direct the message to the deadletter Processor instead.
func (r *Registry) get(pid *PID) Processor {
if pid == nil {
return nil
}
Expand All @@ -48,16 +48,16 @@ func (r *Registry) get(pid *PID) Processer {
if proc, ok := r.lookup[pid.ID]; ok {
return proc
}
return nil // didn't find the processer
return nil // didn't find the Processor
}

func (r *Registry) getByID(id string) Processer {
func (r *Registry) getByID(id string) Processor {
r.mu.RLock()
defer r.mu.RUnlock()
return r.lookup[id]
}

func (r *Registry) add(proc Processer) {
func (r *Registry) add(proc Processor) {
r.mu.Lock()
id := proc.PID().ID
if _, ok := r.lookup[id]; ok {
Expand Down
2 changes: 1 addition & 1 deletion remote/stream_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type streamWriter struct {
buffSize int
}

func newStreamWriter(e *actor.Engine, rpid *actor.PID, address string, tlsConfig *tls.Config, buffSize int) actor.Processer {
func newStreamWriter(e *actor.Engine, rpid *actor.PID, address string, tlsConfig *tls.Config, buffSize int) actor.Processor {
return &streamWriter{
writeToAddr: address,
engine: e,
Expand Down