MCPcopy
hub / github.com/dropbox/godropbox / Singleton

Interface Singleton

singleton/singleton.go:21–24  ·  view source on GitHub ↗

Interface for accessing singleton objects. Example use: var configSelectorSingleton = NewSingleton(init) func configSelector() (configSelector, error) { s, err := configSelectorSingleton.Get() if err != nil { return nil, err } return s.(configSelector), nil }

Source from the content-addressed store, hash-verified

19// return s.(configSelector), nil
20// }
21type Singleton interface {
22 // Return the encapsulated singleton
23 Get() (interface{}, error)
24}
25
26// Call to create a new singleton that is instantiated with the given init function.
27// init is not called until the first invocation of Get(). If init errors, it will be called again

Callers 1

TestGetMethod · 0.65

Implementers 15

LRUCachecontainer/lrucache/lrucache.go
mapImpcontainer/concurrent/map.go
concurrentLruCacheImpcontainer/concurrent/lrucache.go
lockingMapcontainer/concurrent/lockstore/map.go
MockClientmemcache/mock_client.go
RawBinaryClientmemcache/raw_binary_client.go
ShardedClientmemcache/sharded_client.go
RawAsciiClientmemcache/raw_ascii_client.go
v4EventParserMapdatabase/binlog/event_parser.go
singletonImplsingleton/singleton.go
connectionPoolImplnet2/base_connection_pool.go
SimplePoolnet2/http2/simple_pool.go

Calls

no outgoing calls

Tested by

no test coverage detected