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)
| 73 | // local client if addr is one of: 'counter', 'counter_serial', 'kvstore', |
| 74 | // 'persistent_kvstore' or 'noop', otherwise - a remote client. |
| 75 | func 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 | } |