Documentation ¶
Overview ¶
Package reminder is a generated protocol buffer package.
It is generated from these files:
messages.proto
It has these top-level messages:
Reminder Remind Reminded Snapshot
Index ¶
- Variables
- func Middleware(reminder *actor.PID) func(next actor.ActorFunc) actor.ActorFunc
- func Producer(window time.Duration) func() actor.Actor
- type Mixin
- type Remind
- func (*Remind) Descriptor() ([]byte, []int)
- func (this *Remind) Equal(that interface{}) bool
- func (m *Remind) GetName() string
- func (this *Remind) GoString() string
- func (m *Remind) Marshal() (dAtA []byte, err error)
- func (m *Remind) MarshalTo(dAtA []byte) (int, error)
- func (*Remind) ProtoMessage()
- func (m *Remind) Reset()
- func (m *Remind) Size() (n int)
- func (this *Remind) String() string
- func (m *Remind) Unmarshal(dAtA []byte) error
- type Reminded
- func (*Reminded) Descriptor() ([]byte, []int)
- func (this *Reminded) Equal(that interface{}) bool
- func (m *Reminded) GetAt() *google_protobuf1.Timestamp
- func (this *Reminded) GoString() string
- func (m *Reminded) Marshal() (dAtA []byte, err error)
- func (m *Reminded) MarshalTo(dAtA []byte) (int, error)
- func (*Reminded) ProtoMessage()
- func (m *Reminded) Reset()
- func (m *Reminded) Size() (n int)
- func (this *Reminded) String() string
- func (m *Reminded) Unmarshal(dAtA []byte) error
- type Reminder
- func (*Reminder) Descriptor() ([]byte, []int)
- func (this *Reminder) Equal(that interface{}) bool
- func (m *Reminder) GetAt() *google_protobuf1.Timestamp
- func (m *Reminder) GetCollate() bool
- func (m *Reminder) GetName() string
- func (m *Reminder) GetReceiver() *actor.PID
- func (this *Reminder) GoString() string
- func (m *Reminder) Marshal() (dAtA []byte, err error)
- func (m *Reminder) MarshalTo(dAtA []byte) (int, error)
- func (*Reminder) ProtoMessage()
- func (m *Reminder) Reset()
- func (m *Reminder) Size() (n int)
- func (this *Reminder) String() string
- func (m *Reminder) Unmarshal(dAtA []byte) error
- type Snapshot
- func (*Snapshot) Descriptor() ([]byte, []int)
- func (this *Snapshot) Equal(that interface{}) bool
- func (m *Snapshot) GetAt() *google_protobuf1.Timestamp
- func (m *Snapshot) GetReminds() []*Reminder
- func (this *Snapshot) GoString() string
- func (m *Snapshot) Marshal() (dAtA []byte, err error)
- func (m *Snapshot) MarshalTo(dAtA []byte) (int, error)
- func (*Snapshot) ProtoMessage()
- func (m *Snapshot) Reset()
- func (m *Snapshot) Size() (n int)
- func (this *Snapshot) String() string
- func (m *Snapshot) Unmarshal(dAtA []byte) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidLengthMessages = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMessages = fmt.Errorf("proto: integer overflow") )
Functions ¶
func Middleware ¶
Middleware middleware
Example ¶
package main import ( "fmt" "os" "sync" "time" "github.com/AsynkronIT/protoactor-go/actor" "github.com/AsynkronIT/protoactor-go/persistence" reminder "github.com/artyomturkin/protoactor-go-reminder" ) type exampleActor struct { reminder.Mixin wg *sync.WaitGroup } type ExampleMessage struct{} func (r *exampleActor) Receive(ctx actor.Context) { switch msg := ctx.Message().(type) { case *ExampleMessage: r.RemindMe("hello", 1*time.Millisecond, false) case *reminder.Remind: if msg.Name == "hello" { fmt.Printf("Received reminder %s\n", msg.Name) r.wg.Done() } } } func exampleActorProducer(wg *sync.WaitGroup) func() actor.Actor { return func() actor.Actor { return &exampleActor{wg: wg} } } func main() { remProps := actor.FromProducer(reminder.Producer(10 * time.Millisecond)). WithMiddleware(persistence.Using(newProvider(5))) rem, err := actor.SpawnNamed(remProps, "reminder") if err != nil { fmt.Printf("failed to spawn reminder: %v", err) os.Exit(1) } wg := &sync.WaitGroup{} recProps := actor.FromProducer(exampleActorProducer(wg)). WithMiddleware(reminder.Middleware(rem)) rec, err := actor.SpawnNamed(recProps, "receiver") if err != nil { fmt.Printf("failed to spawn receiver: %v", err) os.Exit(1) } rems := 2 wg.Add(rems) for i := 0; i < rems; i++ { rec.Tell(&ExampleMessage{}) } wg.Wait() rem.GracefulPoison() rec.GracefulPoison() }
Output: Received reminder hello Received reminder hello
Types ¶
type Mixin ¶
type Mixin struct {
// contains filtered or unexported fields
}
Mixin provides reminder service to actor
type Remind ¶
type Remind struct {
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
}
func (*Remind) Descriptor ¶
func (*Remind) ProtoMessage ¶
func (*Remind) ProtoMessage()
type Reminded ¶
type Reminded struct {
At *google_protobuf1.Timestamp `protobuf:"bytes,2,opt,name=At" json:"At,omitempty"`
}
func (*Reminded) Descriptor ¶
func (*Reminded) GetAt ¶
func (m *Reminded) GetAt() *google_protobuf1.Timestamp
func (*Reminded) ProtoMessage ¶
func (*Reminded) ProtoMessage()
type Reminder ¶
type Reminder struct { Receiver *actor.PID `protobuf:"bytes,1,opt,name=Receiver" json:"Receiver,omitempty"` At *google_protobuf1.Timestamp `protobuf:"bytes,2,opt,name=At" json:"At,omitempty"` Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"` Collate bool `protobuf:"varint,4,opt,name=Collate,proto3" json:"Collate,omitempty"` }
func (*Reminder) Descriptor ¶
func (*Reminder) GetAt ¶
func (m *Reminder) GetAt() *google_protobuf1.Timestamp
func (*Reminder) GetCollate ¶
func (*Reminder) GetReceiver ¶
func (*Reminder) ProtoMessage ¶
func (*Reminder) ProtoMessage()
type Snapshot ¶
type Snapshot struct { Reminds []*Reminder `protobuf:"bytes,1,rep,name=Reminds" json:"Reminds,omitempty"` At *google_protobuf1.Timestamp `protobuf:"bytes,2,opt,name=At" json:"At,omitempty"` }
func (*Snapshot) Descriptor ¶
func (*Snapshot) GetAt ¶
func (m *Snapshot) GetAt() *google_protobuf1.Timestamp
func (*Snapshot) GetReminds ¶
func (*Snapshot) ProtoMessage ¶
func (*Snapshot) ProtoMessage()
Click to show internal directories.
Click to hide internal directories.