workerchannel

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// netstring length for a 4194304 bytes payload.
	NS_MESSAGE_MAX_LEN = 4194308
	NS_PAYLOAD_MAX_LEN = 4194304
)
View Source
const (
	NativeJsonVersion = "3.9.0"
	NativeVersion     = "3.10.5"
)
View Source
const (
	ConsumerChannelFd        = 3 // read fd
	ProducerChannelFd        = 4 // write fd
	PayloadConsumerChannelFd = 5
	PayloadProducerChannelFd = 6
)

start from CustomerPipeStart

View Source
const (
	UNDEFINED = "undefined"
)

Variables

This section is empty.

Functions

func ConvertRequestData added in v1.0.6

func ConvertRequestData(request *RequestData) error

func InitChannelHandlers added in v1.0.6

func InitChannelHandlers()

func RegisterHandler added in v1.0.6

func RegisterHandler(id string, h Handler)

func UnregisterHandler added in v1.0.6

func UnregisterHandler(id string)

Types

type Channel

type Channel struct {

	// handle request message
	OnRequestHandler atomic.Value // func(request RequestData) ResponseData
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(netParser netparser.INetParser, id string, jsonFormat bool) *Channel

func (*Channel) Close

func (c *Channel) Close()

func (*Channel) Event

func (c *Channel) Event(targetId int, event string)

func (*Channel) OnRequest

func (c *Channel) OnRequest(fn func(request RequestData) ResponseData)

type Handler added in v1.0.6

type Handler func(request RequestData, response *ResponseData)

func GetChannelRequestHandler added in v1.0.6

func GetChannelRequestHandler(id string) (Handler, error)

type InternalData

type InternalData struct {
	RouterId       string `json:"routerId,omitempty"`
	TransportId    string `json:"transportId,omitempty"`
	ProducerId     string `json:"producerId,omitempty"`
	ConsumerId     string `json:"consumerId,omitempty"`
	DataProducerId string `json:"dataProducerId,omitempty"`
	DataConsumerId string `json:"dataConsumerId,omitempty"`
	RtpObserverId  string `json:"rtpObserverId,omitempty"`
}

func (*InternalData) Unmarshal

func (i *InternalData) Unmarshal(data json.RawMessage) error

type PayloadChannel

type PayloadChannel struct {
}

func NewPayloadChannel

func NewPayloadChannel() *PayloadChannel

type RequestData

type RequestData struct {
	Method    string
	HandlerId string `json:"handlerId,omitempty"`
	Internal  InternalData
	Data      json.RawMessage
}

func (RequestData) String

func (d RequestData) String() string

type ResponseData

type ResponseData struct {
	Err  error
	Data json.RawMessage
}

func (ResponseData) String

func (d ResponseData) String() string

Jump to

Keyboard shortcuts

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