valueserver

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFunctionAlreadyExist = errors.New("function already exist")
View Source
var IncomingQueueCap = 4096
View Source
var OutgoingQueueCap = 4096

Functions

func FunctionError

func FunctionError(requestId value.Number, format string, args ...interface{}) value.Map

func FunctionResult

func FunctionResult(requestId value.Number, result value.Value) value.Map

func NewServingClient

func NewServingClient(clientId int64, conn vrpc.MsgConn, functionMap *sync.Map, logger *zap.Logger) *servingClient

func NewServingRequest

func NewServingRequest(ft functionType, requestId value.Number) *servingRequest

func StreamEnd

func StreamEnd(requestId value.Number, val value.Value) value.Map

func StreamReady

func StreamReady(requestId value.Number) value.Map

func StreamValue

func StreamValue(requestId value.Number, val value.Value) value.Map

Types

type Chat

type Chat func(args value.Value, inC <-chan value.Value) (<-chan value.Value, error)

type Function

type Function func(args value.Value) (value.Value, error)

type IncomingStream

type IncomingStream func(args value.Value, inC <-chan value.Value) error

type OutgoingStream

type OutgoingStream func(args value.Value) (<-chan value.Value, error)

type Server

type Server interface {
	AddFunction(name string, args valuerpc.TypeDef, res valuerpc.TypeDef, cb Function) error

	// GET for client
	AddOutgoingStream(name string, args valuerpc.TypeDef, cb OutgoingStream) error

	// PUT for client
	AddIncomingStream(name string, args valuerpc.TypeDef, cb IncomingStream) error

	// Dual channel chat
	AddChat(name string, args valuerpc.TypeDef, cb Chat) error

	Run() error

	Close() error
}

func NewDevelopmentServer

func NewDevelopmentServer(address string) (Server, error)

func NewServer

func NewServer(address string, logger *zap.Logger) (Server, error)

Jump to

Keyboard shortcuts

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