forked from ServiceWeaver/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweaver_gen.go
108 lines (82 loc) · 3.28 KB
/
weaver_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Code generated by "weaver generate". DO NOT EDIT.
//go:build !ignoreWeaverGen
package main
import (
"context"
"github.com/ServiceWeaver/weaver"
"github.com/ServiceWeaver/weaver/runtime/codegen"
"go.opentelemetry.io/otel/trace"
"reflect"
)
func init() {
codegen.Register(codegen.Registration{
Name: "github.com/ServiceWeaver/weaver/Main",
Iface: reflect.TypeOf((*weaver.Main)(nil)).Elem(),
Impl: reflect.TypeOf(app{}),
Listeners: []string{"lis"},
LocalStubFn: func(impl any, caller string, tracer trace.Tracer) any {
return main_local_stub{impl: impl.(weaver.Main), tracer: tracer}
},
ClientStubFn: func(stub codegen.Stub, caller string) any { return main_client_stub{stub: stub} },
ServerStubFn: func(impl any, addLoad func(uint64, float64)) codegen.Server {
return main_server_stub{impl: impl.(weaver.Main), addLoad: addLoad}
},
ReflectStubFn: func(caller func(string, context.Context, []any, []any) error) any {
return main_reflect_stub{caller: caller}
},
RefData: "⟦d535aefb:wEaVeRlIsTeNeRs:github.com/ServiceWeaver/weaver/Main→lis⟧\n",
})
}
// weaver.InstanceOf checks.
var _ weaver.InstanceOf[weaver.Main] = (*app)(nil)
// weaver.Router checks.
var _ weaver.Unrouted = (*app)(nil)
// Local stub implementations.
type main_local_stub struct {
impl weaver.Main
tracer trace.Tracer
}
// Check that main_local_stub implements the weaver.Main interface.
var _ weaver.Main = (*main_local_stub)(nil)
// Client stub implementations.
type main_client_stub struct {
stub codegen.Stub
}
// Check that main_client_stub implements the weaver.Main interface.
var _ weaver.Main = (*main_client_stub)(nil)
// Note that "weaver generate" will always generate the error message below.
// Everything is okay. The error message is only relevant if you see it when
// you run "go build" or "go run".
var _ codegen.LatestVersion = codegen.Version[[0][24]struct{}](`
ERROR: You generated this file with 'weaver generate' v0.23.2 (codegen
version v0.24.0). The generated code is incompatible with the version of the
github.com/ServiceWeaver/weaver module that you're using. The weaver module
version can be found in your go.mod file or by running the following command.
go list -m github.com/ServiceWeaver/weaver
We recommend updating the weaver module and the 'weaver generate' command by
running the following.
go get github.com/ServiceWeaver/weaver@latest
go install github.com/ServiceWeaver/weaver/cmd/weaver@latest
Then, re-run 'weaver generate' and re-build your code. If the problem persists,
please file an issue at https://github.com/ServiceWeaver/weaver/issues.
`)
// Server stub implementations.
type main_server_stub struct {
impl weaver.Main
addLoad func(key uint64, load float64)
}
// Check that main_server_stub implements the codegen.Server interface.
var _ codegen.Server = (*main_server_stub)(nil)
// GetStubFn implements the codegen.Server interface.
func (s main_server_stub) GetStubFn(method string) func(ctx context.Context, args []byte) ([]byte, error) {
switch method {
default:
return nil
}
}
// Reflect stub implementations.
type main_reflect_stub struct {
caller func(string, context.Context, []any, []any) error
}
// Check that main_reflect_stub implements the weaver.Main interface.
var _ weaver.Main = (*main_reflect_stub)(nil)