cluster

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

README

Proto.Actor Cluster - Virtual Actors (Alpha)

Massively distributed actors for GO

Proto.Actor supports the classic actor model also found in Erlang and Akka.
Our cluster support however uses a different approach, Virtual Actor Model.

This is a model where each actor appears to always exist. There is no lifecycle as in the classic actor model. You get a reference to the actor by asking for it's ID.

e.g.

hello := shared.GetHelloGrain("abc")
res := hello.SayHello(&shared.HelloRequest{Name: "Proto.Actor"})

This will ask the cluster where the 'abc' actor is located. If it does not yet exist, it will be created for you.

See Microsoft Orleans for more info about the Virtual Actor Model: http://dotnet.github.io/orleans/

How to

Protobuf IDL Definition

Start by defining your messages and grain contracts. You do this by using Protobuf IDL files.

Here is the definition from the /examples/cluster/shared example

syntax = "proto3";
package shared;

message HelloRequest {
  string name = 1;
}

message HelloResponse {
  string message = 1;
}

message AddRequest {
  double a = 1;
  double b = 2;
}

message AddResponse {
  double result = 1;
}

service Hello {
  rpc SayHello (HelloRequest) returns (HelloResponse) {} 
  rpc Add(AddRequest) returns (AddResponse) {}
}

Once you have this, you can generate your code using the protobuf protoc compiler.

Windows

#generate messages
protoc -I=. -I=%GOPATH%\src --gogoslick_out=. protos.proto
#generate grains 
protoc -I=. -I=%GOPATH%\src --gorleans_out=. protos.proto 

Implementing

Once the messages and contracts have been generated, you can start implementing your own business logic. This is essentially a type which is powered by a Proto.Actor actor behind the scenes.

package shared

// a Go struct implementing the Hello interface
type hello struct {
}

func (*hello) SayHello(r *HelloRequest) *HelloResponse {
	return &HelloResponse{Message: "hello " + r.Name}
}

func (*hello) Add(r *AddRequest) *AddResponse {
	return &AddResponse{Result: r.A + r.B}
}

// Register what implementation Proto.Actor should use when 
// creating actors for a certain grain type.
func init() {
	// apply DI and setup logic
	HelloFactory(func() Hello { return &hello{} })
}

Seed nodes

func main() {
    cluster.Start("127.0.0.1:7711")
    console.ReadLine()
}

Member nodes

func main() {
	cluster.Start("127.0.0.1:0", "127.0.0.1:7711")

    // get a reference to the virtual actor called "abc" of type Hello
	hello := shared.GetHelloGrain("abc")
	res := hello.SayHello(&shared.HelloRequest{Name: "Proto.Actor"})
	log.Printf("Message from grain %v", res.Message)
}

FAQ

Can I use Proto.Actor Cluster in production?

The Proto.Actor Cluster support is in alpha version, thus not production ready.

What about performance?

Proto.Actor Remoting is able to pass 1 million+ messages per second on a standard dev machine. This is the same infrastructure used in Proto.Actor cluster. Proto.Actor Cluster however uses an RPC API, meaning it is Request/Response in nature. If you wait for a response for each call, the throughput will ofcourse be a lot less. Async Fire and forget for performance, Request/Response for simplicity.

Documentation

Index

Constants

View Source
const (
	ActorNameIdentity  = "partition-identity"
	ActorNamePlacement = "partition-activator"
)

Variables

View Source
var (
	ErrInvalidLengthProtos = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProtos   = fmt.Errorf("proto: integer overflow")
)

Functions

func SetLogLevel

func SetLogLevel(level log.Level)

SetLogLevel sets the log level for the logger.

SetLogLevel is safe to call concurrently

Types

type Activation

type Activation struct {
	Pid             *actor.PID       `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"`
	ClusterIdentity *ClusterIdentity `protobuf:"bytes,2,opt,name=cluster_identity,json=clusterIdentity,proto3" json:"cluster_identity,omitempty"`
	EventId         uint64           `protobuf:"varint,3,opt,name=eventId,proto3" json:"eventId,omitempty"`
}

func (*Activation) Descriptor

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

func (*Activation) Equal

func (this *Activation) Equal(that interface{}) bool

func (*Activation) GetClusterIdentity

func (m *Activation) GetClusterIdentity() *ClusterIdentity

func (*Activation) GetEventId

func (m *Activation) GetEventId() uint64

func (*Activation) GetPid

func (m *Activation) GetPid() *actor.PID

func (*Activation) Marshal

func (m *Activation) Marshal() (dAtA []byte, err error)

func (*Activation) MarshalTo

func (m *Activation) MarshalTo(dAtA []byte) (int, error)

func (*Activation) ProtoMessage

func (*Activation) ProtoMessage()

func (*Activation) Reset

func (m *Activation) Reset()

func (*Activation) Size

func (m *Activation) Size() (n int)

func (*Activation) String

func (this *Activation) String() string

func (*Activation) Unmarshal

func (m *Activation) Unmarshal(dAtA []byte) error

func (*Activation) XXX_DiscardUnknown

func (m *Activation) XXX_DiscardUnknown()

func (*Activation) XXX_Marshal

func (m *Activation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Activation) XXX_Merge

func (m *Activation) XXX_Merge(src proto.Message)

func (*Activation) XXX_Size

func (m *Activation) XXX_Size() int

func (*Activation) XXX_Unmarshal

func (m *Activation) XXX_Unmarshal(b []byte) error

type ActivationRequest

type ActivationRequest struct {
	ClusterIdentity *ClusterIdentity `protobuf:"bytes,1,opt,name=cluster_identity,json=clusterIdentity,proto3" json:"cluster_identity,omitempty"`
	RequestId       string           `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
}

func (*ActivationRequest) Descriptor

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

func (*ActivationRequest) Equal

func (this *ActivationRequest) Equal(that interface{}) bool

func (*ActivationRequest) GetClusterIdentity

func (m *ActivationRequest) GetClusterIdentity() *ClusterIdentity

func (*ActivationRequest) GetRequestId

func (m *ActivationRequest) GetRequestId() string

func (*ActivationRequest) Marshal

func (m *ActivationRequest) Marshal() (dAtA []byte, err error)

func (*ActivationRequest) MarshalTo

func (m *ActivationRequest) MarshalTo(dAtA []byte) (int, error)

func (*ActivationRequest) ProtoMessage

func (*ActivationRequest) ProtoMessage()

func (*ActivationRequest) Reset

func (m *ActivationRequest) Reset()

func (*ActivationRequest) Size

func (m *ActivationRequest) Size() (n int)

func (*ActivationRequest) String

func (this *ActivationRequest) String() string

func (*ActivationRequest) Unmarshal

func (m *ActivationRequest) Unmarshal(dAtA []byte) error

func (*ActivationRequest) XXX_DiscardUnknown

func (m *ActivationRequest) XXX_DiscardUnknown()

func (*ActivationRequest) XXX_Marshal

func (m *ActivationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ActivationRequest) XXX_Merge

func (m *ActivationRequest) XXX_Merge(src proto.Message)

func (*ActivationRequest) XXX_Size

func (m *ActivationRequest) XXX_Size() int

func (*ActivationRequest) XXX_Unmarshal

func (m *ActivationRequest) XXX_Unmarshal(b []byte) error

type ActivationResponse

type ActivationResponse struct {
	Pid        *actor.PID `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"`
	StatusCode uint32     `protobuf:"varint,2,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
}

func (*ActivationResponse) Descriptor

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

func (*ActivationResponse) Equal

func (this *ActivationResponse) Equal(that interface{}) bool

func (*ActivationResponse) GetPid

func (m *ActivationResponse) GetPid() *actor.PID

func (*ActivationResponse) GetStatusCode

func (m *ActivationResponse) GetStatusCode() uint32

func (*ActivationResponse) Marshal

func (m *ActivationResponse) Marshal() (dAtA []byte, err error)

func (*ActivationResponse) MarshalTo

func (m *ActivationResponse) MarshalTo(dAtA []byte) (int, error)

func (*ActivationResponse) ProtoMessage

func (*ActivationResponse) ProtoMessage()

func (*ActivationResponse) Reset

func (m *ActivationResponse) Reset()

func (*ActivationResponse) Size

func (m *ActivationResponse) Size() (n int)

func (*ActivationResponse) String

func (this *ActivationResponse) String() string

func (*ActivationResponse) Unmarshal

func (m *ActivationResponse) Unmarshal(dAtA []byte) error

func (*ActivationResponse) XXX_DiscardUnknown

func (m *ActivationResponse) XXX_DiscardUnknown()

func (*ActivationResponse) XXX_Marshal

func (m *ActivationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ActivationResponse) XXX_Merge

func (m *ActivationResponse) XXX_Merge(src proto.Message)

func (*ActivationResponse) XXX_Size

func (m *ActivationResponse) XXX_Size() int

func (*ActivationResponse) XXX_Unmarshal

func (m *ActivationResponse) XXX_Unmarshal(b []byte) error

type ActivationTerminated

type ActivationTerminated struct {
	Pid             *actor.PID       `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"`
	ClusterIdentity *ClusterIdentity `protobuf:"bytes,2,opt,name=cluster_identity,json=clusterIdentity,proto3" json:"cluster_identity,omitempty"`
	EventId         uint64           `protobuf:"varint,3,opt,name=eventId,proto3" json:"eventId,omitempty"`
}

func (*ActivationTerminated) Descriptor

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

func (*ActivationTerminated) Equal

func (this *ActivationTerminated) Equal(that interface{}) bool

func (*ActivationTerminated) GetClusterIdentity

func (m *ActivationTerminated) GetClusterIdentity() *ClusterIdentity

func (*ActivationTerminated) GetEventId

func (m *ActivationTerminated) GetEventId() uint64

func (*ActivationTerminated) GetPid

func (m *ActivationTerminated) GetPid() *actor.PID

func (*ActivationTerminated) Marshal

func (m *ActivationTerminated) Marshal() (dAtA []byte, err error)

func (*ActivationTerminated) MarshalTo

func (m *ActivationTerminated) MarshalTo(dAtA []byte) (int, error)

func (*ActivationTerminated) ProtoMessage

func (*ActivationTerminated) ProtoMessage()

func (*ActivationTerminated) Reset

func (m *ActivationTerminated) Reset()

func (*ActivationTerminated) Size

func (m *ActivationTerminated) Size() (n int)

func (*ActivationTerminated) String

func (this *ActivationTerminated) String() string

func (*ActivationTerminated) Unmarshal

func (m *ActivationTerminated) Unmarshal(dAtA []byte) error

func (*ActivationTerminated) XXX_DiscardUnknown

func (m *ActivationTerminated) XXX_DiscardUnknown()

func (*ActivationTerminated) XXX_Marshal

func (m *ActivationTerminated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ActivationTerminated) XXX_Merge

func (m *ActivationTerminated) XXX_Merge(src proto.Message)

func (*ActivationTerminated) XXX_Size

func (m *ActivationTerminated) XXX_Size() int

func (*ActivationTerminated) XXX_Unmarshal

func (m *ActivationTerminated) XXX_Unmarshal(b []byte) error

type Cluster

type Cluster struct {
	ActorSystem *actor.ActorSystem
	Config      *Config

	MemberList *MemberList
	// contains filtered or unexported fields
}

func GetCluster

func GetCluster(actorSystem *actor.ActorSystem) *Cluster

func New

func New(actorSystem *actor.ActorSystem, config *Config) *Cluster

func (*Cluster) Call

func (c *Cluster) Call(name string, kind string, msg interface{}, callopts ...*GrainCallOptions) (interface{}, error)

Call is a wrap of context.RequestFuture with retries.

func (*Cluster) Get

func (c *Cluster) Get(name string, kind string) (*actor.PID, remote.ResponseStatusCode)

Get a PID to a virtual actor

func (*Cluster) GetClusterKind

func (c *Cluster) GetClusterKind(kind string) *actor.Props

func (*Cluster) GetClusterKinds

func (c *Cluster) GetClusterKinds() []string

GetClusterKinds Get kinds of virtual actor

func (*Cluster) GetV1

func (c *Cluster) GetV1(name string, kind string) (*actor.PID, remote.ResponseStatusCode)

Get a PID to a virtual actor

func (*Cluster) Id

func (c *Cluster) Id() extensions.ExtensionId

func (*Cluster) Shutdown

func (c *Cluster) Shutdown(graceful bool)

func (*Cluster) Start

func (c *Cluster) Start()

func (*Cluster) StartClient

func (c *Cluster) StartClient()

type ClusterIdentity

type ClusterIdentity struct {
	Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
	Kind     string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
}

func (*ClusterIdentity) AsKey

func (ci *ClusterIdentity) AsKey() string

func (*ClusterIdentity) Descriptor

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

func (*ClusterIdentity) Equal

func (this *ClusterIdentity) Equal(that interface{}) bool

func (*ClusterIdentity) GetIdentity

func (m *ClusterIdentity) GetIdentity() string

func (*ClusterIdentity) GetKind

func (m *ClusterIdentity) GetKind() string

func (*ClusterIdentity) Marshal

func (m *ClusterIdentity) Marshal() (dAtA []byte, err error)

func (*ClusterIdentity) MarshalTo

func (m *ClusterIdentity) MarshalTo(dAtA []byte) (int, error)

func (*ClusterIdentity) ProtoMessage

func (*ClusterIdentity) ProtoMessage()

func (*ClusterIdentity) Reset

func (m *ClusterIdentity) Reset()

func (*ClusterIdentity) Size

func (m *ClusterIdentity) Size() (n int)

func (*ClusterIdentity) String

func (this *ClusterIdentity) String() string

func (*ClusterIdentity) Unmarshal

func (m *ClusterIdentity) Unmarshal(dAtA []byte) error

func (*ClusterIdentity) XXX_DiscardUnknown

func (m *ClusterIdentity) XXX_DiscardUnknown()

func (*ClusterIdentity) XXX_Marshal

func (m *ClusterIdentity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClusterIdentity) XXX_Merge

func (m *ClusterIdentity) XXX_Merge(src proto.Message)

func (*ClusterIdentity) XXX_Size

func (m *ClusterIdentity) XXX_Size() int

func (*ClusterIdentity) XXX_Unmarshal

func (m *ClusterIdentity) XXX_Unmarshal(b []byte) error

type ClusterInit

type ClusterInit struct {
	ID   string
	Kind string
}

type ClusterProvider

type ClusterProvider interface {
	StartMember(cluster *Cluster) error
	StartClient(cluster *Cluster) error
	Shutdown(graceful bool) error
	UpdateClusterState(state ClusterState) error
}

type ClusterState

type ClusterState struct {
	BannedMembers []string `json:"bannedMembers"`
}

type ClusterTopology

type ClusterTopology struct {
	EventId uint64    `protobuf:"varint,1,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"`
	Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"`
	Joined  []*Member `protobuf:"bytes,3,rep,name=joined,proto3" json:"joined,omitempty"`
	Left    []*Member `protobuf:"bytes,4,rep,name=left,proto3" json:"left,omitempty"`
	Banned  []*Member `protobuf:"bytes,5,rep,name=banned,proto3" json:"banned,omitempty"`
}

func (*ClusterTopology) Descriptor

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

func (*ClusterTopology) Equal

func (this *ClusterTopology) Equal(that interface{}) bool

func (*ClusterTopology) GetBanned

func (m *ClusterTopology) GetBanned() []*Member

func (*ClusterTopology) GetEventId

func (m *ClusterTopology) GetEventId() uint64

func (*ClusterTopology) GetJoined

func (m *ClusterTopology) GetJoined() []*Member

func (*ClusterTopology) GetLeft

func (m *ClusterTopology) GetLeft() []*Member

func (*ClusterTopology) GetMembers

func (m *ClusterTopology) GetMembers() []*Member

func (*ClusterTopology) Marshal

func (m *ClusterTopology) Marshal() (dAtA []byte, err error)

func (*ClusterTopology) MarshalTo

func (m *ClusterTopology) MarshalTo(dAtA []byte) (int, error)

func (*ClusterTopology) ProtoMessage

func (*ClusterTopology) ProtoMessage()

func (*ClusterTopology) Reset

func (m *ClusterTopology) Reset()

func (*ClusterTopology) Size

func (m *ClusterTopology) Size() (n int)

func (*ClusterTopology) String

func (this *ClusterTopology) String() string

func (*ClusterTopology) Unmarshal

func (m *ClusterTopology) Unmarshal(dAtA []byte) error

func (*ClusterTopology) XXX_DiscardUnknown

func (m *ClusterTopology) XXX_DiscardUnknown()

func (*ClusterTopology) XXX_Marshal

func (m *ClusterTopology) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClusterTopology) XXX_Merge

func (m *ClusterTopology) XXX_Merge(src proto.Message)

func (*ClusterTopology) XXX_Size

func (m *ClusterTopology) XXX_Size() int

func (*ClusterTopology) XXX_Unmarshal

func (m *ClusterTopology) XXX_Unmarshal(b []byte) error

type ClusterTopologyEventV2

type ClusterTopologyEventV2 struct {
	*ClusterTopology
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Name                  string
	Address               string
	ClusterProvider       ClusterProvider
	RemoteConfig          remote.Config
	TimeoutTime           time.Duration
	MemberStrategyBuilder func(kind string) MemberStrategy
	Kinds                 map[string]*actor.Props
}

func Configure

func Configure(clusterName string, clusterProvider ClusterProvider, remoteConfig remote.Config, kinds ...*Kind) *Config

func (*Config) WithTimeout

func (c *Config) WithTimeout(t time.Duration) *Config

type Grain

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

func (*Grain) ID

func (g *Grain) ID() string

func (*Grain) Init

func (g *Grain) Init(id string)

type GrainCallOptions

type GrainCallOptions struct {
	RetryCount  int
	Timeout     time.Duration
	RetryAction func(n int)
}

func DefaultGrainCallOptions

func DefaultGrainCallOptions(cluster *Cluster) *GrainCallOptions

func NewGrainCallOptions

func NewGrainCallOptions(cluster *Cluster) *GrainCallOptions

func (*GrainCallOptions) WithRetry

func (config *GrainCallOptions) WithRetry(count int) *GrainCallOptions

func (*GrainCallOptions) WithRetryAction

func (config *GrainCallOptions) WithRetryAction(act func(i int)) *GrainCallOptions

func (*GrainCallOptions) WithTimeout

func (config *GrainCallOptions) WithTimeout(timeout time.Duration) *GrainCallOptions

type GrainContext

type GrainContext interface {
	// Self returns the PID for the current actor
	Self() *actor.PID

	// Returns a slice of the actors children
	Children() []*actor.PID

	// Watch registers the actor as a monitor for the specified PID
	Watch(pid *actor.PID)

	// Unwatch unregisters the actor as a monitor for the specified PID
	Unwatch(pid *actor.PID)

	// Sender returns the PID of actor that sent currently processed message
	Sender() *actor.PID

	// Message returns the current message to be processed
	Message() interface{}

	// Tell sends a message to the given PID
	Send(pid *actor.PID, message interface{})

	// Request sends a message to the given PID and also provides a Sender PID
	Request(pid *actor.PID, message interface{})

	// RequestFuture sends a message to a given PID and returns a Future
	RequestFuture(pid *actor.PID, message interface{}, timeout time.Duration) *actor.Future

	// Spawn starts a new child actor based on props and named with a unique id
	Spawn(props *actor.Props) *actor.PID

	// SpawnPrefix starts a new child actor based on props and named using a prefix followed by a unique id
	SpawnPrefix(props *actor.Props, prefix string) *actor.PID

	// SpawnNamed starts a new child actor based on props and named using the specified name
	//
	// ErrNameExists will be returned if id already exists
	SpawnNamed(props *actor.Props, id string) (*actor.PID, error)
}

type GrainErrorResponse

type GrainErrorResponse struct {
	Err  string `protobuf:"bytes,1,opt,name=err,proto3" json:"err,omitempty"`
	Code int32  `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
}

func (*GrainErrorResponse) Descriptor

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

func (*GrainErrorResponse) Equal

func (this *GrainErrorResponse) Equal(that interface{}) bool

func (*GrainErrorResponse) GetCode

func (m *GrainErrorResponse) GetCode() int32

func (*GrainErrorResponse) GetErr

func (m *GrainErrorResponse) GetErr() string

func (*GrainErrorResponse) Marshal

func (m *GrainErrorResponse) Marshal() (dAtA []byte, err error)

func (*GrainErrorResponse) MarshalTo

func (m *GrainErrorResponse) MarshalTo(dAtA []byte) (int, error)

func (*GrainErrorResponse) ProtoMessage

func (*GrainErrorResponse) ProtoMessage()

func (*GrainErrorResponse) Reset

func (m *GrainErrorResponse) Reset()

func (*GrainErrorResponse) Size

func (m *GrainErrorResponse) Size() (n int)

func (*GrainErrorResponse) String

func (this *GrainErrorResponse) String() string

func (*GrainErrorResponse) Unmarshal

func (m *GrainErrorResponse) Unmarshal(dAtA []byte) error

func (*GrainErrorResponse) XXX_DiscardUnknown

func (m *GrainErrorResponse) XXX_DiscardUnknown()

func (*GrainErrorResponse) XXX_Marshal

func (m *GrainErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GrainErrorResponse) XXX_Merge

func (m *GrainErrorResponse) XXX_Merge(src proto.Message)

func (*GrainErrorResponse) XXX_Size

func (m *GrainErrorResponse) XXX_Size() int

func (*GrainErrorResponse) XXX_Unmarshal

func (m *GrainErrorResponse) XXX_Unmarshal(b []byte) error

type GrainMeta

type GrainMeta struct {
	ID      *ClusterIdentity
	PID     *actor.PID
	EventID uint64
}

type GrainRequest

type GrainRequest struct {
	MethodIndex int32  `protobuf:"varint,1,opt,name=method_index,json=methodIndex,proto3" json:"method_index,omitempty"`
	MessageData []byte `protobuf:"bytes,2,opt,name=message_data,json=messageData,proto3" json:"message_data,omitempty"`
}

func (*GrainRequest) Descriptor

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

func (*GrainRequest) Equal

func (this *GrainRequest) Equal(that interface{}) bool

func (*GrainRequest) GetMessageData

func (m *GrainRequest) GetMessageData() []byte

func (*GrainRequest) GetMethodIndex

func (m *GrainRequest) GetMethodIndex() int32

func (*GrainRequest) Marshal

func (m *GrainRequest) Marshal() (dAtA []byte, err error)

func (*GrainRequest) MarshalTo

func (m *GrainRequest) MarshalTo(dAtA []byte) (int, error)

func (*GrainRequest) ProtoMessage

func (*GrainRequest) ProtoMessage()

func (*GrainRequest) Reset

func (m *GrainRequest) Reset()

func (*GrainRequest) Size

func (m *GrainRequest) Size() (n int)

func (*GrainRequest) String

func (this *GrainRequest) String() string

func (*GrainRequest) Unmarshal

func (m *GrainRequest) Unmarshal(dAtA []byte) error

func (*GrainRequest) XXX_DiscardUnknown

func (m *GrainRequest) XXX_DiscardUnknown()

func (*GrainRequest) XXX_Marshal

func (m *GrainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GrainRequest) XXX_Merge

func (m *GrainRequest) XXX_Merge(src proto.Message)

func (*GrainRequest) XXX_Size

func (m *GrainRequest) XXX_Size() int

func (*GrainRequest) XXX_Unmarshal

func (m *GrainRequest) XXX_Unmarshal(b []byte) error

type GrainResponse

type GrainResponse struct {
	MessageData []byte `protobuf:"bytes,1,opt,name=message_data,json=messageData,proto3" json:"message_data,omitempty"`
}

func (*GrainResponse) Descriptor

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

func (*GrainResponse) Equal

func (this *GrainResponse) Equal(that interface{}) bool

func (*GrainResponse) GetMessageData

func (m *GrainResponse) GetMessageData() []byte

func (*GrainResponse) Marshal

func (m *GrainResponse) Marshal() (dAtA []byte, err error)

func (*GrainResponse) MarshalTo

func (m *GrainResponse) MarshalTo(dAtA []byte) (int, error)

func (*GrainResponse) ProtoMessage

func (*GrainResponse) ProtoMessage()

func (*GrainResponse) Reset

func (m *GrainResponse) Reset()

func (*GrainResponse) Size

func (m *GrainResponse) Size() (n int)

func (*GrainResponse) String

func (this *GrainResponse) String() string

func (*GrainResponse) Unmarshal

func (m *GrainResponse) Unmarshal(dAtA []byte) error

func (*GrainResponse) XXX_DiscardUnknown

func (m *GrainResponse) XXX_DiscardUnknown()

func (*GrainResponse) XXX_Marshal

func (m *GrainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GrainResponse) XXX_Merge

func (m *GrainResponse) XXX_Merge(src proto.Message)

func (*GrainResponse) XXX_Size

func (m *GrainResponse) XXX_Size() int

func (*GrainResponse) XXX_Unmarshal

func (m *GrainResponse) XXX_Unmarshal(b []byte) error

type HeartbeatRequest

type HeartbeatRequest struct {
}

func (*HeartbeatRequest) Descriptor

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

func (*HeartbeatRequest) Equal

func (this *HeartbeatRequest) Equal(that interface{}) bool

func (*HeartbeatRequest) Marshal

func (m *HeartbeatRequest) Marshal() (dAtA []byte, err error)

func (*HeartbeatRequest) MarshalTo

func (m *HeartbeatRequest) MarshalTo(dAtA []byte) (int, error)

func (*HeartbeatRequest) ProtoMessage

func (*HeartbeatRequest) ProtoMessage()

func (*HeartbeatRequest) Reset

func (m *HeartbeatRequest) Reset()

func (*HeartbeatRequest) Size

func (m *HeartbeatRequest) Size() (n int)

func (*HeartbeatRequest) String

func (this *HeartbeatRequest) String() string

func (*HeartbeatRequest) Unmarshal

func (m *HeartbeatRequest) Unmarshal(dAtA []byte) error

func (*HeartbeatRequest) XXX_DiscardUnknown

func (m *HeartbeatRequest) XXX_DiscardUnknown()

func (*HeartbeatRequest) XXX_Marshal

func (m *HeartbeatRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HeartbeatRequest) XXX_Merge

func (m *HeartbeatRequest) XXX_Merge(src proto.Message)

func (*HeartbeatRequest) XXX_Size

func (m *HeartbeatRequest) XXX_Size() int

func (*HeartbeatRequest) XXX_Unmarshal

func (m *HeartbeatRequest) XXX_Unmarshal(b []byte) error

type HeartbeatResponse

type HeartbeatResponse struct {
	ActorCount uint32 `protobuf:"varint,1,opt,name=actor_count,json=actorCount,proto3" json:"actor_count,omitempty"`
}

func (*HeartbeatResponse) Descriptor

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

func (*HeartbeatResponse) Equal

func (this *HeartbeatResponse) Equal(that interface{}) bool

func (*HeartbeatResponse) GetActorCount

func (m *HeartbeatResponse) GetActorCount() uint32

func (*HeartbeatResponse) Marshal

func (m *HeartbeatResponse) Marshal() (dAtA []byte, err error)

func (*HeartbeatResponse) MarshalTo

func (m *HeartbeatResponse) MarshalTo(dAtA []byte) (int, error)

func (*HeartbeatResponse) ProtoMessage

func (*HeartbeatResponse) ProtoMessage()

func (*HeartbeatResponse) Reset

func (m *HeartbeatResponse) Reset()

func (*HeartbeatResponse) Size

func (m *HeartbeatResponse) Size() (n int)

func (*HeartbeatResponse) String

func (this *HeartbeatResponse) String() string

func (*HeartbeatResponse) Unmarshal

func (m *HeartbeatResponse) Unmarshal(dAtA []byte) error

func (*HeartbeatResponse) XXX_DiscardUnknown

func (m *HeartbeatResponse) XXX_DiscardUnknown()

func (*HeartbeatResponse) XXX_Marshal

func (m *HeartbeatResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HeartbeatResponse) XXX_Merge

func (m *HeartbeatResponse) XXX_Merge(src proto.Message)

func (*HeartbeatResponse) XXX_Size

func (m *HeartbeatResponse) XXX_Size() int

func (*HeartbeatResponse) XXX_Unmarshal

func (m *HeartbeatResponse) XXX_Unmarshal(b []byte) error

type IdentityHandoverRequest

type IdentityHandoverRequest struct {
	EventId uint64    `protobuf:"varint,1,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"`
	Address string    `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	Members []*Member `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"`
}

request response call from Identity actor sent to each member asking what activations they hold that belong to the requester

func (*IdentityHandoverRequest) Descriptor

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

func (*IdentityHandoverRequest) Equal

func (this *IdentityHandoverRequest) Equal(that interface{}) bool

func (*IdentityHandoverRequest) GetAddress

func (m *IdentityHandoverRequest) GetAddress() string

func (*IdentityHandoverRequest) GetEventId

func (m *IdentityHandoverRequest) GetEventId() uint64

func (*IdentityHandoverRequest) GetMembers

func (m *IdentityHandoverRequest) GetMembers() []*Member

func (*IdentityHandoverRequest) Marshal

func (m *IdentityHandoverRequest) Marshal() (dAtA []byte, err error)

func (*IdentityHandoverRequest) MarshalTo

func (m *IdentityHandoverRequest) MarshalTo(dAtA []byte) (int, error)

func (*IdentityHandoverRequest) ProtoMessage

func (*IdentityHandoverRequest) ProtoMessage()

func (*IdentityHandoverRequest) Reset

func (m *IdentityHandoverRequest) Reset()

func (*IdentityHandoverRequest) Size

func (m *IdentityHandoverRequest) Size() (n int)

func (*IdentityHandoverRequest) String

func (this *IdentityHandoverRequest) String() string

func (*IdentityHandoverRequest) Unmarshal

func (m *IdentityHandoverRequest) Unmarshal(dAtA []byte) error

func (*IdentityHandoverRequest) XXX_DiscardUnknown

func (m *IdentityHandoverRequest) XXX_DiscardUnknown()

func (*IdentityHandoverRequest) XXX_Marshal

func (m *IdentityHandoverRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IdentityHandoverRequest) XXX_Merge

func (m *IdentityHandoverRequest) XXX_Merge(src proto.Message)

func (*IdentityHandoverRequest) XXX_Size

func (m *IdentityHandoverRequest) XXX_Size() int

func (*IdentityHandoverRequest) XXX_Unmarshal

func (m *IdentityHandoverRequest) XXX_Unmarshal(b []byte) error

type IdentityHandoverResponse

type IdentityHandoverResponse struct {
	Actors []*Activation `protobuf:"bytes,1,rep,name=actors,proto3" json:"actors,omitempty"`
}

response message to the above

func (*IdentityHandoverResponse) Descriptor

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

func (*IdentityHandoverResponse) Equal

func (this *IdentityHandoverResponse) Equal(that interface{}) bool

func (*IdentityHandoverResponse) GetActors

func (m *IdentityHandoverResponse) GetActors() []*Activation

func (*IdentityHandoverResponse) Marshal

func (m *IdentityHandoverResponse) Marshal() (dAtA []byte, err error)

func (*IdentityHandoverResponse) MarshalTo

func (m *IdentityHandoverResponse) MarshalTo(dAtA []byte) (int, error)

func (*IdentityHandoverResponse) ProtoMessage

func (*IdentityHandoverResponse) ProtoMessage()

func (*IdentityHandoverResponse) Reset

func (m *IdentityHandoverResponse) Reset()

func (*IdentityHandoverResponse) Size

func (m *IdentityHandoverResponse) Size() (n int)

func (*IdentityHandoverResponse) String

func (this *IdentityHandoverResponse) String() string

func (*IdentityHandoverResponse) Unmarshal

func (m *IdentityHandoverResponse) Unmarshal(dAtA []byte) error

func (*IdentityHandoverResponse) XXX_DiscardUnknown

func (m *IdentityHandoverResponse) XXX_DiscardUnknown()

func (*IdentityHandoverResponse) XXX_Marshal

func (m *IdentityHandoverResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IdentityHandoverResponse) XXX_Merge

func (m *IdentityHandoverResponse) XXX_Merge(src proto.Message)

func (*IdentityHandoverResponse) XXX_Size

func (m *IdentityHandoverResponse) XXX_Size() int

func (*IdentityHandoverResponse) XXX_Unmarshal

func (m *IdentityHandoverResponse) XXX_Unmarshal(b []byte) error

type IdentityLookup

type IdentityLookup interface {
	Get(clusterIdentity *ClusterIdentity)
	RemovePid(clusterIdentity *ClusterIdentity, pid *actor.PID)
	Setup(cluster *Cluster, kinds []string, isClient bool)
	Shutdown()
}

type Kind

type Kind struct {
	Kind  string
	Props *actor.Props
}

func NewKind

func NewKind(kind string, props *actor.Props) *Kind

type Member

type Member struct {
	Host  string   `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Port  int32    `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	Id    string   `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
	Kinds []string `protobuf:"bytes,4,rep,name=kinds,proto3" json:"kinds,omitempty"`
}

func (*Member) Address

func (m *Member) Address() string

Address return a "host:port". Member defined by protos.proto

func (*Member) Descriptor

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

func (*Member) Equal

func (this *Member) Equal(that interface{}) bool

func (*Member) GetHost

func (m *Member) GetHost() string

func (*Member) GetId

func (m *Member) GetId() string

func (*Member) GetKinds

func (m *Member) GetKinds() []string

func (*Member) GetPort

func (m *Member) GetPort() int32

func (*Member) Marshal

func (m *Member) Marshal() (dAtA []byte, err error)

func (*Member) MarshalTo

func (m *Member) MarshalTo(dAtA []byte) (int, error)

func (*Member) ProtoMessage

func (*Member) ProtoMessage()

func (*Member) Reset

func (m *Member) Reset()

func (*Member) Size

func (m *Member) Size() (n int)

func (*Member) String

func (this *Member) String() string

func (*Member) Unmarshal

func (m *Member) Unmarshal(dAtA []byte) error

func (*Member) XXX_DiscardUnknown

func (m *Member) XXX_DiscardUnknown()

func (*Member) XXX_Marshal

func (m *Member) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Member) XXX_Merge

func (m *Member) XXX_Merge(src proto.Message)

func (*Member) XXX_Size

func (m *Member) XXX_Size() int

func (*Member) XXX_Unmarshal

func (m *Member) XXX_Unmarshal(b []byte) error

type MemberAvailableEvent

type MemberAvailableEvent struct {
	MemberMeta
}

func (*MemberAvailableEvent) MemberStatusEvent

func (*MemberAvailableEvent) MemberStatusEvent()

type MemberJoinedEvent

type MemberJoinedEvent struct {
	MemberMeta
}

func (*MemberJoinedEvent) MemberStatusEvent

func (*MemberJoinedEvent) MemberStatusEvent()

type MemberLeftEvent

type MemberLeftEvent struct {
	MemberMeta
}

func (*MemberLeftEvent) MemberStatusEvent

func (*MemberLeftEvent) MemberStatusEvent()

type MemberList

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

MemberList is responsible to keep track of the current cluster topology it does so by listening to changes from the ClusterProvider. the default ClusterProvider is consul.ConsulProvider which uses the Consul HTTP API to scan for changes

func NewMemberList

func NewMemberList(cluster *Cluster) *MemberList

func (*MemberList) BroadcastEvent

func (ml *MemberList) BroadcastEvent(message interface{})

func (*MemberList) Length

func (ml *MemberList) Length() int

func (*MemberList) UpdateClusterTopology

func (ml *MemberList) UpdateClusterTopology(members []*Member, eventId uint64)

type MemberMeta

type MemberMeta struct {
	Host  string
	Port  int
	Kinds []string
}

func (*MemberMeta) GetKinds

func (e *MemberMeta) GetKinds() []string

func (*MemberMeta) Name

func (e *MemberMeta) Name() string

type MemberRejoinedEvent

type MemberRejoinedEvent struct {
	MemberMeta
}

func (*MemberRejoinedEvent) MemberStatusEvent

func (*MemberRejoinedEvent) MemberStatusEvent()

type MemberStatus

type MemberStatus struct {
	Member
	MemberID string // for compatibility
	Alive    bool
}

func (*MemberStatus) Address

func (m *MemberStatus) Address() string

type MemberStatusEvent

type MemberStatusEvent interface {
	MemberStatusEvent()
	GetKinds() []string
}

type MemberStrategy

type MemberStrategy interface {
	GetAllMembers() []*Member
	// AddMember(member *Member)
	// UpdateMember(member *Member)
	// RemoveMember(member *Member)
	GetPartition(key string) string
	GetActivator() string
}

type MemberUnavailableEvent

type MemberUnavailableEvent struct {
	MemberMeta
}

func (*MemberUnavailableEvent) MemberStatusEvent

func (*MemberUnavailableEvent) MemberStatusEvent()

type PartitionKind

type PartitionKind struct {
	Kind string
	// contains filtered or unexported fields
}

func (*PartitionKind) PidOfIdentityActor

func (pm *PartitionKind) PidOfIdentityActor(addr string) *actor.PID

PidOfIdentityActor ...

func (*PartitionKind) PidOfPlacementActor

func (pm *PartitionKind) PidOfPlacementActor(addr string) *actor.PID

PidOfPlacementActor ...

type PartitionManager

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

func (*PartitionManager) PidOfIdentityActor

func (pm *PartitionManager) PidOfIdentityActor(kind, addr string) *actor.PID

PidOfIdentityActor ...

func (*PartitionManager) Start

func (pm *PartitionManager) Start()

Start ...

func (*PartitionManager) Stop

func (pm *PartitionManager) Stop()

Stop ...

type Rendezvous

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

func NewRendezvous

func NewRendezvous(memberStrategy MemberStrategy) *Rendezvous

func (*Rendezvous) GetByRdv

func (r *Rendezvous) GetByRdv(key string) string

Get returns the node with the highest score for the given key. If this Hash has no nodes, an empty string is returned.

func (*Rendezvous) UpdateRdv

func (r *Rendezvous) UpdateRdv()

type RendezvousV2

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

RendezvousV2 ...

func NewRendezvousV2

func NewRendezvousV2(members []*Member) *RendezvousV2

NewRendezvousV2 ...

func (*RendezvousV2) Get

func (r *RendezvousV2) Get(key string) string

Get ...

type SimpleRoundRobin

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

func NewSimpleRoundRobin

func NewSimpleRoundRobin(memberStrategy MemberStrategy) *SimpleRoundRobin

func (*SimpleRoundRobin) GetByRoundRobin

func (r *SimpleRoundRobin) GetByRoundRobin() string

type TakeOwnership

type TakeOwnership struct {
	Pid  *actor.PID `protobuf:"bytes,1,opt,name=pid,proto3" json:"pid,omitempty"`
	Name string     `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
}

func (*TakeOwnership) Descriptor

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

func (*TakeOwnership) Equal

func (this *TakeOwnership) Equal(that interface{}) bool

func (*TakeOwnership) GetName

func (m *TakeOwnership) GetName() string

func (*TakeOwnership) GetPid

func (m *TakeOwnership) GetPid() *actor.PID

func (*TakeOwnership) Marshal

func (m *TakeOwnership) Marshal() (dAtA []byte, err error)

func (*TakeOwnership) MarshalTo

func (m *TakeOwnership) MarshalTo(dAtA []byte) (int, error)

func (*TakeOwnership) ProtoMessage

func (*TakeOwnership) ProtoMessage()

func (*TakeOwnership) Reset

func (m *TakeOwnership) Reset()

func (*TakeOwnership) Size

func (m *TakeOwnership) Size() (n int)

func (*TakeOwnership) String

func (this *TakeOwnership) String() string

func (*TakeOwnership) Unmarshal

func (m *TakeOwnership) Unmarshal(dAtA []byte) error

func (*TakeOwnership) XXX_DiscardUnknown

func (m *TakeOwnership) XXX_DiscardUnknown()

func (*TakeOwnership) XXX_Marshal

func (m *TakeOwnership) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TakeOwnership) XXX_Merge

func (m *TakeOwnership) XXX_Merge(src proto.Message)

func (*TakeOwnership) XXX_Size

func (m *TakeOwnership) XXX_Size() int

func (*TakeOwnership) XXX_Unmarshal

func (m *TakeOwnership) XXX_Unmarshal(b []byte) error

type TopologyEvent

type TopologyEvent []*Member

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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