/
deviceSubscriptionHandlers.go
35 lines (27 loc) · 1.15 KB
/
deviceSubscriptionHandlers.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
package service
import (
"context"
"github.com/plgd-dev/cloud/grpc-gateway/pb"
)
type deviceSubscriptionHandlers struct {
onResourceUpdatePending func(ctx context.Context, val *pb.Event_ResourceUpdatePending) error
onResourceRetrievePending func(ctx context.Context, val *pb.Event_ResourceRetrievePending) error
onResourceDeletePending func(ctx context.Context, val *pb.Event_ResourceDeletePending) error
onClose func()
onError func(err error)
}
func (h *deviceSubscriptionHandlers) HandleResourceUpdatePending(ctx context.Context, val *pb.Event_ResourceUpdatePending) error {
return h.onResourceUpdatePending(ctx, val)
}
func (h *deviceSubscriptionHandlers) HandleResourceRetrievePending(ctx context.Context, val *pb.Event_ResourceRetrievePending) error {
return h.onResourceRetrievePending(ctx, val)
}
func (h *deviceSubscriptionHandlers) HandleResourceDeletePending(ctx context.Context, val *pb.Event_ResourceDeletePending) error {
return h.onResourceDeletePending(ctx, val)
}
func (h *deviceSubscriptionHandlers) Error(err error) {
h.onError(err)
}
func (h *deviceSubscriptionHandlers) OnClose() {
h.onClose()
}