Skip to content

Commit

Permalink
aligned with choreo
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw committed Oct 29, 2024
1 parent 509e46e commit 8b447c1
Show file tree
Hide file tree
Showing 20 changed files with 221 additions and 413 deletions.
33 changes: 15 additions & 18 deletions apis/backend/as/invoker_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,50 +62,47 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error)
return &unstructured.Unstructured{Object: uobj}, nil
}

func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Claim(ctx, claim, recursion); err != nil {
return err
return obj, err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}

func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Claim(ctx, claim, recursion); err != nil {
return err
return obj, err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}

func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Release(ctx, claim, recursion); err != nil {
return err
return obj,err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}
33 changes: 15 additions & 18 deletions apis/backend/as/invoker_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error)
return &unstructured.Unstructured{Object: uobj}, nil
}

func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.CreateIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}

func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.CreateIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}

func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.DeleteIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}
34 changes: 16 additions & 18 deletions apis/backend/extcomm/invoker_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,50 +62,48 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error)
return &unstructured.Unstructured{Object: uobj}, nil
}

func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Claim(ctx, claim, recursion); err != nil {
return err
return obj, err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}

func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Claim(ctx, claim, recursion); err != nil {
return err
return obj, err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}

func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Release(ctx, claim, recursion); err != nil {
return err
return obj,err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}

33 changes: 15 additions & 18 deletions apis/backend/extcomm/invoker_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error)
return &unstructured.Unstructured{Object: uobj}, nil
}

func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.CreateIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}

func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.CreateIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}

func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.DeleteIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}
33 changes: 15 additions & 18 deletions apis/backend/genid/invoker_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,50 +62,47 @@ func claimConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error)
return &unstructured.Unstructured{Object: uobj}, nil
}

func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Claim(ctx, claim, recursion); err != nil {
return err
return obj, err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}

func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Claim(ctx, claim, recursion); err != nil {
return err
return obj, err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}

func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *claiminvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
claim, err := claimConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.Release(ctx, claim, recursion); err != nil {
return err
return obj,err
}
newClaim, err := claimConvertFromInternal(claim)
if err != nil {
return err
return obj, err
}
obj = newClaim
return nil
return newClaim, nil
}
33 changes: 15 additions & 18 deletions apis/backend/genid/invoker_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,50 +63,47 @@ func indexConvertFromInternal(obj runtime.Object) (runtime.Unstructured, error)
return &unstructured.Unstructured{Object: uobj}, nil
}

func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeCreate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.CreateIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}

func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj, old runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeUpdate(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.CreateIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}

func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) error {
func (r *idxinvoker) InvokeDelete(ctx context.Context, obj runtime.Object, recursion bool) (runtime.Object, error) {
index, err := indexConvertToInternal(obj)
if err != nil {
return err
return obj, err
}
if err := r.be.DeleteIndex(ctx, index); err != nil {
return err
return obj, err
}
newIndex, err := indexConvertFromInternal(index)
if err != nil {
return err
return obj, err
}
obj = newIndex
return nil
return newIndex, nil
}
Loading

0 comments on commit 8b447c1

Please sign in to comment.