Skip to content

Commit 62da459

Browse files
committed
move unimplement methods to a new file
1 parent 0b05513 commit 62da459

File tree

4 files changed

+119
-90
lines changed

4 files changed

+119
-90
lines changed

codecov.yml

+1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ ignore:
2222
- "pkg/filter/network/tcpcopy/strategy"
2323
- "pkg/grpc/dapr/proto/common/v1"
2424
- "pkg/grpc/dapr/proto/runtime/v1"
25+
- "pkg/grpc/dapr/dapr_api_unimplement.go"
2526
- "pkg/wasm/watcher.go"

pkg/grpc/dapr/dapr_api.go

-89
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"google.golang.org/grpc/metadata"
2929
"google.golang.org/grpc/status"
3030
"google.golang.org/protobuf/types/known/anypb"
31-
"google.golang.org/protobuf/types/known/emptypb"
3231
"mosn.io/layotto/components/configstores"
3332
"mosn.io/layotto/components/file"
3433
"mosn.io/layotto/components/hello"
@@ -132,38 +131,6 @@ func (d *daprGrpcAPI) InvokeService(ctx context.Context, in *runtime.InvokeServi
132131
}, nil
133132
}
134133

135-
func (d *daprGrpcAPI) GetState(ctx context.Context, request *runtime.GetStateRequest) (*runtime.GetStateResponse, error) {
136-
panic("implement me")
137-
}
138-
139-
func (d *daprGrpcAPI) GetBulkState(ctx context.Context, request *runtime.GetBulkStateRequest) (*runtime.GetBulkStateResponse, error) {
140-
panic("implement me")
141-
}
142-
143-
func (d *daprGrpcAPI) SaveState(ctx context.Context, request *runtime.SaveStateRequest) (*emptypb.Empty, error) {
144-
panic("implement me")
145-
}
146-
147-
func (d *daprGrpcAPI) QueryStateAlpha1(ctx context.Context, request *runtime.QueryStateRequest) (*runtime.QueryStateResponse, error) {
148-
panic("implement me")
149-
}
150-
151-
func (d *daprGrpcAPI) DeleteState(ctx context.Context, request *runtime.DeleteStateRequest) (*emptypb.Empty, error) {
152-
panic("implement me")
153-
}
154-
155-
func (d *daprGrpcAPI) DeleteBulkState(ctx context.Context, request *runtime.DeleteBulkStateRequest) (*emptypb.Empty, error) {
156-
panic("implement me")
157-
}
158-
159-
func (d *daprGrpcAPI) ExecuteStateTransaction(ctx context.Context, request *runtime.ExecuteStateTransactionRequest) (*emptypb.Empty, error) {
160-
panic("implement me")
161-
}
162-
163-
func (d *daprGrpcAPI) PublishEvent(ctx context.Context, request *runtime.PublishEventRequest) (*emptypb.Empty, error) {
164-
panic("implement me")
165-
}
166-
167134
func (d *daprGrpcAPI) InvokeBinding(ctx context.Context, in *runtime.InvokeBindingRequest) (*runtime.InvokeBindingResponse, error) {
168135
req := &bindings.InvokeRequest{
169136
Metadata: in.Metadata,
@@ -188,62 +155,6 @@ func (d *daprGrpcAPI) InvokeBinding(ctx context.Context, in *runtime.InvokeBindi
188155
return r, nil
189156
}
190157

191-
func (d *daprGrpcAPI) GetSecret(ctx context.Context, request *runtime.GetSecretRequest) (*runtime.GetSecretResponse, error) {
192-
panic("implement me")
193-
}
194-
195-
func (d *daprGrpcAPI) GetBulkSecret(ctx context.Context, request *runtime.GetBulkSecretRequest) (*runtime.GetBulkSecretResponse, error) {
196-
panic("implement me")
197-
}
198-
199-
func (d *daprGrpcAPI) RegisterActorTimer(ctx context.Context, request *runtime.RegisterActorTimerRequest) (*emptypb.Empty, error) {
200-
panic("implement me")
201-
}
202-
203-
func (d *daprGrpcAPI) UnregisterActorTimer(ctx context.Context, request *runtime.UnregisterActorTimerRequest) (*emptypb.Empty, error) {
204-
panic("implement me")
205-
}
206-
207-
func (d *daprGrpcAPI) RegisterActorReminder(ctx context.Context, request *runtime.RegisterActorReminderRequest) (*emptypb.Empty, error) {
208-
panic("implement me")
209-
}
210-
211-
func (d *daprGrpcAPI) UnregisterActorReminder(ctx context.Context, request *runtime.UnregisterActorReminderRequest) (*emptypb.Empty, error) {
212-
panic("implement me")
213-
}
214-
215-
func (d *daprGrpcAPI) GetActorState(ctx context.Context, request *runtime.GetActorStateRequest) (*runtime.GetActorStateResponse, error) {
216-
panic("implement me")
217-
}
218-
219-
func (d *daprGrpcAPI) ExecuteActorStateTransaction(ctx context.Context, request *runtime.ExecuteActorStateTransactionRequest) (*emptypb.Empty, error) {
220-
panic("implement me")
221-
}
222-
223-
func (d *daprGrpcAPI) InvokeActor(ctx context.Context, request *runtime.InvokeActorRequest) (*runtime.InvokeActorResponse, error) {
224-
panic("implement me")
225-
}
226-
227-
func (d *daprGrpcAPI) GetConfigurationAlpha1(ctx context.Context, request *runtime.GetConfigurationRequest) (*runtime.GetConfigurationResponse, error) {
228-
panic("implement me")
229-
}
230-
231-
func (d *daprGrpcAPI) SubscribeConfigurationAlpha1(request *runtime.SubscribeConfigurationRequest, server runtime.Dapr_SubscribeConfigurationAlpha1Server) error {
232-
panic("implement me")
233-
}
234-
235-
func (d *daprGrpcAPI) GetMetadata(ctx context.Context, empty *emptypb.Empty) (*runtime.GetMetadataResponse, error) {
236-
panic("implement me")
237-
}
238-
239-
func (d *daprGrpcAPI) SetMetadata(ctx context.Context, request *runtime.SetMetadataRequest) (*emptypb.Empty, error) {
240-
panic("implement me")
241-
}
242-
243-
func (d *daprGrpcAPI) Shutdown(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
244-
panic("implement me")
245-
}
246-
247158
// NewDaprAPI_Alpha construct a grpc_api.GrpcAPI which implements DaprServer.
248159
// Currently it only support Dapr's InvokeService and InvokeBinding API.
249160
// Note: this feature is still in Alpha state and we don't recommend that you use it in your production environment.

pkg/grpc/dapr/dapr_api_unimplement.go

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright 2021 Layotto Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package dapr
18+
19+
import (
20+
"context"
21+
"google.golang.org/protobuf/types/known/emptypb"
22+
"mosn.io/layotto/pkg/grpc/dapr/proto/runtime/v1"
23+
)
24+
25+
func (d *daprGrpcAPI) GetState(ctx context.Context, request *runtime.GetStateRequest) (*runtime.GetStateResponse, error) {
26+
panic("implement me")
27+
}
28+
29+
func (d *daprGrpcAPI) GetBulkState(ctx context.Context, request *runtime.GetBulkStateRequest) (*runtime.GetBulkStateResponse, error) {
30+
panic("implement me")
31+
}
32+
33+
func (d *daprGrpcAPI) SaveState(ctx context.Context, request *runtime.SaveStateRequest) (*emptypb.Empty, error) {
34+
panic("implement me")
35+
}
36+
37+
func (d *daprGrpcAPI) QueryStateAlpha1(ctx context.Context, request *runtime.QueryStateRequest) (*runtime.QueryStateResponse, error) {
38+
panic("implement me")
39+
}
40+
41+
func (d *daprGrpcAPI) DeleteState(ctx context.Context, request *runtime.DeleteStateRequest) (*emptypb.Empty, error) {
42+
panic("implement me")
43+
}
44+
45+
func (d *daprGrpcAPI) DeleteBulkState(ctx context.Context, request *runtime.DeleteBulkStateRequest) (*emptypb.Empty, error) {
46+
panic("implement me")
47+
}
48+
49+
func (d *daprGrpcAPI) ExecuteStateTransaction(ctx context.Context, request *runtime.ExecuteStateTransactionRequest) (*emptypb.Empty, error) {
50+
panic("implement me")
51+
}
52+
53+
func (d *daprGrpcAPI) PublishEvent(ctx context.Context, request *runtime.PublishEventRequest) (*emptypb.Empty, error) {
54+
panic("implement me")
55+
}
56+
57+
func (d *daprGrpcAPI) GetSecret(ctx context.Context, request *runtime.GetSecretRequest) (*runtime.GetSecretResponse, error) {
58+
panic("implement me")
59+
}
60+
61+
func (d *daprGrpcAPI) GetBulkSecret(ctx context.Context, request *runtime.GetBulkSecretRequest) (*runtime.GetBulkSecretResponse, error) {
62+
panic("implement me")
63+
}
64+
65+
func (d *daprGrpcAPI) RegisterActorTimer(ctx context.Context, request *runtime.RegisterActorTimerRequest) (*emptypb.Empty, error) {
66+
panic("implement me")
67+
}
68+
69+
func (d *daprGrpcAPI) UnregisterActorTimer(ctx context.Context, request *runtime.UnregisterActorTimerRequest) (*emptypb.Empty, error) {
70+
panic("implement me")
71+
}
72+
73+
func (d *daprGrpcAPI) RegisterActorReminder(ctx context.Context, request *runtime.RegisterActorReminderRequest) (*emptypb.Empty, error) {
74+
panic("implement me")
75+
}
76+
77+
func (d *daprGrpcAPI) UnregisterActorReminder(ctx context.Context, request *runtime.UnregisterActorReminderRequest) (*emptypb.Empty, error) {
78+
panic("implement me")
79+
}
80+
81+
func (d *daprGrpcAPI) GetActorState(ctx context.Context, request *runtime.GetActorStateRequest) (*runtime.GetActorStateResponse, error) {
82+
panic("implement me")
83+
}
84+
85+
func (d *daprGrpcAPI) ExecuteActorStateTransaction(ctx context.Context, request *runtime.ExecuteActorStateTransactionRequest) (*emptypb.Empty, error) {
86+
panic("implement me")
87+
}
88+
89+
func (d *daprGrpcAPI) InvokeActor(ctx context.Context, request *runtime.InvokeActorRequest) (*runtime.InvokeActorResponse, error) {
90+
panic("implement me")
91+
}
92+
93+
func (d *daprGrpcAPI) GetConfigurationAlpha1(ctx context.Context, request *runtime.GetConfigurationRequest) (*runtime.GetConfigurationResponse, error) {
94+
panic("implement me")
95+
}
96+
97+
func (d *daprGrpcAPI) SubscribeConfigurationAlpha1(request *runtime.SubscribeConfigurationRequest, server runtime.Dapr_SubscribeConfigurationAlpha1Server) error {
98+
panic("implement me")
99+
}
100+
101+
func (d *daprGrpcAPI) GetMetadata(ctx context.Context, empty *emptypb.Empty) (*runtime.GetMetadataResponse, error) {
102+
panic("implement me")
103+
}
104+
105+
func (d *daprGrpcAPI) SetMetadata(ctx context.Context, request *runtime.SetMetadataRequest) (*emptypb.Empty, error) {
106+
panic("implement me")
107+
}
108+
109+
func (d *daprGrpcAPI) Shutdown(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
110+
panic("implement me")
111+
}

pkg/grpc/default_api/api_test.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,13 @@ func TestGetFileMeta(t *testing.T) {
11451145
assert.Equal(t, st.Message(), "request can't be nil")
11461146
request.Request = &runtimev1pb.FileRequest{StoreName: "mock", Name: "test"}
11471147
meta := make(map[string]string)
1148-
re := &file.FileMetaResp{Size: 10, LastModified: "123"}
1148+
re := &file.FileMetaResp{
1149+
Size: 10,
1150+
LastModified: "123",
1151+
Metadata: map[string][]string{
1152+
"test": []string{},
1153+
},
1154+
}
11491155
mockFile.EXPECT().Stat(context.Background(), &file.FileMetaRequest{FileName: request.Request.Name, Metadata: meta}).Return(re, nil).Times(1)
11501156
resp, err = api.GetFileMeta(context.Background(), request)
11511157
assert.Equal(t, resp.LastModified, "123")

0 commit comments

Comments
 (0)