actor

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_actor_message_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Actor

type Actor interface {
	Receive(c Context)
}

type ActorFunc

type ActorFunc func(c Context)

func (ActorFunc) Receive

func (f ActorFunc) Receive(c Context)

type CancelFunc

type CancelFunc func()

type Cluster

type Cluster struct {
	core.Cluster
}

func NewCluster

func NewCluster(node *Node, client *clientv3.Client, opt ...cluster.Option) (*Cluster, error)

func (*Cluster) SpawnActor

func (c *Cluster) SpawnActor(actor Actor, opt ...SpawnOption) (Process, error)

type Context

type Context interface {
	Process
	Message() interface{}
	Reply(message interface{}) error
	Error(err error) error
	HandleCall(reply interface{}, err error) error
	From() PID
}

type Future

type Future struct {
	core.Process
	// contains filtered or unexported fields
}

func NewFuture

func NewFuture(process Process, timeout time.Duration) (*Future, error)

func (*Future) Close

func (f *Future) Close()

func (*Future) Err

func (f *Future) Err() error

func (*Future) Result

func (f *Future) Result() (interface{}, error)

func (*Future) SetErr

func (f *Future) SetErr(err error)

func (*Future) SetResult

func (f *Future) SetResult(result interface{})

func (*Future) Wait

func (f *Future) Wait()

type Node

type Node struct {
	core.Node
	Root Process
}

func NewNode

func NewNode(name string) *Node

func (*Node) SpawnActor

func (n *Node) SpawnActor(actor Actor, opt ...SpawnOption) (Process, error)

type PID

type PID = core.PID
var ZeroPID PID

func PIDFromString

func PIDFromString(s string) (PID, error)

type Process

type Process interface {
	core.Process
	SpawnActor(actor Actor, opt ...SpawnOption) (Process, error)
	CallCtx(ctx context.Context, to PID, message interface{}) *Future
	Call(to PID, message interface{}) *Future
}

type SpawnOption

type SpawnOption func(opts *core.SpawnOptions)

func Name

func Name(name string) SpawnOption

type Started

type Started struct {
	// contains filtered or unexported fields
}

func (*Started) Descriptor deprecated

func (*Started) Descriptor() ([]byte, []int)

Deprecated: Use Started.ProtoReflect.Descriptor instead.

func (*Started) ProtoMessage

func (*Started) ProtoMessage()

func (*Started) ProtoReflect

func (x *Started) ProtoReflect() protoreflect.Message

func (*Started) Reset

func (x *Started) Reset()

func (*Started) String

func (x *Started) String() string

type Stop

type Stop struct {
	// contains filtered or unexported fields
}

func (*Stop) Descriptor deprecated

func (*Stop) Descriptor() ([]byte, []int)

Deprecated: Use Stop.ProtoReflect.Descriptor instead.

func (*Stop) ProtoMessage

func (*Stop) ProtoMessage()

func (*Stop) ProtoReflect

func (x *Stop) ProtoReflect() protoreflect.Message

func (*Stop) Reset

func (x *Stop) Reset()

func (*Stop) String

func (x *Stop) String() string

type Stopped

type Stopped struct {
	// contains filtered or unexported fields
}

func (*Stopped) Descriptor deprecated

func (*Stopped) Descriptor() ([]byte, []int)

Deprecated: Use Stopped.ProtoReflect.Descriptor instead.

func (*Stopped) ProtoMessage

func (*Stopped) ProtoMessage()

func (*Stopped) ProtoReflect

func (x *Stopped) ProtoReflect() protoreflect.Message

func (*Stopped) Reset

func (x *Stopped) Reset()

func (*Stopped) String

func (x *Stopped) String() string

type Stopping

type Stopping struct {
	// contains filtered or unexported fields
}

func (*Stopping) Descriptor deprecated

func (*Stopping) Descriptor() ([]byte, []int)

Deprecated: Use Stopping.ProtoReflect.Descriptor instead.

func (*Stopping) ProtoMessage

func (*Stopping) ProtoMessage()

func (*Stopping) ProtoReflect

func (x *Stopping) ProtoReflect() protoreflect.Message

func (*Stopping) Reset

func (x *Stopping) Reset()

func (*Stopping) String

func (x *Stopping) String() string

type TimerScheduler

type TimerScheduler struct {
	// contains filtered or unexported fields
}

func NewTimerScheduler

func NewTimerScheduler(process Process) *TimerScheduler

func (*TimerScheduler) SendOnce

func (s *TimerScheduler) SendOnce(to PID, message interface{}, delay time.Duration) CancelFunc

func (*TimerScheduler) SendRepeatedly

func (s *TimerScheduler) SendRepeatedly(to PID, message interface{}, interval time.Duration) CancelFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL