MCPcopy
hub / github.com/google/seesaw / ConfigSource

Method ConfigSource

engine/ipc.go:292–319  ·  view source on GitHub ↗

ConfigSource requests the configuration source be changed to the specified source. The name of the original source is returned.

(args *ipc.ConfigSource, oldSource *string)

Source from the content-addressed store, hash-verified

290// ConfigSource requests the configuration source be changed to the specified
291// source. The name of the original source is returned.
292func (s *SeesawEngine) ConfigSource(args *ipc.ConfigSource, oldSource *string) error {
293 if args == nil {
294 return errors.New("args is nil")
295 }
296 ctx := args.Ctx
297 s.trace("ConfigSource", ctx)
298 if ctx == nil {
299 return errContext
300 }
301
302 if !ctx.CanWrite() {
303 return errAccess
304 }
305
306 if oldSource != nil {
307 *oldSource = s.engine.notifier.Source().String()
308 }
309 newSource := args.Source
310 if newSource == "" {
311 return nil
312 }
313 source, err := config.SourceByName(newSource)
314 if err != nil {
315 return err
316 }
317 s.engine.notifier.SetSource(source)
318 return nil
319}
320
321// BGPNeighbors returns a list of the BGP neighbors that we are peering with.
322func (s *SeesawEngine) BGPNeighbors(ctx *ipc.Context, reply *quagga.Neighbors) error {

Callers

nothing calls this directly

Calls 6

traceMethod · 0.95
SourceByNameFunction · 0.92
CanWriteMethod · 0.80
SourceMethod · 0.80
SetSourceMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected