MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / DefaultClientCreator

Function DefaultClientCreator

proxy/client.go:75–97  ·  view source on GitHub ↗

DefaultClientCreator returns a default ClientCreator, which will create a local client if addr is one of: 'counter', 'counter_serial', 'kvstore', 'persistent_kvstore' or 'noop', otherwise - a remote client.

(addr, transport, dbDir string)

Source from the content-addressed store, hash-verified

73// local client if addr is one of: 'counter', 'counter_serial', 'kvstore',
74// 'persistent_kvstore' or 'noop', otherwise - a remote client.
75func DefaultClientCreator(addr, transport, dbDir string) ClientCreator {
76 switch addr {
77 case "counter":
78 return NewLocalClientCreator(counter.NewApplication(false))
79 case "counter_serial":
80 return NewLocalClientCreator(counter.NewApplication(true))
81 case "kvstore":
82 return NewLocalClientCreator(kvstore.NewApplication(dbDir))
83 case "persistent_kvstore":
84 return NewLocalClientCreator(kvstore.NewPersistentKVStoreApplication(dbDir))
85 case "e2e":
86 app, err := e2e.NewApplication(e2e.DefaultConfig(dbDir))
87 if err != nil {
88 panic(err)
89 }
90 return NewLocalClientCreator(app)
91 case "noop":
92 return NewLocalClientCreator(types.NewBaseApplication())
93 default:
94 mustConnect := false // loop retrying
95 return NewRemoteClientCreator(addr, transport, mustConnect)
96 }
97}

Callers 5

DefaultNewNodeFunction · 0.92
DefaultNewNodeFunction · 0.92

Calls 6

NewApplicationFunction · 0.92
NewApplicationFunction · 0.92
NewBaseApplicationFunction · 0.92
NewLocalClientCreatorFunction · 0.85
NewRemoteClientCreatorFunction · 0.85

Tested by 1