connection

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Client       *grpc.ClientConn
	Capabilities []*identity.Capability
	NodeID       string
	DriverName   string
	Timeout      time.Duration
}

Connection struct consists of to NodeID, DriverName, Capabilities for the controller to pick sidecar connection and grpc Client to connect to the sidecar.

func NewConnection

func NewConnection(ctx context.Context, endpoint, nodeID, driverName string) (*Connection, error)

NewConnection establishes connection with sidecar, fetches capability and returns Connection object filled with required information.

func (*Connection) Close

func (c *Connection) Close()

type ConnectionPool

type ConnectionPool struct {
	// contains filtered or unexported fields
}

ConnectionPool consists of map of Connection objects and methods Put, Get & Delete which operates with required rw locks to ensure consistency. CSIAddonsNode controller will use Put and Delete methods whereas other controllers will make use of Get to choose and connect to sidecar.

func NewConnectionPool

func NewConnectionPool() *ConnectionPool

NewConntionPool initializes and returns ConnectionPool object.

func (*ConnectionPool) Delete

func (cp *ConnectionPool) Delete(key string)

Delete deletes connection object corresponding to given key.

func (*ConnectionPool) GetByNodeID

func (cp *ConnectionPool) GetByNodeID(driverName, nodeID string) map[string]*Connection

GetByNodeID returns map of connections, filtered with given driverName and optional nodeID.

func (*ConnectionPool) Put

func (cp *ConnectionPool) Put(key string, conn *Connection)

Put adds connection object into map.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL