apiconsumer

package
v0.0.0-...-9835270 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APITypeMin int8 = iota

	APITypeAuth
	APITypeExternal
	APITypeInternal
	APITypeInternalAuth
	APITypeDownload
	APITypeUpload
	APITypeFed

	APITypeMax
)

Variables

This section is empty.

Functions

func ForeachAPIProcessor

func ForeachAPIProcessor(h func(p APIProcessor) bool)

func SetAPIProcessor

func SetAPIProcessor(p APIProcessor)

Types

type APIConsumer

type APIConsumer struct {
	Cfg    config.Dendrite
	RpcCli *common.RpcClient
	// contains filtered or unexported fields
}

func (*APIConsumer) GetCfg

func (c *APIConsumer) GetCfg() config.Dendrite

func (*APIConsumer) GetRpcCli

func (c *APIConsumer) GetRpcCli() *common.RpcClient

func (*APIConsumer) Init

func (c *APIConsumer) Init(name string, ud interface{}, topic string)

func (*APIConsumer) InitGroup

func (c *APIConsumer) InitGroup(name string, ud interface{}, topic, grp string)

func (*APIConsumer) OnMessage

func (c *APIConsumer) OnMessage(ctx context.Context, topic string, partition int32, data []byte) []byte

func (*APIConsumer) RegisterHandler

func (c *APIConsumer) RegisterHandler(msgType int32, p APIProcessor)

func (*APIConsumer) SetupTransport

func (c *APIConsumer) SetupTransport()

func (*APIConsumer) Start

func (c *APIConsumer) Start()

type APIEvent

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

type APIProcessor

type APIProcessor interface {
	GetRoute() string
	GetMetricsName() string
	GetMsgType() int32
	GetAPIType() int8
	GetMethod() []string
	GetTopic(cft *config.Dendrite) string
	NewRequest() core.Coder
	FillRequest(coder core.Coder, req *http.Request, vars map[string]string) error
	NewResponse(code int) core.Coder
	// GetPath valid: r0 v1 inr0 sys unstable mediaR0 mediaV1 fedV1
	GetPrefix() []string

	Process(ctx context.Context, ud interface{}, msg core.Coder, device *authtypes.Device) (int, core.Coder)
}

func GetAPIProcessor

func GetAPIProcessor(msgType int32) APIProcessor

Jump to

Keyboard shortcuts

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