Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit b033777

Browse files
committed
name parameters in examples
Signed-off-by: mathetake <[email protected]>
1 parent 5a98097 commit b033777

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

examples/helloworld/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func newHelloWorld(contextID uint32) proxywasm.RootContext {
3737
}
3838

3939
// override
40-
func (ctx *helloWorld) OnVMStart(int) bool {
40+
func (ctx *helloWorld) OnVMStart(vmConfigurationSize int) bool {
4141
rand.Seed(proxywasm.GetCurrentTime())
4242

4343
proxywasm.LogInfo("proxy_on_vm_start from Go!")

examples/http_auth_random/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func newContext(rootContextID, contextID uint32) proxywasm.HttpContext {
3838
}
3939

4040
// override default
41-
func (ctx *httpAuthRandom) OnHttpRequestHeaders(int, bool) types.Action {
41+
func (ctx *httpAuthRandom) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
4242
hs, err := proxywasm.GetHttpRequestHeaders()
4343
if err != nil {
4444
proxywasm.LogCriticalf("failed to get request headers: %v", err)
@@ -58,7 +58,7 @@ func (ctx *httpAuthRandom) OnHttpRequestHeaders(int, bool) types.Action {
5858
return types.ActionPause
5959
}
6060

61-
func httpCallResponseCallback(_ int, bodySize int, _ int) {
61+
func httpCallResponseCallback(numHeaders, bodySize, numTrailers int) {
6262
hs, err := proxywasm.GetHttpCallResponseHeaders()
6363
if err != nil {
6464

examples/http_headers/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func newContext(rootContextID, contextID uint32) proxywasm.HttpContext {
3434
}
3535

3636
// override
37-
func (ctx *httpHeaders) OnHttpRequestHeaders(int, bool) types.Action {
37+
func (ctx *httpHeaders) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
3838
hs, err := proxywasm.GetHttpRequestHeaders()
3939
if err != nil {
4040
proxywasm.LogCriticalf("failed to get request headers: %v", err)
@@ -47,7 +47,7 @@ func (ctx *httpHeaders) OnHttpRequestHeaders(int, bool) types.Action {
4747
}
4848

4949
// override
50-
func (ctx *httpHeaders) OnHttpResponseHeaders(int, bool) types.Action {
50+
func (ctx *httpHeaders) OnHttpResponseHeaders(numHeaders int, endOfStream bool) types.Action {
5151
hs, err := proxywasm.GetHttpResponseHeaders()
5252
if err != nil {
5353
proxywasm.LogCriticalf("failed to get request headers: %v", err)

examples/metrics/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func newRootContext(uint32) proxywasm.RootContext {
3838
}
3939

4040
// override
41-
func (ctx *metricRootContext) OnVMStart(int) bool {
41+
func (ctx *metricRootContext) OnVMStart(vmConfigurationSize int) bool {
4242
counter = proxywasm.DefineCounterMetric(metricsName)
4343
return true
4444
}
@@ -53,7 +53,7 @@ func newHttpContext(uint32, uint32) proxywasm.HttpContext {
5353
}
5454

5555
// override
56-
func (ctx *metricHttpContext) OnHttpRequestHeaders(int, bool) types.Action {
56+
func (ctx *metricHttpContext) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
5757
prev := counter.Get()
5858
proxywasm.LogInfof("previous value of %s: %d", metricsName, prev)
5959

examples/network/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ type rootContext struct {
3434
proxywasm.DefaultRootContext
3535
}
3636

37-
func newRootContext(uint32) proxywasm.RootContext {
37+
func newRootContext(contextID uint32) proxywasm.RootContext {
3838
return &rootContext{}
3939
}
4040

41-
func (ctx *rootContext) OnVMStart(int) bool {
41+
func (ctx *rootContext) OnVMStart(vmConfigurationSize int) bool {
4242
counter = proxywasm.DefineCounterMetric(connectionCounterName)
4343
return true
4444
}
@@ -48,7 +48,7 @@ type networkContext struct {
4848
proxywasm.DefaultStreamContext
4949
}
5050

51-
func newNetworkContext(uint32, uint32) proxywasm.StreamContext {
51+
func newNetworkContext(rootContextID, contextID uint32) proxywasm.StreamContext {
5252
return &networkContext{}
5353
}
5454

@@ -57,7 +57,7 @@ func (ctx *networkContext) OnNewConnection() types.Action {
5757
return types.ActionContinue
5858
}
5959

60-
func (ctx *networkContext) OnDownstreamData(dataSize int, _ bool) types.Action {
60+
func (ctx *networkContext) OnDownstreamData(dataSize int, endOfStream bool) types.Action {
6161
if dataSize == 0 {
6262
return types.ActionContinue
6363
}
@@ -77,7 +77,7 @@ func (ctx *networkContext) OnDownstreamClose(types.PeerType) {
7777
return
7878
}
7979

80-
func (ctx *networkContext) OnUpstreamData(dataSize int, _ bool) types.Action {
80+
func (ctx *networkContext) OnUpstreamData(dataSize int, endOfStream bool) types.Action {
8181
if dataSize == 0 {
8282
return types.ActionContinue
8383
}

examples/shared_data/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@ type (
3636
}
3737
)
3838

39-
func newRootContext(uint32) proxywasm.RootContext {
39+
func newRootContext(contextID uint32) proxywasm.RootContext {
4040
return &sharedDataRootContext{}
4141
}
4242

43-
func newHttpContext(uint32, uint32) proxywasm.HttpContext {
43+
func newHttpContext(rootContextID, contextID uint32) proxywasm.HttpContext {
4444
return &sharedDataHttpContext{}
4545
}
4646

4747
const sharedDataKey = "shared_data_key"
4848

4949
// override
50-
func (ctx *sharedDataRootContext) OnVMStart(int) bool {
50+
func (ctx *sharedDataRootContext) OnVMStart(vmConfigurationSize int) bool {
5151
if err := proxywasm.SetSharedData(sharedDataKey, []byte{0}, 0); err != nil {
5252
proxywasm.LogWarnf("error setting shared data on OnVMStart: %v", err)
5353
}
5454
return true
5555
}
5656

5757
// override
58-
func (ctx *sharedDataHttpContext) OnHttpRequestHeaders(int, bool) types.Action {
58+
func (ctx *sharedDataHttpContext) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
5959
value, cas, err := proxywasm.GetSharedData(sharedDataKey)
6060
if err != nil {
6161
proxywasm.LogWarnf("error getting shared data on OnHttpRequestHeaders: %v", err)

examples/shared_queue/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func newRootContext(uint32) proxywasm.RootContext {
4141
var queueID uint32
4242

4343
// override
44-
func (ctx *queueRootContext) OnVMStart(int) bool {
44+
func (ctx *queueRootContext) OnVMStart(vmConfigurationSize int) bool {
4545
qID, err := proxywasm.RegisterSharedQueue(queueName)
4646
if err != nil {
4747
panic(err.Error())
@@ -74,7 +74,7 @@ type queueHttpContext struct {
7474
proxywasm.DefaultHttpContext
7575
}
7676

77-
func newHttpContext(uint32, uint32) proxywasm.HttpContext {
77+
func newHttpContext(rootContextID, contextID uint32) proxywasm.HttpContext {
7878
return &queueHttpContext{}
7979
}
8080

proxywasm/hostcall.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import (
2121

2222
// wrappers on the rawhostcall package
2323

24-
func GetPluginConfiguration(dataSize int) ([]byte, error) {
25-
ret, st := getBuffer(types.BufferTypePluginConfiguration, 0, dataSize)
24+
func GetPluginConfiguration(size int) ([]byte, error) {
25+
ret, st := getBuffer(types.BufferTypePluginConfiguration, 0, size)
2626
return ret, types.StatusToError(st)
2727
}
2828

29-
func GetVMConfiguration(dataSize int) ([]byte, error) {
30-
ret, st := getBuffer(types.BufferTypeVMConfiguration, 0, dataSize)
29+
func GetVMConfiguration(size int) ([]byte, error) {
30+
ret, st := getBuffer(types.BufferTypeVMConfiguration, 0, size)
3131
return ret, types.StatusToError(st)
3232
}
3333

0 commit comments

Comments
 (0)