transport

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK            int32 = 200
	StatusDuplicate           = 409
	StatusMsgSizeToBig        = 413
	StatusInternalError       = 500
)

Variables

This section is empty.

Functions

func AddLog

func AddLog(logs []*pb.Log, Level pb.Log_Level, msg string, args ...interface{}) []*pb.Log

AddLog appends a log entry to the log list

func CreateConfirm

func CreateConfirm(id, processid string, status int32, text string, params ...interface{}) (*pb.Confirm, error)

CreateConfirm create a new pb.Confirm object and add one log entry

func PrintLogs

func PrintLogs(logger *log.Logger, logs []*pb.Log)

PrintLogs prints all log entries to logging framework

Types

type AttachmentProcessor

type AttachmentProcessor func(context.Context, *pb.Attachment) (*pb.Confirm, error)

AttachmentProcessor describes a function which takes an attachment and transmits it.

type InboundPlugin

type InboundPlugin interface {
	Processor
}

InboundPlugin describes a plugin which processes received messages and attachments.

type Lister

type Lister interface {
	// ListMessages lists all found messages.
	ListMessages(ctx context.Context) ([]*pb.Message, error)
	// ListAttachments lists all found attachments.
	ListAttachments(ctx context.Context) ([]*pb.Attachment, error)
}

Lister is the interface implemented by an Plugin that supports listing messages and attachments.

type MessageProcessor

type MessageProcessor func(context.Context, *pb.Message) (*pb.Confirm, error)

MessageProcessor describes a function which takes an message and transmits it.

type OutboundPlugin

type OutboundPlugin interface {
	Lister
	Processor
}

OutboundPlugin is the interface that groups the basic List and Process methods.

type Processor

type Processor interface {
	// ProcessMessage processes an message.
	ProcessMessage(context.Context, *pb.Message) (*pb.Confirm, error)
	// ProcessAttachmetn processes an attachment.
	ProcessAttachment(context.Context, *pb.Attachment) (*pb.Confirm, error)
}

Processor is the interface implemented by an Plugin that supports processing messages and attachments.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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