Skip to content

Commit

Permalink
[release-4.11] Bug OCPBUGS-3295: Event Pull Status Notification GET M…
Browse files Browse the repository at this point in the history
…ethod not working as per o-Ran spec (#58)

* vendor: add vendor changes

Signed-off-by: Aneesh Puttur <aneeshputtur@gmail.com>

* code: update sdk to support get current state call

Signed-off-by: Aneesh Puttur <aneeshputtur@gmail.com>

Signed-off-by: Aneesh Puttur <aneeshputtur@gmail.com>
  • Loading branch information
aneeshkp authored Nov 5, 2022
1 parent 719244e commit d27e9b4
Show file tree
Hide file tree
Showing 1,031 changed files with 318,877 additions and 120 deletions.
32 changes: 28 additions & 4 deletions pkg/channel/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,44 @@ package channel

import (
cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/google/uuid"
)

// DataChan ...
type DataChan struct {
Address string
Data *cloudevents.Event
Status Status
ID string
ClientID uuid.UUID
Address string
Data *cloudevents.Event
Status Status
//Type defines type of data (Notification,Metric,Status)
Type Type
// OnReceiveFn to do on OnReceive
OnReceiveFn func(e cloudevents.Event)
// OnReceiveOverrideFn Optional for event, but override for status pings.This is an override function on receiving msg by amqp listener,
// if not set then the data is sent to out channel and processed by side car default method
// if not set then the data is sent to out channel and processed by side-car default method
OnReceiveOverrideFn func(e cloudevents.Event, dataChan *DataChan) error
// ProcessEventFn Optional, this allows to customize message handler thar was received at the out channel
ProcessEventFn func(e interface{}) error
// Only for status lost if marshalled to json
StatusChan chan<- *StatusChan
ReturnAddress *string
}

// StatusChan channel used for writing status data out here
type StatusChan struct {
ID string
ClientID uuid.UUID
Data *cloudevents.Event
}

// CreateCloudEvents ...
func (d *DataChan) CreateCloudEvents(dataType string) (*cloudevents.Event, error) {
ce := cloudevents.NewEvent(cloudevents.VersionV03)
ce.SetDataContentType(cloudevents.ApplicationJSON)
ce.SetSpecVersion(cloudevents.VersionV03)
ce.SetType(dataType)
ce.SetSource(d.Address)
ce.SetID(d.ClientID.String())
return &ce, nil
}
10 changes: 5 additions & 5 deletions pkg/channel/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func (s Status) String() string {
type Type int

const (
// LISTENER the type to create listener
LISTENER Type = iota
//SENDER the type is to create sender
SENDER
// SUBSCRIBER the type to create listener
SUBSCRIBER Type = iota
//PUBLISHER the type is to create sender
PUBLISHER
//EVENT the type is an event
EVENT
//STATUS the type is an STATUS CHECK
Expand All @@ -49,5 +49,5 @@ const (

// String represent of Type enum
func (t Type) String() string {
return [...]string{"LISTENER", "SENDER", "EVENT", "STATUS"}[t]
return [...]string{"SUBSCRIBER", "PUBLISHER", "EVENT", "STATUS"}[t]
}
Loading

0 comments on commit d27e9b4

Please sign in to comment.