Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to DesiredComposedResources and ObservedComposedResources #23

Merged
merged 2 commits into from
Sep 18, 2023

Commits on Sep 16, 2023

  1. Remove DesiredComposedResources and ObserveComposedResources types

    These just served to obfuscate what the types actually were - a map of
    resource name to observed/desired composed resource structs.
    
    Signed-off-by: Nic Cope <nicc@rk0n.org>
    negz committed Sep 16, 2023
    Configuration menu
    Copy the full SHA
    ef3a2e0 View commit details
    Browse the repository at this point in the history
  2. Make desired resources map values pointers to struct

    This makes it possible to mutate struct values while iterating over the
    map of composed resources. I found myself naturally wanting to do this
    while writing a Function. e.g.:
    
    desired, _ = request.GetDesiredComposedResources(req)
    
    for _, dr := range desired {
    	dr.Ready = resource.ReadyTrue
    }
    
    _ = response.SetDesiredComposedResources(desired)
    
    I haven't made the same change for observed resources, since they're
    supposed to be read-only to a Function.
    
    Signed-off-by: Nic Cope <nicc@rk0n.org>
    negz committed Sep 16, 2023
    Configuration menu
    Copy the full SHA
    fce65c0 View commit details
    Browse the repository at this point in the history