valuerpc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

* * Copyright 2020-present Arpabet Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *

Index

Constants

This section is empty.

Variables

View Source
var (
	Any  = AnyDef{}
	Void = VoidDef{}

	Bool    = Arg(value.BOOL, true)
	BoolOpt = Arg(value.BOOL, false)

	Number    = Arg(value.NUMBER, true)
	NumberOpt = Arg(value.NUMBER, false)

	String    = Arg(value.STRING, true)
	StringOpt = Arg(value.STRING, false)
)
View Source
var ArgumentsField = "args" // allow multiple args if List value in function call
View Source
var ClientIdField = "cid"
View Source
var ErrorField = "err"
View Source
var FunctionNameField = "fn"
View Source
var HandshakeRequestId = int64(-1)
View Source
var Magic = "vRPC"
View Source
var MagicField = "m"
View Source
var MessageTypeField = "t"
View Source
var RequestIdField = "rid"
View Source
var ResultField = "res" // allow multiple results if List in function call
View Source
var TimeoutField = "sla"
View Source
var ValueField = "val" // streaming value field
View Source
var Version = 1.0
View Source
var VersionField = "v"

Functions

func NewHandshakeRequest

func NewHandshakeRequest(clientId int64) value.Map

func NewHandshakeResponse

func NewHandshakeResponse() value.Map

func ValidMagicAndVersion

func ValidMagicAndVersion(req value.Map) bool

func Verify

func Verify(args value.Value, def TypeDef) bool

func VerifyArg

func VerifyArg(arg value.Value, def ArgDef) bool

func VerifyArgs

func VerifyArgs(args value.Value, argsDef ArgsDef) bool

func VerifyParam

func VerifyParam(value value.Value, def ParamDef) bool

func VerifyParams

func VerifyParams(args value.Value, paramsDef ParamsDef) bool

Types

type AnyDef

type AnyDef struct {
}

func (AnyDef) UserTypeDef

func (t AnyDef) UserTypeDef()

type ArgDef

type ArgDef struct {
	Kind     value.Kind
	Required bool
}

func Arg

func Arg(kind value.Kind, required bool) ArgDef

func (ArgDef) UserTypeDef

func (t ArgDef) UserTypeDef()

type ArgsDef

type ArgsDef struct {
	List []ArgDef
}

func List

func List(args ...ArgDef) ArgsDef

func (ArgsDef) UserTypeDef

func (t ArgsDef) UserTypeDef()

type MessageType

type MessageType int64
const (
	HandshakeRequest MessageType = iota
	HandshakeResponse
	FunctionRequest
	FunctionResponse
	GetStreamRequest
	PutStreamRequest
	ChatRequest
	ErrorResponse
	StreamReady
	StreamValue
	StreamEnd
	CancelRequest
	ThrottleIncrease
	ThrottleDecrease
)

func (MessageType) Long

func (t MessageType) Long() value.Number

type MsgConn

type MsgConn interface {
	ReadMessage() (value.Map, error)

	WriteMessage(msg value.Map) error

	Close() error

	Conn() net.Conn
}

func NewMsgConn

func NewMsgConn(conn net.Conn) MsgConn

type ParamDef

type ParamDef struct {
	Name     string
	Kind     value.Kind
	Required bool
}

func Param

func Param(name string, kind value.Kind, required bool) ParamDef

type ParamsDef

type ParamsDef struct {
	Map []ParamDef
}

func Map

func Map(params ...ParamDef) ParamsDef

func (ParamsDef) UserTypeDef

func (t ParamsDef) UserTypeDef()

type TypeDef

type TypeDef interface {
	UserTypeDef()
}

type VoidDef

type VoidDef struct {
}

func (VoidDef) UserTypeDef

func (t VoidDef) UserTypeDef()

Jump to

Keyboard shortcuts

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