shared

package
v0.0.0-...-f6ceceb Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CalculatorFactory

func CalculatorFactory(factory func() Calculator)

CalculatorFactory produces a Calculator

func RegisterCalculatorServer

func RegisterCalculatorServer(s *grpc.Server, srv CalculatorServer)

func RegisterTrackerServer

func RegisterTrackerServer(s *grpc.Server, srv TrackerServer)

func TrackerFactory

func TrackerFactory(factory func() Tracker)

TrackerFactory produces a Tracker

Types

type CalcGrain

type CalcGrain struct {
	cluster.Grain
	// contains filtered or unexported fields
}

func (*CalcGrain) Add

func (*CalcGrain) GetCurrent

func (c *CalcGrain) GetCurrent(n *Noop, ctx cluster.GrainContext) (*CountResponse, error)

func (*CalcGrain) Init

func (c *CalcGrain) Init(id string)

func (*CalcGrain) Subtract

func (*CalcGrain) Terminate

func (c *CalcGrain) Terminate()

type Calculator

type Calculator interface {
	Init(id string)
	Terminate()

	Add(*NumberRequest, cluster.GrainContext) (*CountResponse, error)

	Subtract(*NumberRequest, cluster.GrainContext) (*CountResponse, error)

	GetCurrent(*Noop, cluster.GrainContext) (*CountResponse, error)
}

Calculator interfaces the services available to the Calculator

type CalculatorActor

type CalculatorActor struct {
	Timeout *time.Duration
	// contains filtered or unexported fields
}

CalculatorActor represents the actor structure

func (*CalculatorActor) Receive

func (a *CalculatorActor) Receive(ctx actor.Context)

Receive ensures the lifecycle of the actor for the received message

type CalculatorClient

type CalculatorClient interface {
	Add(ctx context.Context, in *NumberRequest, opts ...grpc.CallOption) (*CountResponse, error)
	Subtract(ctx context.Context, in *NumberRequest, opts ...grpc.CallOption) (*CountResponse, error)
	GetCurrent(ctx context.Context, in *Noop, opts ...grpc.CallOption) (*CountResponse, error)
}

CalculatorClient is the client API for Calculator service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewCalculatorClient

func NewCalculatorClient(cc *grpc.ClientConn) CalculatorClient

type CalculatorGrain

type CalculatorGrain struct {
	ID string
}

CalculatorGrain holds the base data for the CalculatorGrain

func GetCalculatorGrain

func GetCalculatorGrain(id string) *CalculatorGrain

GetCalculatorGrain instantiates a new CalculatorGrain with given ID

func (*CalculatorGrain) Add

Add requests the execution on to the cluster using default options

func (*CalculatorGrain) AddChan

func (g *CalculatorGrain) AddChan(r *NumberRequest) (<-chan *CountResponse, <-chan error)

AddChan allows to use a channel to execute the method using default options

func (*CalculatorGrain) AddChanWithOpts

func (g *CalculatorGrain) AddChanWithOpts(r *NumberRequest, opts *cluster.GrainCallOptions) (<-chan *CountResponse, <-chan error)

AddChanWithOpts allows to use a channel to execute the method

func (*CalculatorGrain) AddWithOpts

AddWithOpts requests the execution on to the cluster

func (*CalculatorGrain) GetCurrent

func (g *CalculatorGrain) GetCurrent(r *Noop) (*CountResponse, error)

GetCurrent requests the execution on to the cluster using default options

func (*CalculatorGrain) GetCurrentChan

func (g *CalculatorGrain) GetCurrentChan(r *Noop) (<-chan *CountResponse, <-chan error)

GetCurrentChan allows to use a channel to execute the method using default options

func (*CalculatorGrain) GetCurrentChanWithOpts

func (g *CalculatorGrain) GetCurrentChanWithOpts(r *Noop, opts *cluster.GrainCallOptions) (<-chan *CountResponse, <-chan error)

GetCurrentChanWithOpts allows to use a channel to execute the method

func (*CalculatorGrain) GetCurrentWithOpts

func (g *CalculatorGrain) GetCurrentWithOpts(r *Noop, opts *cluster.GrainCallOptions) (*CountResponse, error)

GetCurrentWithOpts requests the execution on to the cluster

func (*CalculatorGrain) Subtract

func (g *CalculatorGrain) Subtract(r *NumberRequest) (*CountResponse, error)

Subtract requests the execution on to the cluster using default options

func (*CalculatorGrain) SubtractChan

func (g *CalculatorGrain) SubtractChan(r *NumberRequest) (<-chan *CountResponse, <-chan error)

SubtractChan allows to use a channel to execute the method using default options

func (*CalculatorGrain) SubtractChanWithOpts

func (g *CalculatorGrain) SubtractChanWithOpts(r *NumberRequest, opts *cluster.GrainCallOptions) (<-chan *CountResponse, <-chan error)

SubtractChanWithOpts allows to use a channel to execute the method

func (*CalculatorGrain) SubtractWithOpts

func (g *CalculatorGrain) SubtractWithOpts(r *NumberRequest, opts *cluster.GrainCallOptions) (*CountResponse, error)

SubtractWithOpts requests the execution on to the cluster

type CalculatorServer

type CalculatorServer interface {
	Add(context.Context, *NumberRequest) (*CountResponse, error)
	Subtract(context.Context, *NumberRequest) (*CountResponse, error)
	GetCurrent(context.Context, *Noop) (*CountResponse, error)
}

CalculatorServer is the server API for Calculator service.

type CountResponse

type CountResponse struct {
	Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
}

func (*CountResponse) Descriptor

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

func (*CountResponse) Equal

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

func (*CountResponse) GetNumber

func (m *CountResponse) GetNumber() int64

func (*CountResponse) GoString

func (this *CountResponse) GoString() string

func (*CountResponse) Marshal

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

func (*CountResponse) MarshalTo

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

func (*CountResponse) MarshalToSizedBuffer

func (m *CountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CountResponse) ProtoMessage

func (*CountResponse) ProtoMessage()

func (*CountResponse) Reset

func (m *CountResponse) Reset()

func (*CountResponse) Size

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

func (*CountResponse) String

func (this *CountResponse) String() string

func (*CountResponse) Unmarshal

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

func (*CountResponse) XXX_DiscardUnknown

func (m *CountResponse) XXX_DiscardUnknown()

func (*CountResponse) XXX_Marshal

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

func (*CountResponse) XXX_Merge

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

func (*CountResponse) XXX_Size

func (m *CountResponse) XXX_Size() int

func (*CountResponse) XXX_Unmarshal

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

type Noop

type Noop struct {
}

func (*Noop) Descriptor

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

func (*Noop) Equal

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

func (*Noop) GoString

func (this *Noop) GoString() string

func (*Noop) Marshal

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

func (*Noop) MarshalTo

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

func (*Noop) MarshalToSizedBuffer

func (m *Noop) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Noop) ProtoMessage

func (*Noop) ProtoMessage()

func (*Noop) Reset

func (m *Noop) Reset()

func (*Noop) Size

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

func (*Noop) String

func (this *Noop) String() string

func (*Noop) Unmarshal

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

func (*Noop) XXX_DiscardUnknown

func (m *Noop) XXX_DiscardUnknown()

func (*Noop) XXX_Marshal

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

func (*Noop) XXX_Merge

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

func (*Noop) XXX_Size

func (m *Noop) XXX_Size() int

func (*Noop) XXX_Unmarshal

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

type NumberRequest

type NumberRequest struct {
	Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
}

func (*NumberRequest) Descriptor

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

func (*NumberRequest) Equal

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

func (*NumberRequest) GetNumber

func (m *NumberRequest) GetNumber() int64

func (*NumberRequest) GoString

func (this *NumberRequest) GoString() string

func (*NumberRequest) Marshal

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

func (*NumberRequest) MarshalTo

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

func (*NumberRequest) MarshalToSizedBuffer

func (m *NumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NumberRequest) ProtoMessage

func (*NumberRequest) ProtoMessage()

func (*NumberRequest) Reset

func (m *NumberRequest) Reset()

func (*NumberRequest) Size

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

func (*NumberRequest) String

func (this *NumberRequest) String() string

func (*NumberRequest) Unmarshal

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

func (*NumberRequest) XXX_DiscardUnknown

func (m *NumberRequest) XXX_DiscardUnknown()

func (*NumberRequest) XXX_Marshal

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

func (*NumberRequest) XXX_Merge

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

func (*NumberRequest) XXX_Size

func (m *NumberRequest) XXX_Size() int

func (*NumberRequest) XXX_Unmarshal

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

type RegisterMessage

type RegisterMessage struct {
	GrainId string `protobuf:"bytes,1,opt,name=grain_id,json=grainId,proto3" json:"grain_id,omitempty"`
}

func (*RegisterMessage) Descriptor

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

func (*RegisterMessage) Equal

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

func (*RegisterMessage) GetGrainId

func (m *RegisterMessage) GetGrainId() string

func (*RegisterMessage) GoString

func (this *RegisterMessage) GoString() string

func (*RegisterMessage) Marshal

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

func (*RegisterMessage) MarshalTo

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

func (*RegisterMessage) MarshalToSizedBuffer

func (m *RegisterMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RegisterMessage) ProtoMessage

func (*RegisterMessage) ProtoMessage()

func (*RegisterMessage) Reset

func (m *RegisterMessage) Reset()

func (*RegisterMessage) Size

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

func (*RegisterMessage) String

func (this *RegisterMessage) String() string

func (*RegisterMessage) Unmarshal

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

func (*RegisterMessage) XXX_DiscardUnknown

func (m *RegisterMessage) XXX_DiscardUnknown()

func (*RegisterMessage) XXX_Marshal

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

func (*RegisterMessage) XXX_Merge

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

func (*RegisterMessage) XXX_Size

func (m *RegisterMessage) XXX_Size() int

func (*RegisterMessage) XXX_Unmarshal

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

type TotalsResponse

type TotalsResponse struct {
	Totals map[string]int64 `` /* 154-byte string literal not displayed */
}

func (*TotalsResponse) Descriptor

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

func (*TotalsResponse) Equal

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

func (*TotalsResponse) GetTotals

func (m *TotalsResponse) GetTotals() map[string]int64

func (*TotalsResponse) GoString

func (this *TotalsResponse) GoString() string

func (*TotalsResponse) Marshal

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

func (*TotalsResponse) MarshalTo

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

func (*TotalsResponse) MarshalToSizedBuffer

func (m *TotalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TotalsResponse) ProtoMessage

func (*TotalsResponse) ProtoMessage()

func (*TotalsResponse) Reset

func (m *TotalsResponse) Reset()

func (*TotalsResponse) Size

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

func (*TotalsResponse) String

func (this *TotalsResponse) String() string

func (*TotalsResponse) Unmarshal

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

func (*TotalsResponse) XXX_DiscardUnknown

func (m *TotalsResponse) XXX_DiscardUnknown()

func (*TotalsResponse) XXX_Marshal

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

func (*TotalsResponse) XXX_Merge

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

func (*TotalsResponse) XXX_Size

func (m *TotalsResponse) XXX_Size() int

func (*TotalsResponse) XXX_Unmarshal

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

type TrackGrain

type TrackGrain struct {
	cluster.Grain
	// contains filtered or unexported fields
}

func (*TrackGrain) BroadcastGetCounts

func (t *TrackGrain) BroadcastGetCounts(n *Noop, ctx cluster.GrainContext) (*TotalsResponse, error)

func (*TrackGrain) DeregisterGrain

func (t *TrackGrain) DeregisterGrain(n *RegisterMessage, ctx cluster.GrainContext) (*Noop, error)

func (*TrackGrain) Init

func (t *TrackGrain) Init(id string)

func (*TrackGrain) RegisterGrain

func (t *TrackGrain) RegisterGrain(n *RegisterMessage, ctx cluster.GrainContext) (*Noop, error)

func (*TrackGrain) Terminate

func (t *TrackGrain) Terminate()

type Tracker

type Tracker interface {
	Init(id string)
	Terminate()

	RegisterGrain(*RegisterMessage, cluster.GrainContext) (*Noop, error)

	DeregisterGrain(*RegisterMessage, cluster.GrainContext) (*Noop, error)

	BroadcastGetCounts(*Noop, cluster.GrainContext) (*TotalsResponse, error)
}

Tracker interfaces the services available to the Tracker

type TrackerActor

type TrackerActor struct {
	Timeout *time.Duration
	// contains filtered or unexported fields
}

TrackerActor represents the actor structure

func (*TrackerActor) Receive

func (a *TrackerActor) Receive(ctx actor.Context)

Receive ensures the lifecycle of the actor for the received message

type TrackerClient

type TrackerClient interface {
	RegisterGrain(ctx context.Context, in *RegisterMessage, opts ...grpc.CallOption) (*Noop, error)
	DeregisterGrain(ctx context.Context, in *RegisterMessage, opts ...grpc.CallOption) (*Noop, error)
	BroadcastGetCounts(ctx context.Context, in *Noop, opts ...grpc.CallOption) (*TotalsResponse, error)
}

TrackerClient is the client API for Tracker service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTrackerClient

func NewTrackerClient(cc *grpc.ClientConn) TrackerClient

type TrackerGrain

type TrackerGrain struct {
	ID string
}

TrackerGrain holds the base data for the TrackerGrain

func GetTrackerGrain

func GetTrackerGrain(id string) *TrackerGrain

GetTrackerGrain instantiates a new TrackerGrain with given ID

func (*TrackerGrain) BroadcastGetCounts

func (g *TrackerGrain) BroadcastGetCounts(r *Noop) (*TotalsResponse, error)

BroadcastGetCounts requests the execution on to the cluster using default options

func (*TrackerGrain) BroadcastGetCountsChan

func (g *TrackerGrain) BroadcastGetCountsChan(r *Noop) (<-chan *TotalsResponse, <-chan error)

BroadcastGetCountsChan allows to use a channel to execute the method using default options

func (*TrackerGrain) BroadcastGetCountsChanWithOpts

func (g *TrackerGrain) BroadcastGetCountsChanWithOpts(r *Noop, opts *cluster.GrainCallOptions) (<-chan *TotalsResponse, <-chan error)

BroadcastGetCountsChanWithOpts allows to use a channel to execute the method

func (*TrackerGrain) BroadcastGetCountsWithOpts

func (g *TrackerGrain) BroadcastGetCountsWithOpts(r *Noop, opts *cluster.GrainCallOptions) (*TotalsResponse, error)

BroadcastGetCountsWithOpts requests the execution on to the cluster

func (*TrackerGrain) DeregisterGrain

func (g *TrackerGrain) DeregisterGrain(r *RegisterMessage) (*Noop, error)

DeregisterGrain requests the execution on to the cluster using default options

func (*TrackerGrain) DeregisterGrainChan

func (g *TrackerGrain) DeregisterGrainChan(r *RegisterMessage) (<-chan *Noop, <-chan error)

DeregisterGrainChan allows to use a channel to execute the method using default options

func (*TrackerGrain) DeregisterGrainChanWithOpts

func (g *TrackerGrain) DeregisterGrainChanWithOpts(r *RegisterMessage, opts *cluster.GrainCallOptions) (<-chan *Noop, <-chan error)

DeregisterGrainChanWithOpts allows to use a channel to execute the method

func (*TrackerGrain) DeregisterGrainWithOpts

func (g *TrackerGrain) DeregisterGrainWithOpts(r *RegisterMessage, opts *cluster.GrainCallOptions) (*Noop, error)

DeregisterGrainWithOpts requests the execution on to the cluster

func (*TrackerGrain) RegisterGrain

func (g *TrackerGrain) RegisterGrain(r *RegisterMessage) (*Noop, error)

RegisterGrain requests the execution on to the cluster using default options

func (*TrackerGrain) RegisterGrainChan

func (g *TrackerGrain) RegisterGrainChan(r *RegisterMessage) (<-chan *Noop, <-chan error)

RegisterGrainChan allows to use a channel to execute the method using default options

func (*TrackerGrain) RegisterGrainChanWithOpts

func (g *TrackerGrain) RegisterGrainChanWithOpts(r *RegisterMessage, opts *cluster.GrainCallOptions) (<-chan *Noop, <-chan error)

RegisterGrainChanWithOpts allows to use a channel to execute the method

func (*TrackerGrain) RegisterGrainWithOpts

func (g *TrackerGrain) RegisterGrainWithOpts(r *RegisterMessage, opts *cluster.GrainCallOptions) (*Noop, error)

RegisterGrainWithOpts requests the execution on to the cluster

type TrackerServer

type TrackerServer interface {
	RegisterGrain(context.Context, *RegisterMessage) (*Noop, error)
	DeregisterGrain(context.Context, *RegisterMessage) (*Noop, error)
	BroadcastGetCounts(context.Context, *Noop) (*TotalsResponse, error)
}

TrackerServer is the server API for Tracker service.

type UnimplementedCalculatorServer

type UnimplementedCalculatorServer struct {
}

UnimplementedCalculatorServer can be embedded to have forward compatible implementations.

func (*UnimplementedCalculatorServer) Add

func (*UnimplementedCalculatorServer) GetCurrent

func (*UnimplementedCalculatorServer) Subtract

type UnimplementedTrackerServer

type UnimplementedTrackerServer struct {
}

UnimplementedTrackerServer can be embedded to have forward compatible implementations.

func (*UnimplementedTrackerServer) BroadcastGetCounts

func (*UnimplementedTrackerServer) BroadcastGetCounts(ctx context.Context, req *Noop) (*TotalsResponse, error)

func (*UnimplementedTrackerServer) DeregisterGrain

func (*UnimplementedTrackerServer) DeregisterGrain(ctx context.Context, req *RegisterMessage) (*Noop, error)

func (*UnimplementedTrackerServer) RegisterGrain

func (*UnimplementedTrackerServer) RegisterGrain(ctx context.Context, req *RegisterMessage) (*Noop, error)

Jump to

Keyboard shortcuts

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