lbgrpc

package
v0.0.0-...-5fd007c Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxReplicaCount = 128 // arbitrary, but sensible

)

Variables

View Source
var (
	CreateRetryOpts = wait.Backoff{
		Delay:      250 * time.Millisecond,
		Factor:     2.0,
		DelayLimit: 2 * time.Second,
		Retries:    8,
	}

	DeleteRetryOpts = wait.Backoff{
		Delay:      200 * time.Millisecond,
		Factor:     2.0,
		DelayLimit: 1 * time.Second,
		Retries:    15,
	}

	UpdateRetryOpts = wait.Backoff{
		Delay:      250 * time.Millisecond,
		Factor:     1.5,
		DelayLimit: 1 * time.Second,
		Retries:    15,
	}
)

Functions

This section is empty.

Types

type Client

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

func Dial

func Dial(
	ctx context.Context, log *logrus.Entry, targets endpoint.Slice, mgmtScheme string,
) (*Client, error)

Dial() creates a LightOS cluster client. it is a blocking call and will only return once the connection to [at least one of the] `targets` has been actually established - subject to `ctx` limitations. if `ctx` specified timeout or duration - dialling (and only dialling!) timeout will be set accordingly. `ctx` can also be used to cancel the dialling process, as per usual.

the cluster client will make an effort to transparently reconnect to one of the `targets` in case of connection loss. if the process of finding a live and responsive target amongst `targets` and establishing the connection takes longer than the actual operation context timeout (as opposed to the `ctx` passed here) - `DeadlineExceeded` will be returned as usual, and the caller can retry the operation.

func (*Client) Close

func (c *Client) Close()

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(
	ctx context.Context, name string, projectName string, srcVolUUID guuid.UUID,
	descr string, blocking bool,
) (*lb.Snapshot, error)

func (*Client) CreateVolume

func (c *Client) CreateVolume(
	ctx context.Context, name string, capacity uint64, replicaCount uint32,
	compress bool, acl []string, projectName string, snapshotID guuid.UUID, qosPolicyName string,
	blocking bool,
) (*lb.Volume, error)

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(
	ctx context.Context, uuid guuid.UUID, projectName string, blocking bool,
) error

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(
	ctx context.Context, uuid guuid.UUID, projectName string, blocking bool,
) error

func (*Client) GetCluster

func (c *Client) GetCluster(ctx context.Context) (*lb.Cluster, error)

func (*Client) GetClusterInfo

func (c *Client) GetClusterInfo(ctx context.Context) (*lb.ClusterInfo, error)

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(
	ctx context.Context, uuid guuid.UUID, projectName string,
) (*lb.Snapshot, error)

func (*Client) GetSnapshotByName

func (c *Client) GetSnapshotByName(
	ctx context.Context, name string, projectName string,
) (*lb.Snapshot, error)

func (*Client) GetVolume

func (c *Client) GetVolume(
	ctx context.Context, uuid guuid.UUID, projectName string,
) (*lb.Volume, error)

func (*Client) GetVolumeByName

func (c *Client) GetVolumeByName(
	ctx context.Context, name string, projectName string,
) (*lb.Volume, error)

func (*Client) ID

func (c *Client) ID() string

func (*Client) ListNodes

func (c *Client) ListNodes(ctx context.Context) ([]*lb.Node, error)

func (*Client) RemoteOk

func (c *Client) RemoteOk(ctx context.Context) error

func (*Client) Targets

func (c *Client) Targets() string

func (*Client) UpdateVolume

func (c *Client) UpdateVolume(
	ctx context.Context, uuid guuid.UUID, projectName string, hook lb.VolumeUpdateHook,
) (*lb.Volume, error)

UpdateVolume() attempts to *overwrite* the fields of the volume specified by `uuid` with non-nil/default fields of `update` return value of the `hook`, see VolumeUpdateHook docs for details. it handles verifying that the update successfully completed and handles some of the common errors (such as retrying on codes.Unavailable, concurrent racing updates, etc.) internally, but delegates the higher-level application logic to the `hook`.

Jump to

Keyboard shortcuts

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