imparse

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEnvType = errors.New("unsupported event type")
	ErrorChType  = errors.New("unsupported channel type")
	ErrorMsgType = errors.New("unsupported message type")

	ErrExecSupport          = errors.New("biz proto exec not support")
	ErrMsgTypeSupport       = errors.New("biz msg type not support")
	ErrAppTypeSupport       = errors.New("app type not support")
	ErrPermissionDeny       = errors.New("permission deny")
	ErrGroupMemberNotExists = errors.New("group member not exists")
)
View Source
var ChannelTypeName = map[Channel]string{
	Undefined: "Undefined",
	UniCast:   "UniCast",
	GroupCast: "GroupCast",
}

Functions

This section is empty.

Types

type ActionFilter

type ActionFilter interface {
	FrameFilters(tp FrameType) []Filter
}

type Answer

type Answer interface {
	Check(context.Context, Checker, Frame) error
	Filter(context.Context, Frame) (uint64, error)
	Transport(context.Context, Frame) error
	Ack(context.Context, Frame) (int64, error)
}

type BizProto

type BizProto interface {
	AckBody() ([]byte, error)
	PushBody() ([]byte, error)
}

type Cache

type Cache interface {
	GetMsg(ctx context.Context, from, seq string) (*MsgIndex, error)
	AddMsg(ctx context.Context, uid string, m *MsgIndex) error
	GetMid(ctx context.Context) (id int64, err error)
}

type Channel

type Channel int
const (
	Undefined Channel = 0
	UniCast   Channel = 1
	GroupCast Channel = 2
)

func (Channel) String

func (ch Channel) String() string

type Checker

type Checker interface {
	CheckFrame(frame Frame) error
}

type DB

type DB interface {
	SaveMsg(deviceType auth.Device, frame Frame) error
}

type Exec

type Exec interface {
	Transport(ctx context.Context, id int64, key, from, target string, ch Channel, frameType FrameType, data []byte) error
	RevAck(ctx context.Context, id int64, keys []string, data []byte) error
}

type Filter

type Filter func(ctx context.Context, frame Frame) error

type Frame

type Frame interface {
	Type() FrameType
	Filter(ctx context.Context, db Cache, filters ...Filter) (uint64, error)
	Transport(ctx context.Context, exec Exec) error
	Ack(ctx context.Context, exec Exec) (int64, error)
}

type FrameType

type FrameType string

type MsgIndex

type MsgIndex struct {
	Mid        string
	Seq        string
	SenderId   string
	CreateTime uint64
}

type Pusher

type Pusher interface {
}

type StandardAnswer

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

implement

func NewStandardAnswer

func NewStandardAnswer(cache Cache, exec Exec, trace Trace, filters map[FrameType][]Filter) *StandardAnswer

func (*StandardAnswer) Ack

func (s *StandardAnswer) Ack(ctx context.Context, frame Frame) (int64, error)

func (*StandardAnswer) Check

func (s *StandardAnswer) Check(ctx context.Context, checker Checker, frame Frame) error

func (*StandardAnswer) Filter

func (s *StandardAnswer) Filter(ctx context.Context, frame Frame) (uint64, error)

func (*StandardAnswer) FrameFilters

func (s *StandardAnswer) FrameFilters(tp FrameType) []Filter

func (*StandardAnswer) Transport

func (s *StandardAnswer) Transport(ctx context.Context, frame Frame) error

type StandardStorage

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

func NewStandardStorage

func NewStandardStorage(db DB) *StandardStorage

func (*StandardStorage) SaveMsg

func (s *StandardStorage) SaveMsg(ctx context.Context, deviceType auth.Device, frame Frame) error

type Storage

type Storage interface {
	SaveMsg(context.Context, auth.Device, Frame) error
}

type Trace

type Trace interface {
	StartSpanFromContext(ctx context.Context, funcName string) (func(), context.Context)
}

Directories

Path Synopsis
proto
msg

Jump to

Keyboard shortcuts

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