registry

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown = "[unknown]"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

Memory holds the state of the user interaction in-memory.

func NewMemRegistry

func NewMemRegistry() *Memory

NewMemRegistry initialises new in-memory message and user registry.

func (*Memory) IsWaiting

func (reg *Memory) IsWaiting(r tb.Recipient) bool

IsWaiting returns true if we yet expecting to hear from the recipient.

func (*Memory) OutgoingID

func (reg *Memory) OutgoingID(recipient string) (int, bool)

OutgoingID returns the controller's outgoing message ID for the user.

func (*Memory) Register

func (reg *Memory) Register(r tb.Recipient, msgID int) uuid.UUID

Register inserts the message into cache assigning it a random request id.

func (*Memory) RequestFor

func (reg *Memory) RequestFor(r tb.Recipient, msgID int) (uuid.UUID, bool)

RequestFor returns a request id for message ID and a bool. Bool will be true if message is registered and false otherwise.

func (*Memory) RequestInfo

func (reg *Memory) RequestInfo(r tb.Recipient, msgID int) (string, time.Time)

RequestInfo returns a request ID (or <unknown>) and a time of the request (or zero time) by calling parsing functions of the UUID instance.

func (*Memory) SetValue

func (reg *Memory) SetValue(recipient string, value string)

SetValue sets the Controller value.

func (*Memory) StopWait

func (reg *Memory) StopWait(r tb.Recipient) int

StopWait removes the recipient from the wait list.

func (*Memory) Unregister

func (reg *Memory) Unregister(r tb.Recipient, msgID int)

Unregister removes the request from cache.

func (*Memory) Value

func (reg *Memory) Value(recipient string) (string, bool)

Value returns the Controller Value for the recipient.

func (*Memory) Wait

func (reg *Memory) Wait(r tb.Recipient, outboundID int)

Wait places the outbound message ID to the waiting list. MessageID in outbound waiting list means that we expect the user to respond.

func (*Memory) WaitMsgID

func (reg *Memory) WaitMsgID(r tb.Recipient) int

WaitMsgID returns the ID of the message that was sent to the recipient, for which the control awaits the user response.

Jump to

Keyboard shortcuts

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