MCPcopy
hub / github.com/purpleidea/mgmt / ValueRes

Struct ValueRes

engine/resources/value.go:52–84  ·  view source on GitHub ↗

ValueRes is a no-op resource that accepts a value normally or via send/recv and it sends it via send/recv as well. XXX: intermediate chained values being used for send/recv must have a temporary placeholder value set or we'll get an invalid value error. This can be fixed eventually when we expand t

Source from the content-addressed store, hash-verified

50// be fixed eventually when we expand the resource API. See the Default method
51// of this resource for more information.
52type ValueRes struct {
53 // This is similar to the KV resource, but it makes sense not to merge.
54
55 traits.Base // add the base methods without re-implementation
56
57 //traits.Groupable // TODO: this is doable, but probably not very useful
58 traits.Sendable
59 traits.Recvable
60
61 init *engine.Init
62
63 // Any is an arbitrary value to store in this resource. It can also be
64 // sent via send/recv and received by the same mechanism as well. The
65 // received value overwrites this value for the lifetime of the
66 // resource. It is interface{} because it can hold any type. It has
67 // pointer because it is only set if an actual value exists.
68 Any *interface{} `lang:"any" yaml:"any"`
69
70 // Store specifies that we should store this value locally in our cache,
71 // so that if we have a cold startup, that it comes back instantly, even
72 // before we might get the current value from send/recv. This does not
73 // override any value passed in directly as a field parameter. This is
74 // mostly useful if we're using the value.get() function, and we don't
75 // want an initial stale value for a subsequent run. Remember that
76 // functions run before resources do!
77 //
78 // At the moment, this is permanently enabled until someone has a good
79 // reason why we wouldn't want it on.
80 //Store bool
81
82 cachedAny *interface{}
83 isSet bool
84}
85
86// Default returns some sensible defaults for this resource.
87func (obj *ValueRes) Default() engine.Res {

Callers 1

UnmarshalYAMLMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected