MCPcopy
hub / github.com/NVIDIA/aistore / runPre

Method runPre

ais/gconfig.go:104–140  ·  view source on GitHub ↗
(ctx *configModifier)

Source from the content-addressed store, hash-verified

102func (*configOwner) version() int64 { return cmn.GCO.Get().Version }
103
104func (co *configOwner) runPre(ctx *configModifier) (clone *globalConfig, err error) {
105 co.Lock()
106 defer co.Unlock()
107 clone, err = co.get()
108 if err != nil {
109 return
110 }
111 // NOTE: nil config == missing config
112 if clone == nil {
113 clone = &globalConfig{}
114 _, err = jsp.Load(cmn.GCO.GetInitialGconfPath(), clone, jsp.Plain())
115 if err != nil {
116 return
117 }
118 }
119
120 if updated, err := ctx.pre(ctx, clone); err != nil || !updated {
121 return nil, err
122 }
123
124 ctx.oldConfig = cmn.GCO.Get()
125 if err = cmn.GCO.Update(&clone.ClusterConfig); err != nil {
126 clone = nil
127 return
128 }
129
130 clone.Version++
131 clone.LastUpdated = time.Now().String()
132 clone._sgl = clone._encode(co.immSize)
133 co.immSize = cos.MaxI64(co.immSize, clone._sgl.Len())
134 if err := co.persist(clone, nil); err != nil {
135 clone._sgl.Free()
136 clone._sgl = nil
137 return nil, cmn.NewErrFailedTo(nil, "persist", clone, err)
138 }
139 return
140}
141
142// Update the global config on primary proxy.
143func (co *configOwner) modify(ctx *configModifier) (config *globalConfig, err error) {

Callers 1

modifyMethod · 0.95

Calls 15

getMethod · 0.95
persistMethod · 0.95
LoadFunction · 0.92
PlainFunction · 0.92
MaxI64Function · 0.92
NewErrFailedToFunction · 0.92
GetInitialGconfPathMethod · 0.80
UpdateMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
GetMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected