[VOL-4290] Voltha go library updates for gRPC migration
Change-Id: I1aa2774beb6b7ed7419bc45aeb53fcae8a8ecda0
diff --git a/pkg/events/events_proxy.go b/pkg/events/events_proxy.go
index 89d58a0..e4493f9 100644
--- a/pkg/events/events_proxy.go
+++ b/pkg/events/events_proxy.go
@@ -26,11 +26,11 @@
"sync"
"time"
- "github.com/golang/protobuf/ptypes"
- "github.com/opencord/voltha-lib-go/v6/pkg/events/eventif"
- "github.com/opencord/voltha-lib-go/v6/pkg/kafka"
- "github.com/opencord/voltha-lib-go/v6/pkg/log"
- "github.com/opencord/voltha-protos/v4/go/voltha"
+ "github.com/opencord/voltha-lib-go/v7/pkg/events/eventif"
+ "github.com/opencord/voltha-lib-go/v7/pkg/kafka"
+ "github.com/opencord/voltha-lib-go/v7/pkg/log"
+ "github.com/opencord/voltha-protos/v5/go/voltha"
+ "google.golang.org/protobuf/types/known/timestamppb"
)
// TODO: Make configurable through helm chart
@@ -97,17 +97,8 @@
header.TypeVersion = eventif.EventTypeVersion
// raisedTs is in seconds
- timestamp, err := ptypes.TimestampProto(time.Unix(raisedTs, 0))
- if err != nil {
- return nil, err
- }
- header.RaisedTs = timestamp
-
- timestamp, err = ptypes.TimestampProto(time.Now())
- if err != nil {
- return nil, err
- }
- header.ReportedTs = timestamp
+ header.RaisedTs = timestamppb.New(time.Unix(raisedTs, 0))
+ header.ReportedTs = timestamppb.New(time.Now())
return &header, nil
}
@@ -201,7 +192,7 @@
}
// Start the event proxy
-func (ep *EventProxy) Start() {
+func (ep *EventProxy) Start() error {
eq := ep.eventQueue
go eq.start(ep.queueCtx)
logger.Debugw(context.Background(), "event-proxy-starting...", log.Fields{"events-threashold": EVENT_THRESHOLD})
@@ -235,10 +226,13 @@
"reported-ts": event.Header.ReportedTs, "event-type": event.EventType})
}
}
+ return nil
}
func (ep *EventProxy) Stop() {
- ep.eventQueue.stop()
+ if ep.eventQueue != nil {
+ ep.eventQueue.stop()
+ }
}
type EventQueue struct {