// boltConnect creates a new BoltStore to copy our data into. We can
// use the BoltStore directly because it provides simple setter
// methods, provided our keys and values are known.
491000
func (m *Migrator) boltConnect(file string) error {
	// Connect to the new BoltStore
	store, err := raftboltdb.NewBoltStore(file)
	if err != nil {
		return err
	}

	m.boltStore = store
	return nil
}
471098
func (k *KeybaseDaemonRPC) OnConnect(ctx context.Context,
	conn *rpc.Connection, rawClient rpc.GenericClient,
	server *rpc.Server) (err error) {
	k.lock.Lock()
	defer k.lock.Unlock()

	for _, p := range k.protocols {
		if err = k.registerProtocol(server, p); err != nil {
			return err
		}
	}

	// Using conn.GetClient() here would cause problematic
	// recursion.
	c := keybase1.NotifyCtlClient{Cli: rawClient}
	err = c.SetNotifications(ctx, keybase1.NotificationChannels{
		Session:       true,
		Paperkeys:     true,
		Keyfamily:     true,
		Kbfsrequest:   true,
		Reachability:  true,
		Service:       true,
		Team:          true,
		Chatkbfsedits: true,
		Favorites:     true,
	})
	if err != nil {
		return err
	}

	// Introduce ourselves. TODO: move this to SharedKeybaseConnection
	// somehow?
	configClient := keybase1.ConfigClient{Cli: rawClient}
	err = configClient.HelloIAm(ctx, keybase1.ClientDetails{
		Pid:        os.Getpid(),
		ClientType: k.config.Mode().ClientType(),
		Argv:       os.Args,
		Version:    VersionString(),
	})
	if err != nil {
		return err
	}

	// Set k.server only if err == nil.
	k.server = server

	return nil
}
822226
func NewConnection(socketName string) *Connection {
	return &Connection{
		socketName:      socketName,
		lock:            &sync.Mutex{},
		waitingRequests: make(map[uint]chan *commandResult),
		eventListeners:  make(map[uint]chan<- *Event),
		closeWaiters:    make(map[uint]chan struct{}),
	}
}
168275
func (p *Plugin) OnConnect(callback func() error) {
	if err := callback(); err != nil {
		p.Log.Error(err)
	}
}
1365056
func (b *serverBuilder) SetDiskConnection(diskConnection sacloud.EDiskConnection) {
	b.disk.SetConnection(diskConnection)
}
765810
func (p *Plugin) NewBytesConnection(name string) *mux.BytesConnectionStr {
	return p.mux.NewBytesConnection(name)
}
742695
func (s *GetConnectionOutput) SetConnection(v *Connection) *GetConnectionOutput {
	s.Connection = v
	return s
}
220872
func (b *Builder) Connector(zkConnector ZkConnector) *Builder {
	b.zkConnector = zkConnector
	return b
}
360780
func (s *TestConnectionOutput) SetConnection(v *Connection) *TestConnectionOutput {
	s.Connection = v
	return s
}
456925
func ShimConnect(c *Config, onClose func()) ShimOpt {
	return func(b *bundle, ns string, ropts *runctypes.RuncOptions) (shim.Config, client.Opt) {
		return b.shimConfig(ns, c, ropts), client.WithConnect(b.decideShimAddress(ns), onClose)
	}
}
967835
func (o *ClientOptions) SetAutoReconnect(a bool) *ClientOptions {
	o.AutoReconnect = a
	return o
}
416970
func NewCONNECT(opts *CONNECTOptions) (Packet, error) {
	// Initialize the options.
	if opts == nil {
		opts = &CONNECTOptions{}
	}

	// Validate the options.
	if err := opts.validate(); err != nil {
		return nil, err
	}

	// Create a CONNECT Packet.
	p := &CONNECT{
		clientID:     opts.ClientID,
		userName:     opts.UserName,
		password:     opts.Password,
		cleanSession: opts.CleanSession,
		keepAlive:    opts.KeepAlive,
		willTopic:    opts.WillTopic,
		willMessage:  opts.WillMessage,
		willQoS:      opts.WillQoS,
		willRetain:   opts.WillRetain,
	}

	// Set the variable header to the Packet.
	p.setVariableHeader()

	// Set the payload to the Packet.
	p.setPayload()

	// Set the fixed header to the packet.
	p.setFixedHeader()

	// Return the Packet.
	return p, nil
}
1206673
func (h *WebHook) NewConnectOptions() (runtime.Object, bool, string) {
	return &kapi.PodProxyOptions{}, true, "path"
}
661581
func (k *Kite) OnConnect(handler func(*Client)) {
	k.handlersMu.Lock()
	k.onConnectHandlers = append(k.onConnectHandlers, handler)
	k.handlersMu.Unlock()
}
139723
func (connection *redisConnection) hijackConnection(name string) *redisConnection {
	return &redisConnection{
		Name:         name,
		heartbeatKey: strings.Replace(connectionHeartbeatTemplate, phConnection, name, 1),
		queuesKey:    strings.Replace(connectionQueuesTemplate, phConnection, name, 1),
		redisClient:  connection.redisClient,
	}
}
121642
func NewConnection(connection net.Conn, context Context) *Connection {
	conn := &Connection{
		connection: connection,
		context:    context,
	}

	// Setup new session for the connection
	session := NewSession(conn)
	context.SetSessionForConnection(session, conn)

	return conn
}
70585
func (b *blockServerRemoteClientHandler) OnConnect(ctx context.Context,
	conn *rpc.Connection, client rpc.GenericClient, _ *rpc.Server) error {
	// reset auth -- using client here would cause problematic recursion.
	c := keybase1.BlockClient{Cli: client}
	err := b.resetAuth(ctx, c)
	if err != nil {
		return err
	}

	// Start pinging.
	b.pinger.resetTicker(BServerDefaultPingIntervalSeconds)
	return nil
}