Documentation ¶
Overview ¶
Copyright 2021 Layotto Authors 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.
Copyright 2021 Layotto Authors 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.
Copyright 2021 Layotto Authors 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
- type AbiV2Impl
- type Exports
- type Filter
- func (f *Filter) Append(ctx context.Context, headers api.HeaderMap, buf buffer.IoBuffer, ...) api.StreamFilterStatus
- func (f *Filter) GetHttpRequestBody() common.IoBuffer
- func (f *Filter) GetHttpRequestHeader() common.HeaderMap
- func (f *Filter) GetHttpRequestTrailer() common.HeaderMap
- func (f *Filter) GetHttpResponseBody() common.IoBuffer
- func (f *Filter) GetHttpResponseHeader() common.HeaderMap
- func (f *Filter) GetHttpResponseTrailer() common.HeaderMap
- func (f *Filter) GetPluginConfig() common.IoBuffer
- func (f *Filter) GetRootContextID() int32
- func (f *Filter) GetVmConfig() common.IoBuffer
- func (f *Filter) OnDestroy()
- func (f *Filter) OnReceive(ctx context.Context, headers api.HeaderMap, buf buffer.IoBuffer, ...) api.StreamFilterStatus
- func (f *Filter) SetReceiveFilterHandler(handler api.StreamReceiverFilterHandler)
- func (f *Filter) SetSenderFilterHandler(handler api.StreamSenderFilterHandler)
- type FilterConfigFactory
- func (f *FilterConfigFactory) CreateFilterChain(context context.Context, callbacks api.StreamFilterChainFactoryCallbacks)
- func (f *FilterConfigFactory) GetRootContextID() int32
- func (f *FilterConfigFactory) Install(conf map[string]interface{}) error
- func (f *FilterConfigFactory) IsRegister(id string) bool
- func (f *FilterConfigFactory) OnConfigUpdate(config v2.WasmPluginConfig)
- func (f *FilterConfigFactory) OnPluginDestroy(types.WasmPlugin)
- func (f *FilterConfigFactory) OnPluginStart(plugin types.WasmPlugin)
- func (f *FilterConfigFactory) UnInstall(id string) error
- func (f *FilterConfigFactory) UpdateInstanceNum(id string, instanceNum int) error
- type Group
- type LayottoHandler
- type Router
- type Wasm
- type WasmPlugin
Constants ¶
const AbiV2 = "proxy_abi_version_0_2_0"
const LayottoWasm = "Layotto"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbiV2Impl ¶
type AbiV2Impl struct {
v1.ABIContext
}
easy for extension
func (*AbiV2Impl) GetABIExports ¶ added in v0.2.0
func (a *AbiV2Impl) GetABIExports() interface{}
Get abi
func (*AbiV2Impl) ProxyGetID ¶ added in v0.2.0
Get id
type Filter ¶
type Filter struct { LayottoHandler // contains filtered or unexported fields }
func NewFilter ¶
func NewFilter(ctx context.Context, factory *FilterConfigFactory) *Filter
NewFilter create the filter for a request
func (*Filter) Append ¶
func (f *Filter) Append(ctx context.Context, headers api.HeaderMap, buf buffer.IoBuffer, trailers api.HeaderMap) api.StreamFilterStatus
Append ResponseData of filter
func (*Filter) GetHttpRequestBody ¶
Get the HttpRequest body of proxy-wasm
func (*Filter) GetHttpRequestHeader ¶
Get the HttpRequest header of proxy-wasm
func (*Filter) GetHttpRequestTrailer ¶
Get the HttpRequest trailer of proxy-wasm
func (*Filter) GetHttpResponseBody ¶
Get the HttpResponse body of proxy-wasm
func (*Filter) GetHttpResponseHeader ¶
Get the HttpResponse header of proxy-wasm
func (*Filter) GetHttpResponseTrailer ¶
Get the HttpResponse trailer of proxy-wasm
func (*Filter) GetPluginConfig ¶
Get the used WasmPlugin config of filter
func (*Filter) GetRootContextID ¶
Get RootContext ID of filter's FilterConfigFactory
func (*Filter) GetVmConfig ¶
Get the used WasmPlugin VmConfig of filter
func (*Filter) OnReceive ¶
func (f *Filter) OnReceive(ctx context.Context, headers api.HeaderMap, buf buffer.IoBuffer, trailers api.HeaderMap) api.StreamFilterStatus
Reset the filter when receiving then return StreamFilter status
func (*Filter) SetReceiveFilterHandler ¶
func (f *Filter) SetReceiveFilterHandler(handler api.StreamReceiverFilterHandler)
Set ReceiveFilterHandler of filter
func (*Filter) SetSenderFilterHandler ¶
func (f *Filter) SetSenderFilterHandler(handler api.StreamSenderFilterHandler)
Set SenderFilterHandler of filter
type FilterConfigFactory ¶
type FilterConfigFactory struct { LayottoHandler RootContextID int32 // contains filtered or unexported fields }
FilterConfigFactory contains multi wasm-plugin configs its pointer implement api.StreamFilterChainFactory
func GetFactory ¶ added in v0.5.0
func GetFactory() *FilterConfigFactory
func (*FilterConfigFactory) CreateFilterChain ¶
func (f *FilterConfigFactory) CreateFilterChain(context context.Context, callbacks api.StreamFilterChainFactoryCallbacks)
func (*FilterConfigFactory) GetRootContextID ¶
func (f *FilterConfigFactory) GetRootContextID() int32
Get RootContext's ID
func (*FilterConfigFactory) Install ¶ added in v0.5.0
func (f *FilterConfigFactory) Install(conf map[string]interface{}) error
func (*FilterConfigFactory) IsRegister ¶ added in v0.5.0
func (f *FilterConfigFactory) IsRegister(id string) bool
func (*FilterConfigFactory) OnConfigUpdate ¶
func (f *FilterConfigFactory) OnConfigUpdate(config v2.WasmPluginConfig)
update config of FilterConfigFactory
func (*FilterConfigFactory) OnPluginDestroy ¶
func (f *FilterConfigFactory) OnPluginDestroy(types.WasmPlugin)
Destroy the plugin of FilterConfigFactory
func (*FilterConfigFactory) OnPluginStart ¶
func (f *FilterConfigFactory) OnPluginStart(plugin types.WasmPlugin)
Execute the plugin of FilterConfigFactory
func (*FilterConfigFactory) UnInstall ¶ added in v0.5.0
func (f *FilterConfigFactory) UnInstall(id string) error
func (*FilterConfigFactory) UpdateInstanceNum ¶ added in v0.5.0
func (f *FilterConfigFactory) UpdateInstanceNum(id string, instanceNum int) error
type LayottoHandler ¶
type LayottoHandler struct { proxywasm010.DefaultImportsHandler IoBuffer common.IoBuffer }
LayottoHandler implement proxywasm.ImportsHandler
func (*LayottoHandler) GetFuncCallData ¶ added in v0.2.0
func (d *LayottoHandler) GetFuncCallData() common.IoBuffer
Get the IoBuffer of LayottoHandler
func (*LayottoHandler) GetState ¶ added in v0.3.0
func (d *LayottoHandler) GetState(storeName string, key string) (string, proxywasm.WasmResult)
Obtains the state for a specific key
func (*LayottoHandler) InvokeService ¶ added in v0.3.0
func (d *LayottoHandler) InvokeService(id string, method string, param string) (string, proxywasm.WasmResult)
Do rpc calls
type Router ¶ added in v0.2.0
type Router struct {
// contains filtered or unexported fields
}
func (*Router) GetRandomPluginByID ¶ added in v0.2.0
func (route *Router) GetRandomPluginByID(id string) (*WasmPlugin, error)
Get random plugin with rand id
func (*Router) RegisterRoute ¶ added in v0.2.0
func (route *Router) RegisterRoute(id string, plugin *WasmPlugin)
RegisterRoute register a group with id unsafe for concurrent
func (*Router) RemoveRoute ¶ added in v0.5.0
type Wasm ¶ added in v0.5.0
type Wasm struct {
// contains filtered or unexported fields
}
func GetDefault ¶ added in v0.5.0
func GetDefault() *Wasm
func (*Wasm) AddEndpoint ¶ added in v0.5.0
AddEndpoint add an Endpoint to Wasm。
type WasmPlugin ¶ added in v0.2.0
type WasmPlugin struct {
// contains filtered or unexported fields
}
func (*WasmPlugin) GetPluginConfig ¶ added in v0.2.0
func (p *WasmPlugin) GetPluginConfig() common.IoBuffer
Get the plugin config of WasmPlugin
func (*WasmPlugin) GetVmConfig ¶ added in v0.2.0
func (p *WasmPlugin) GetVmConfig() common.IoBuffer
Get the VmConfig of WasmPlugin