valuerpc

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: 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 added in v1.3.1

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

func VerifyArg added in v1.3.1

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

func VerifyArgs added in v1.3.1

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

func VerifyParam added in v1.3.1

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

func VerifyParams added in v1.3.1

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

Types

type AnyDef added in v1.3.1

type AnyDef struct {
}

func (AnyDef) UserTypeDef added in v1.3.1

func (t AnyDef) UserTypeDef()

type ArgDef added in v1.3.1

type ArgDef struct {
	Kind     value.Kind
	Required bool
}

func Arg added in v1.3.1

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

func (ArgDef) UserTypeDef added in v1.3.1

func (t ArgDef) UserTypeDef()

type ArgsDef added in v1.3.1

type ArgsDef struct {
	List []ArgDef
}

func List added in v1.3.1

func List(args ...ArgDef) ArgsDef

func (ArgsDef) UserTypeDef added in v1.3.1

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 added in v1.3.1

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

func Param added in v1.3.1

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

type ParamsDef added in v1.3.1

type ParamsDef struct {
	Map []ParamDef
}

func Map added in v1.3.1

func Map(params ...ParamDef) ParamsDef

func (ParamsDef) UserTypeDef added in v1.3.1

func (t ParamsDef) UserTypeDef()

type TypeDef added in v1.3.1

type TypeDef interface {
	UserTypeDef()
}

type VoidDef added in v1.3.1

type VoidDef struct {
}

func (VoidDef) UserTypeDef added in v1.3.1

func (t VoidDef) UserTypeDef()

Jump to

Keyboard shortcuts

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