MCPcopy
hub / github.com/syncthing/syncthing / Add

Method Add

lib/model/service_map.go:46–53  ·  view source on GitHub ↗

Add adds a service to the map, starting it on the supervisor. If there is already a service at the given key, it is removed first.

(k K, v S)

Source from the content-addressed store, hash-verified

44// Add adds a service to the map, starting it on the supervisor. If there is
45// already a service at the given key, it is removed first.
46func (s *serviceMap[K, S]) Add(k K, v S) {
47 if tok, ok := s.tokens[k]; ok {
48 // There is already a service at this key, remove it first.
49 s.supervisor.Remove(tok)
50 }
51 s.services[k] = v
52 s.tokens[k] = s.supervisor.Add(v)
53}
54
55// Get returns the service at the given key, or the empty value and false if
56// there is no service at that key.

Callers 15

generateCertificateFunction · 0.45
AcceptNoWrapTLSMethod · 0.45
updateMappingMethod · 0.45
discoverAllFunction · 0.45
StartMethod · 0.45
readHeaderMethod · 0.45
writeMessageMethod · 0.45
KeyFromPasswordMethod · 0.45
FileKeyMethod · 0.45
GetMethod · 0.45

Calls 1

RemoveMethod · 0.65

Tested by 15

TestDialQueueSortFunction · 0.36
withConnectionPairFunction · 0.36
TestRecvOnlyRevertOwnIDFunction · 0.36
setupKnownFilesFunction · 0.36
prepareTmpFileFunction · 0.36
TestModTimeWindowFunction · 0.36
TestServiceMapFunction · 0.36
TestTrashcanCleanOutFunction · 0.36
TestCachingFunction · 0.36