v1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const ProxyWasmABI_0_1_0 string = "proxy_abi_version_0_1_0"

Variables

This section is empty.

Functions

func GetBuffer

func GetBuffer(instance common.WasmInstance, bufferType BufferType) common.IoBuffer

func GetMap

func GetMap(instance common.WasmInstance, mapType MapType) common.HeaderMap

func ProxyAddHeaderMapValue

func ProxyAddHeaderMapValue(instance common.WasmInstance, mapType int32, keyDataPtr int32, keySize int32, valueDataPtr int32, valueSize int32) int32

func ProxyCallForeignFunction

func ProxyCallForeignFunction(instance common.WasmInstance, funcNamePtr int32, funcNameSize int32,
	paramPtr int32, paramSize int32, returnData int32, returnSize int32) int32

func ProxyCancelGrpcCall

func ProxyCancelGrpcCall(instance common.WasmInstance, calloutID int32) int32

func ProxyCloseGrpcCall

func ProxyCloseGrpcCall(instance common.WasmInstance, calloutID int32) int32

func ProxyDefineMetric

func ProxyDefineMetric(instance common.WasmInstance, metricType int32, namePtr int32, nameSize int32, returnMetricId int32) int32

func ProxyDequeueSharedQueue

func ProxyDequeueSharedQueue(instance common.WasmInstance, token int32, dataPtr int32, dataSize int32) int32

func ProxyDone

func ProxyDone(instance common.WasmInstance) int32

func ProxyEnqueueSharedQueue

func ProxyEnqueueSharedQueue(instance common.WasmInstance, token int32, dataPtr int32, dataSize int32) int32

func ProxyGetBufferBytes

func ProxyGetBufferBytes(instance common.WasmInstance, bufferType int32, start int32, length int32, returnBufferData int32, returnBufferSize int32) int32

func ProxyGetCurrentTimeNanoseconds

func ProxyGetCurrentTimeNanoseconds(instance common.WasmInstance, resultUint64Ptr int32) int32

func ProxyGetHeaderMapPairs

func ProxyGetHeaderMapPairs(instance common.WasmInstance, mapType int32, returnDataPtr int32, returnDataSize int32) int32

func ProxyGetHeaderMapValue

func ProxyGetHeaderMapValue(instance common.WasmInstance, mapType int32, keyDataPtr int32, keySize int32, valueDataPtr int32, valueSize int32) int32

func ProxyGetMetric

func ProxyGetMetric(instance common.WasmInstance, metricId int32, resultUint64Ptr int32) int32

func ProxyGetProperty

func ProxyGetProperty(instance common.WasmInstance, keyPtr int32, keySize int32, returnValueData int32, returnValueSize int32) int32

func ProxyGetSharedData

func ProxyGetSharedData(instance common.WasmInstance, keyPtr int32, keySize int32, valuePtr int32, valueSizePtr int32, casPtr int32) int32

func ProxyGrpcCall

func ProxyGrpcCall(instance common.WasmInstance, grpcServiceData int32, grpcServiceSize int32,
	serviceNameData int32, serviceNameSize int32,
	methodData int32, methodSize int32,
	grpcMessageData int32, grpcMessageSize int32,
	timeoutMilliseconds int32, returnCalloutID int32) int32

func ProxyHttpCall

func ProxyHttpCall(instance common.WasmInstance, uriPtr int32, uriSize int32,
	headerPairsPtr int32, headerPairsSize int32, bodyPtr int32, bodySize int32, trailerPairsPtr int32, trailerPairsSize int32,
	timeoutMilliseconds int32, calloutIDPtr int32) int32

func ProxyIncrementMetric

func ProxyIncrementMetric(instance common.WasmInstance, metricId int32, offset int64) int32

func ProxyLog

func ProxyLog(instance common.WasmInstance, level int32, logDataPtr int32, logDataSize int32) int32

func ProxyOpenGrpcStream

func ProxyOpenGrpcStream(instance common.WasmInstance, grpcServiceData int32, grpcServiceSize int32,
	serviceNameData int32, serviceNameSize int32, methodData int32, methodSize int32, returnCalloutID int32) int32

func ProxyRecordMetric

func ProxyRecordMetric(instance common.WasmInstance, metricId int32, value int64) int32

func ProxyRegisterSharedQueue

func ProxyRegisterSharedQueue(instance common.WasmInstance, queueNamePtr int32, queueNameSize int32, tokenPtr int32) int32

func ProxyRemoveHeaderMapValue

func ProxyRemoveHeaderMapValue(instance common.WasmInstance, mapType int32, keyDataPtr int32, keySize int32) int32

func ProxyRemoveMetric

func ProxyRemoveMetric(instance common.WasmInstance, metricID int32) int32

func ProxyRemoveSharedQueue

func ProxyRemoveSharedQueue(instance common.WasmInstance, queueID int32) int32

func ProxyReplaceHeaderMapValue

func ProxyReplaceHeaderMapValue(instance common.WasmInstance, mapType int32, keyDataPtr int32, keySize int32, valueDataPtr int32, valueSize int32) int32

func ProxyResolveSharedQueue

func ProxyResolveSharedQueue(instance common.WasmInstance, queueNamePtr int32, queueNameSize int32, tokenPtr int32) int32

func ProxyResumeDownstream

func ProxyResumeDownstream(instance common.WasmInstance) int32

func ProxyResumeHttpRequest

func ProxyResumeHttpRequest(instance common.WasmInstance) int32

func ProxyResumeHttpResponse

func ProxyResumeHttpResponse(instance common.WasmInstance) int32

func ProxyResumeUpstream

func ProxyResumeUpstream(instance common.WasmInstance) int32

func ProxySendGrpcCallMessage

func ProxySendGrpcCallMessage(instance common.WasmInstance, calloutID int32, data int32, size int32, endOfStream int32) int32

func ProxySendHttpResponse

func ProxySendHttpResponse(instance common.WasmInstance, respCode int32, respCodeDetailPtr int32, respCodeDetailSize int32,
	respBodyPtr int32, respBodySize int32, additionalHeaderMapDataPtr int32, additionalHeaderSize int32, grpcStatus int32) int32

func ProxySetBufferBytes

func ProxySetBufferBytes(instance common.WasmInstance, bufferType int32, start int32, length int32, dataPtr int32, dataSize int32) int32

func ProxySetEffectiveContext

func ProxySetEffectiveContext(instance common.WasmInstance, contextID int32) int32

func ProxySetHeaderMapPairs

func ProxySetHeaderMapPairs(instance common.WasmInstance, mapType int32, ptr int32, size int32) int32

func ProxySetProperty

func ProxySetProperty(instance common.WasmInstance, keyPtr int32, keySize int32, valuePtr int32, valueSize int32) int32

func ProxySetSharedData

func ProxySetSharedData(instance common.WasmInstance, keyPtr int32, keySize int32, valuePtr int32, valueSize int32, cas int32) int32

func ProxySetTickPeriodMilliseconds

func ProxySetTickPeriodMilliseconds(instance common.WasmInstance, tickPeriodMilliseconds int32) int32

func RegisterImports

func RegisterImports(instance common.WasmInstance)

Types

type ABIContext

type ABIContext struct {
	Imports  ImportsHandler
	Instance common.WasmInstance
}

func (*ABIContext) CallWasmFunction

func (a *ABIContext) CallWasmFunction(funcName string, args ...interface{}) (interface{}, Action, error)

func (*ABIContext) GetExports

func (a *ABIContext) GetExports() Exports

func (*ABIContext) GetImports

func (a *ABIContext) GetImports() ImportsHandler

func (*ABIContext) GetInstance

func (a *ABIContext) GetInstance() common.WasmInstance

func (*ABIContext) Name

func (a *ABIContext) Name() string

func (*ABIContext) ProxyOnConfigure

func (a *ABIContext) ProxyOnConfigure(rootContextID int32, configurationSize int32) (int32, error)

func (*ABIContext) ProxyOnContextCreate

func (a *ABIContext) ProxyOnContextCreate(contextID int32, parentContextID int32) error

func (*ABIContext) ProxyOnDelete

func (a *ABIContext) ProxyOnDelete(contextID int32) error

func (*ABIContext) ProxyOnDone

func (a *ABIContext) ProxyOnDone(contextID int32) (int32, error)

func (*ABIContext) ProxyOnDownstreamConnectionClose

func (a *ABIContext) ProxyOnDownstreamConnectionClose(contextID int32, closeType int32) error

func (*ABIContext) ProxyOnDownstreamData

func (a *ABIContext) ProxyOnDownstreamData(contextID int32, dataLength int32, endOfStream int32) (Action, error)

func (*ABIContext) ProxyOnGrpcCallClose

func (a *ABIContext) ProxyOnGrpcCallClose(contextID int32, calloutID int32, statusCode int32) error

func (*ABIContext) ProxyOnGrpcCallResponseHeaderMetadata

func (a *ABIContext) ProxyOnGrpcCallResponseHeaderMetadata(contextID int32, calloutID int32, nElements int32) error

func (*ABIContext) ProxyOnGrpcCallResponseMessage

func (a *ABIContext) ProxyOnGrpcCallResponseMessage(contextID int32, calloutID int32, msgSize int32) error

func (*ABIContext) ProxyOnGrpcCallResponseTrailerMetadata

func (a *ABIContext) ProxyOnGrpcCallResponseTrailerMetadata(contextID int32, calloutID int32, nElements int32) error

func (*ABIContext) ProxyOnHttpCallResponse

func (a *ABIContext) ProxyOnHttpCallResponse(contextID int32, token int32, headers int32, bodySize int32, trailers int32) error

func (*ABIContext) ProxyOnLog

func (a *ABIContext) ProxyOnLog(contextID int32) error

func (*ABIContext) ProxyOnMemoryAllocate

func (a *ABIContext) ProxyOnMemoryAllocate(size int32) (int32, error)

func (*ABIContext) ProxyOnNewConnection

func (a *ABIContext) ProxyOnNewConnection(contextID int32) (Action, error)

func (*ABIContext) ProxyOnQueueReady

func (a *ABIContext) ProxyOnQueueReady(rootContextID int32, token int32) error

func (*ABIContext) ProxyOnRequestBody

func (a *ABIContext) ProxyOnRequestBody(contextID int32, bodyBufferLength int32, endOfStream int32) (Action, error)

func (*ABIContext) ProxyOnRequestHeaders

func (a *ABIContext) ProxyOnRequestHeaders(contextID int32, numHeaders int32, endOfStream int32) (Action, error)

func (*ABIContext) ProxyOnRequestMetadata

func (a *ABIContext) ProxyOnRequestMetadata(contextID int32, nElements int32) (Action, error)

func (*ABIContext) ProxyOnRequestTrailers

func (a *ABIContext) ProxyOnRequestTrailers(contextID int32, trailers int32) (Action, error)

func (*ABIContext) ProxyOnResponseBody

func (a *ABIContext) ProxyOnResponseBody(contextID int32, bodyBufferLength int32, endOfStream int32) (Action, error)

func (*ABIContext) ProxyOnResponseHeaders

func (a *ABIContext) ProxyOnResponseHeaders(contextID int32, headers int32, endOfStream int32) (Action, error)

func (*ABIContext) ProxyOnResponseMetadata

func (a *ABIContext) ProxyOnResponseMetadata(contextID int32, nElements int32) (Action, error)

func (*ABIContext) ProxyOnResponseTrailers

func (a *ABIContext) ProxyOnResponseTrailers(contextID int32, trailers int32) (Action, error)

func (*ABIContext) ProxyOnTick

func (a *ABIContext) ProxyOnTick(rootContextID int32) error

func (*ABIContext) ProxyOnUpstreamConnectionClose

func (a *ABIContext) ProxyOnUpstreamConnectionClose(contextID int32, closeType int32) error

func (*ABIContext) ProxyOnUpstreamData

func (a *ABIContext) ProxyOnUpstreamData(contextID int32, dataLength int32, endOfStream int32) (Action, error)

func (*ABIContext) ProxyOnVmStart

func (a *ABIContext) ProxyOnVmStart(rootContextID int32, vmConfigurationSize int32) (int32, error)

func (*ABIContext) SetImports

func (a *ABIContext) SetImports(imports ImportsHandler)

func (*ABIContext) SetInstance

func (a *ABIContext) SetInstance(instance common.WasmInstance)

type Action

type Action int32
const (
	ActionContinue Action = 0
	ActionPause    Action = 1
)

type BufferType

type BufferType int32
const (
	BufferTypeHttpRequestBody      BufferType = 0
	BufferTypeHttpResponseBody     BufferType = 1
	BufferTypeDownstreamData       BufferType = 2
	BufferTypeUpstreamData         BufferType = 3
	BufferTypeHttpCallResponseBody BufferType = 4
	BufferTypeGrpcReceiveBuffer    BufferType = 5
	BufferTypeVmConfiguration      BufferType = 6
	BufferTypePluginConfiguration  BufferType = 7
	BufferTypeCallData             BufferType = 8
)

type ContextHandler

type ContextHandler interface {
	Name() string

	GetImports() ImportsHandler
	SetImports(imports ImportsHandler)

	GetExports() Exports

	GetInstance() common.WasmInstance
	SetInstance(instance common.WasmInstance)
}

type DefaultImportsHandler

type DefaultImportsHandler struct{}

func (*DefaultImportsHandler) CallForeignFunction

func (d *DefaultImportsHandler) CallForeignFunction(funcName string, param []byte) ([]byte, WasmResult)

func (*DefaultImportsHandler) CancelGrpcCall

func (d *DefaultImportsHandler) CancelGrpcCall(token int32) WasmResult

func (*DefaultImportsHandler) CloseGrpcCall

func (d *DefaultImportsHandler) CloseGrpcCall(token int32) WasmResult

func (*DefaultImportsHandler) DefineMetric

func (d *DefaultImportsHandler) DefineMetric(metricType MetricType, name string) (int32, WasmResult)

func (*DefaultImportsHandler) DequeueSharedQueue

func (d *DefaultImportsHandler) DequeueSharedQueue(queueID uint32) (string, WasmResult)

func (*DefaultImportsHandler) Done

func (*DefaultImportsHandler) EnqueueSharedQueue

func (d *DefaultImportsHandler) EnqueueSharedQueue(queueID uint32, data string) WasmResult

func (*DefaultImportsHandler) GetCurrentTimeNanoseconds

func (d *DefaultImportsHandler) GetCurrentTimeNanoseconds() (int32, WasmResult)

func (*DefaultImportsHandler) GetCustomBuffer

func (d *DefaultImportsHandler) GetCustomBuffer(bufferType BufferType) common.IoBuffer

func (*DefaultImportsHandler) GetCustomHeader

func (d *DefaultImportsHandler) GetCustomHeader(mapType MapType) common.HeaderMap

func (*DefaultImportsHandler) GetDownStreamData

func (d *DefaultImportsHandler) GetDownStreamData() common.IoBuffer

func (*DefaultImportsHandler) GetFuncCallData

func (d *DefaultImportsHandler) GetFuncCallData() common.IoBuffer

func (*DefaultImportsHandler) GetGrpcReceiveBuffer

func (d *DefaultImportsHandler) GetGrpcReceiveBuffer() common.IoBuffer

func (*DefaultImportsHandler) GetGrpcReceiveInitialMetaData

func (d *DefaultImportsHandler) GetGrpcReceiveInitialMetaData() common.HeaderMap

func (*DefaultImportsHandler) GetGrpcReceiveTrailerMetaData

func (d *DefaultImportsHandler) GetGrpcReceiveTrailerMetaData() common.HeaderMap

func (*DefaultImportsHandler) GetHttpCallResponseBody

func (d *DefaultImportsHandler) GetHttpCallResponseBody() common.IoBuffer

func (*DefaultImportsHandler) GetHttpCallResponseHeaders

func (d *DefaultImportsHandler) GetHttpCallResponseHeaders() common.HeaderMap

func (*DefaultImportsHandler) GetHttpCallResponseTrailer

func (d *DefaultImportsHandler) GetHttpCallResponseTrailer() common.HeaderMap

func (*DefaultImportsHandler) GetHttpRequestBody

func (d *DefaultImportsHandler) GetHttpRequestBody() common.IoBuffer

func (*DefaultImportsHandler) GetHttpRequestHeader

func (d *DefaultImportsHandler) GetHttpRequestHeader() common.HeaderMap

func (*DefaultImportsHandler) GetHttpRequestTrailer

func (d *DefaultImportsHandler) GetHttpRequestTrailer() common.HeaderMap

func (*DefaultImportsHandler) GetHttpResponseBody

func (d *DefaultImportsHandler) GetHttpResponseBody() common.IoBuffer

func (*DefaultImportsHandler) GetHttpResponseHeader

func (d *DefaultImportsHandler) GetHttpResponseHeader() common.HeaderMap

func (*DefaultImportsHandler) GetHttpResponseTrailer

func (d *DefaultImportsHandler) GetHttpResponseTrailer() common.HeaderMap

func (*DefaultImportsHandler) GetMetric

func (d *DefaultImportsHandler) GetMetric(metricID int32) (int64, WasmResult)

func (*DefaultImportsHandler) GetPluginConfig

func (d *DefaultImportsHandler) GetPluginConfig() common.IoBuffer

func (*DefaultImportsHandler) GetProperty

func (d *DefaultImportsHandler) GetProperty(key string) (string, WasmResult)

func (*DefaultImportsHandler) GetRootContextID

func (d *DefaultImportsHandler) GetRootContextID() int32

utils

func (*DefaultImportsHandler) GetSharedData

func (d *DefaultImportsHandler) GetSharedData(key string) (string, uint32, WasmResult)

func (*DefaultImportsHandler) GetUpstreamData

func (d *DefaultImportsHandler) GetUpstreamData() common.IoBuffer

func (*DefaultImportsHandler) GetVmConfig

func (d *DefaultImportsHandler) GetVmConfig() common.IoBuffer

func (*DefaultImportsHandler) GrpcCall

func (d *DefaultImportsHandler) GrpcCall(grpcService string, serviceName string, method string, data common.IoBuffer, timeoutMilliseconds int32) (int32, WasmResult)

func (*DefaultImportsHandler) HttpCall

func (d *DefaultImportsHandler) HttpCall(url string, headers common.HeaderMap, body common.IoBuffer, trailer common.HeaderMap, timeoutMilliseconds int32) (int32, WasmResult)

func (*DefaultImportsHandler) IncrementMetric

func (d *DefaultImportsHandler) IncrementMetric(metricID int32, offset int64) WasmResult

func (*DefaultImportsHandler) Log

func (d *DefaultImportsHandler) Log(level LogLevel, msg string) WasmResult

func (*DefaultImportsHandler) OpenGrpcStream

func (d *DefaultImportsHandler) OpenGrpcStream(grpcService string, serviceName string, method string) (int32, WasmResult)

func (*DefaultImportsHandler) RecordMetric

func (d *DefaultImportsHandler) RecordMetric(metricID int32, value int64) WasmResult

func (*DefaultImportsHandler) RegisterSharedQueue

func (d *DefaultImportsHandler) RegisterSharedQueue(queueName string) (uint32, WasmResult)

func (*DefaultImportsHandler) RemoveMetric

func (d *DefaultImportsHandler) RemoveMetric(metricID int32) WasmResult

func (*DefaultImportsHandler) RemoveSharedQueue

func (d *DefaultImportsHandler) RemoveSharedQueue(queueID uint32) WasmResult

func (*DefaultImportsHandler) ResolveSharedQueue

func (d *DefaultImportsHandler) ResolveSharedQueue(queueName string) (uint32, WasmResult)

func (*DefaultImportsHandler) ResumeDownstream

func (d *DefaultImportsHandler) ResumeDownstream() WasmResult

func (*DefaultImportsHandler) ResumeHttpRequest

func (d *DefaultImportsHandler) ResumeHttpRequest() WasmResult

func (*DefaultImportsHandler) ResumeHttpResponse

func (d *DefaultImportsHandler) ResumeHttpResponse() WasmResult

func (*DefaultImportsHandler) ResumeUpstream

func (d *DefaultImportsHandler) ResumeUpstream() WasmResult

func (*DefaultImportsHandler) SendGrpcCallMsg

func (d *DefaultImportsHandler) SendGrpcCallMsg(token int32, data common.IoBuffer, endOfStream int32) WasmResult

func (*DefaultImportsHandler) SendHttpResp

func (d *DefaultImportsHandler) SendHttpResp(respCode int32, respCodeDetail common.IoBuffer, respBody common.IoBuffer, additionalHeaderMap common.HeaderMap, grpcCode int32) WasmResult

func (*DefaultImportsHandler) SetEffectiveContextID

func (d *DefaultImportsHandler) SetEffectiveContextID(contextID int32) WasmResult

func (*DefaultImportsHandler) SetProperty

func (d *DefaultImportsHandler) SetProperty(key string, value string) WasmResult

func (*DefaultImportsHandler) SetSharedData

func (d *DefaultImportsHandler) SetSharedData(key string, value string, cas uint32) WasmResult

func (*DefaultImportsHandler) SetTickPeriodMilliseconds

func (d *DefaultImportsHandler) SetTickPeriodMilliseconds(tickPeriodMilliseconds int32) WasmResult

func (*DefaultImportsHandler) Wait

func (d *DefaultImportsHandler) Wait() Action

for golang host environment, no-op

type Exports

type Exports interface {
	ProxyOnContextCreate(contextID int32, parentContextID int32) error
	ProxyOnDone(contextID int32) (int32, error)
	ProxyOnLog(contextID int32) error
	ProxyOnDelete(contextID int32) error
	ProxyOnMemoryAllocate(size int32) (int32, error)

	ProxyOnVmStart(rootContextID int32, vmConfigurationSize int32) (int32, error)
	ProxyOnConfigure(rootContextID int32, pluginConfigurationSize int32) (int32, error)

	ProxyOnTick(rootContextID int32) error

	ProxyOnNewConnection(contextID int32) (Action, error)

	ProxyOnDownstreamData(contextID int32, dataLength int32, endOfStream int32) (Action, error)
	ProxyOnDownstreamConnectionClose(contextID int32, closeType int32) error

	ProxyOnUpstreamData(contextID int32, dataLength int32, endOfStream int32) (Action, error)
	ProxyOnUpstreamConnectionClose(contextID int32, closeType int32) error

	ProxyOnRequestHeaders(contextID int32, headers int32, endOfStream int32) (Action, error)
	ProxyOnRequestBody(contextID int32, bodyBufferLength int32, endOfStream int32) (Action, error)
	ProxyOnRequestTrailers(contextID int32, trailers int32) (Action, error)
	ProxyOnRequestMetadata(contextID int32, nElements int32) (Action, error)

	ProxyOnResponseHeaders(contextID int32, headers int32, endOfStream int32) (Action, error)
	ProxyOnResponseBody(contextID int32, bodyBufferLength int32, endOfStream int32) (Action, error)
	ProxyOnResponseTrailers(contextID int32, trailers int32) (Action, error)
	ProxyOnResponseMetadata(contextID int32, nElements int32) (Action, error)

	ProxyOnHttpCallResponse(contextID int32, token int32, headers int32, bodySize int32, trailers int32) error

	ProxyOnQueueReady(rootContextID int32, token int32) error

	ProxyOnGrpcCallResponseHeaderMetadata(contextID int32, calloutID int32, nElements int32) error
	ProxyOnGrpcCallResponseMessage(contextID int32, calloutID int32, msgSize int32) error
	ProxyOnGrpcCallResponseTrailerMetadata(contextID int32, calloutID int32, nElements int32) error
	ProxyOnGrpcCallClose(contextID int32, calloutID int32, statusCode int32) error
}

Exports contains ABI that exported by wasm module.

type ImportsHandler

type ImportsHandler interface {
	// utils
	Log(level LogLevel, msg string) WasmResult
	GetRootContextID() int32
	SetEffectiveContextID(contextID int32) WasmResult
	SetTickPeriodMilliseconds(tickPeriodMilliseconds int32) WasmResult
	GetCurrentTimeNanoseconds() (int32, WasmResult)
	Done() WasmResult

	// config
	GetVmConfig() common.IoBuffer
	GetPluginConfig() common.IoBuffer

	// metric
	DefineMetric(metricType MetricType, name string) (int32, WasmResult)
	IncrementMetric(metricID int32, offset int64) WasmResult
	RecordMetric(metricID int32, value int64) WasmResult
	GetMetric(metricID int32) (int64, WasmResult)
	RemoveMetric(metricID int32) WasmResult

	// property
	GetProperty(key string) (string, WasmResult)
	SetProperty(key string, value string) WasmResult

	// l4
	GetDownStreamData() common.IoBuffer
	GetUpstreamData() common.IoBuffer
	ResumeDownstream() WasmResult
	ResumeUpstream() WasmResult

	// http
	GetHttpRequestHeader() common.HeaderMap
	GetHttpRequestBody() common.IoBuffer
	GetHttpRequestTrailer() common.HeaderMap

	GetHttpResponseHeader() common.HeaderMap
	GetHttpResponseBody() common.IoBuffer
	GetHttpResponseTrailer() common.HeaderMap

	HttpCall(url string, headers common.HeaderMap, body common.IoBuffer, trailer common.HeaderMap, timeoutMilliseconds int32) (int32, WasmResult)
	GetHttpCallResponseHeaders() common.HeaderMap
	GetHttpCallResponseBody() common.IoBuffer
	GetHttpCallResponseTrailer() common.HeaderMap

	ResumeHttpRequest() WasmResult
	ResumeHttpResponse() WasmResult
	SendHttpResp(respCode int32, respCodeDetail common.IoBuffer, respBody common.IoBuffer, additionalHeaderMap common.HeaderMap, grpcCode int32) WasmResult

	// grpc
	OpenGrpcStream(grpcService string, serviceName string, method string) (int32, WasmResult)
	SendGrpcCallMsg(token int32, data common.IoBuffer, endOfStream int32) WasmResult
	CancelGrpcCall(token int32) WasmResult
	CloseGrpcCall(token int32) WasmResult

	GrpcCall(grpcService string, serviceName string, method string, data common.IoBuffer, timeoutMilliseconds int32) (int32, WasmResult)
	GetGrpcReceiveInitialMetaData() common.HeaderMap
	GetGrpcReceiveBuffer() common.IoBuffer
	GetGrpcReceiveTrailerMetaData() common.HeaderMap

	// foreign
	CallForeignFunction(funcName string, param []byte) ([]byte, WasmResult)
	GetFuncCallData() common.IoBuffer

	// shared
	GetSharedData(key string) (string, uint32, WasmResult)
	SetSharedData(key string, value string, cas uint32) WasmResult

	RegisterSharedQueue(queueName string) (uint32, WasmResult)
	RemoveSharedQueue(queueID uint32) WasmResult
	ResolveSharedQueue(queueName string) (uint32, WasmResult)
	EnqueueSharedQueue(queueID uint32, data string) WasmResult
	DequeueSharedQueue(queueID uint32) (string, WasmResult)

	// for golang host environment
	// Wait until async call return, eg. sync http call in golang
	Wait() Action

	// custom extension
	GetCustomBuffer(bufferType BufferType) common.IoBuffer
	GetCustomHeader(mapType MapType) common.HeaderMap
}

type LogLevel

type LogLevel uint8
const (
	LogLevelTrace LogLevel = iota
	LogLevelDebug
	LogLevelInfo
	LogLevelWarn
	LogLevelError
	LogLevelCritical
)

type MapType

type MapType int32
const (
	MapTypeHttpRequestHeaders          MapType = 0
	MapTypeHttpRequestTrailers         MapType = 1
	MapTypeHttpResponseHeaders         MapType = 2
	MapTypeHttpResponseTrailers        MapType = 3
	MapTypeGrpcReceiveInitialMetadata  MapType = 4
	MapTypeGrpcReceiveTrailingMetadata MapType = 5
	MapTypeHttpCallResponseHeaders     MapType = 6
	MapTypeHttpCallResponseTrailers    MapType = 7
)

type MetricType

type MetricType int32
const (
	MetricTypeCounter   MetricType = 0
	MetricTypeGauge     MetricType = 1
	MetricTypeHistogram MetricType = 2
	MetricTypeMax       MetricType = 2
)

type WasmResult

type WasmResult int32
const (
	WasmResultOk                   WasmResult = 0
	WasmResultNotFound             WasmResult = 1  // The result could not be found, e.g. a provided key did not appear in a table.
	WasmResultBadArgument          WasmResult = 2  // An argument was bad, e.g. did not not conform to the required range.
	WasmResultSerializationFailure WasmResult = 3  // A protobuf could not be serialized.
	WasmResultParseFailure         WasmResult = 4  // A protobuf could not be parsed.
	WasmResultBadExpression        WasmResult = 5  // A provided expression (e.g. "foo.bar") was illegal or unrecognized.
	WasmResultInvalidMemoryAccess  WasmResult = 6  // A provided memory range was not legal.
	WasmResultEmpty                WasmResult = 7  // Data was requested from an empty container.
	WasmResultCasMismatch          WasmResult = 8  // The provided CAS did not match that of the stored data.
	WasmResultResultMismatch       WasmResult = 9  // Returned result was unexpected, e.g. of the incorrect size.
	WasmResultInternalFailure      WasmResult = 10 // Internal failure: trying check logs of the surrounding system.
	WasmResultBrokenConnection     WasmResult = 11 // The connection/stream/pipe was broken/closed unexpectedly.
	WasmResultUnimplemented        WasmResult = 12 // Feature not implemented.
)

func (WasmResult) Int32

func (wasmResult WasmResult) Int32() int32

Jump to

Keyboard shortcuts

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