defs

package
v0.0.0-...-3337c03 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer interface {
	GetUniqueID() uint64
	GetTalkID() string
	GetUserID() uint64
	SendMessage(msg *customertalkpb.TalkResponse) error
	Remove(msg string)

	CreateTalkFlag() bool
}

type CustomerMD

type CustomerMD interface {
	Setup(mr MainRoutineRunner)
	InstallCustomer(ctx context.Context, customer Customer)
	UninstallCustomer(ctx context.Context, customer Customer)
	CustomerMessageIncoming(ctx context.Context, customer Customer,
		seqID uint64, message *TalkMessageW)
	CustomerClose(ctx context.Context, customer Customer)
}

type CustomerMDI

type CustomerMDI interface {
	MDIBase
	SetCustomerObserver(ob CustomerObserver)
	SendTalkCloseMessage(talkID string)
	SendTalkCreateMessage(talkID string)
}

type CustomerObserver

type CustomerObserver interface {
	OnMessageIncoming(senderUniqueID uint64, talkID string, message *TalkMessageW)
	OnTalkClose(talkID string)
}

type MD

type MD interface {
	Load(ctx context.Context) (err error)
	CustomerMD
	ServicerMD
}

type MDI

type MDI interface {
	CustomerMDI
	ServicerMDI
}

type MDIBase

type MDIBase interface {
	GetM() ModelEx

	Load(ctx context.Context) error

	AddTrackTalk(ctx context.Context, talkID string) error
	RemoveTrackTalk(ctx context.Context, talkID string)

	SendMessage(senderUniqueID uint64, talkID string, message *TalkMessageW)
}

type MainRoutineRunner

type MainRoutineRunner interface {
	Post(func())
}

type Model

type Model interface {
	CreateTalk(ctx context.Context, talkInfo *TalkInfoW) (talkID string, err error)
	OpenTalk(ctx context.Context, talkID string) (err error)
	CloseTalk(ctx context.Context, talkID string) error

	AddTalkMessage(ctx context.Context, talkID string, message *TalkMessageW) (err error)
	GetTalkMessages(ctx context.Context, talkID string, offset, count int64) (messages []*TalkMessageR, err error)

	QueryTalks(ctx context.Context, creatorID, serviceID uint64, talkID string,
		statuses []TalkStatus) (talks []*TalkInfoR, err error)
	GetPendingTalkInfos(ctx context.Context) ([]*TalkInfoR, error)
	UpdateTalkServiceID(ctx context.Context, talkID string, serviceID uint64) (err error)
}

type ModelEx

type ModelEx interface {
	Model

	TalkExists(ctx context.Context, talkID string) (bool, error)
	GetTalkInfo(ctx context.Context, talkID string) (*TalkInfoR, error)
	GetServicerTalkInfos(ctx context.Context, servicerID uint64) ([]*TalkInfoR, error)
	GetTalkServicerID(ctx context.Context, talkID string) (servicerID uint64, err error)
}

type Observer

type Observer interface {
	CustomerObserver
	ServicerObserver
}

type Servicer

type Servicer interface {
	GetUserID() uint64
	GetUniqueID() uint64
	SendMessage(msg *customertalkpb.ServiceResponse) error
	Remove(msg string)
}

type ServicerMD

type ServicerMD interface {
	Setup(mr MainRoutineRunner)
	InstallServicer(ctx context.Context, servicer Servicer)
	UninstallServicer(ctx context.Context, servicer Servicer)
	ServicerAttachTalk(ctx context.Context, talkID string, servicer Servicer)
	ServicerDetachTalk(ctx context.Context, talkID string, servicer Servicer)
	ServicerQueryAttachedTalks(ctx context.Context, servicer Servicer)
	ServicerQueryPendingTalks(ctx context.Context, servicer Servicer)
	ServicerReloadTalk(ctx context.Context, servicer Servicer, talkID string)
	ServiceMessage(ctx context.Context, servicer Servicer, talkID string, seqID uint64, message *TalkMessageW)
}

type ServicerMDI

type ServicerMDI interface {
	MDIBase
	SetServicerObserver(ob ServicerObserver)
	SendServicerAttachMessage(talkID string, servicerID uint64)
	SendServiceDetachMessage(talkID string, servicerID uint64)
}

type ServicerObserver

type ServicerObserver interface {
	OnMessageIncoming(senderUniqueID uint64, talkID string, message *TalkMessageW)

	OnTalkCreate(talkID string)
	OnTalkClose(talkID string)

	OnServicerAttachMessage(talkID string, servicerID uint64)
	OnServicerDetachMessage(talkID string, servicerID uint64)
}

type TalkInfoR

type TalkInfoR struct {
	TalkID    string `bson:"_id"`
	TalkInfoW `bson:"inline"`
}

type TalkInfoW

type TalkInfoW struct {
	Status          TalkStatus `bson:"Status"`
	Title           string     `bson:"Title"`
	StartAt         int64      `bson:"StartAt"`
	FinishedAt      int64      `bson:"FinishedAt"`
	CreatorID       uint64     `bson:"CreatorID"`
	ServiceID       uint64     `bson:"ServiceID"`
	CreatorUserName string     `bson:"CreatorUserName"`
}

type TalkMessageR

type TalkMessageR struct {
	MessageID    string `bson:"_id"`
	TalkMessageW `bson:"inline"`
}

type TalkMessageType

type TalkMessageType int
const (
	TalkMessageTypeUnknown TalkMessageType = iota
	TalkMessageTypeText
	TalkMessageTypeImage
)

type TalkMessageW

type TalkMessageW struct {
	At              int64           `bson:"At"`
	CustomerMessage bool            `bson:"CustomerMessage"`
	Type            TalkMessageType `bson:"Type"`
	SenderID        uint64          `bson:"SenderID"`
	SenderUserName  string          `bson:"SenderUserName"`
	Text            string          `bson:"Text,omitempty"`
	Data            []byte          `bson:"Data,omitempty"`
}

type TalkStatus

type TalkStatus int
const (
	TalkStatusNone TalkStatus = iota
	TalkStatusOpened
	TalkStatusClosed
)

type UserTokenExplain

type UserTokenExplain interface {
	ExplainToken(ctx context.Context, token string, renewToken bool) (newToken string, userID uint64, userName string, err error)
}

type UserTokenExtractor

type UserTokenExtractor interface {
	ExtractTokenFromGRPCContext(ctx context.Context) (token string, err error)
}

type UserTokenHelper

type UserTokenHelper interface {
	UserTokenExtractor
	UserTokenExplain
	ExtractUserFromGRPCContext(ctx context.Context, renewToken bool) (newToken string, userID uint64, userName string, err error)
}

Jump to

Keyboard shortcuts

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