cos

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeepAliveTime is the period after which a keepalive ping is sent on the
	// transport
	KeepAliveTime = 1200 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is grpc client client builder

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates an instance of Builder

func (*Builder) GetConn

func (b *Builder) GetConn(ctx context.Context, addr string) (*grpc.ClientConn, error)

GetConn returns the client connection to the server

func (*Builder) GetTLSConn

func (b *Builder) GetTLSConn(ctx context.Context, addr string) (*grpc.ClientConn, error)

GetTLSConn returns client connection to the server

func (*Builder) WithBlock

func (b *Builder) WithBlock() *Builder

WithBlock the dialing blocks until the underlying connection is up. Without this, Dial returns immediately and connecting the server happens in background.

func (*Builder) WithClientTransportCredentials

func (b *Builder) WithClientTransportCredentials(insecureSkipVerify bool, certPool *x509.CertPool) *Builder

WithClientTransportCredentials builds transport credentials for a gRPC client using the given properties.

func (*Builder) WithInsecure

func (b *Builder) WithInsecure() *Builder

WithInsecure set the connection as insecure

func (*Builder) WithKeepAliveParams

func (b *Builder) WithKeepAliveParams(params keepalive.ClientParameters) *Builder

WithKeepAliveParams set the keep alive params ClientParameters is used to set keepalive parameters on the client-side. These configure how the client will actively probe to notice when a connection is broken and send pings so intermediaries will be aware of the liveness of the connection. Make sure these parameters are set in coordination with the keepalive policy on the server, as incompatible settings can result in closing of connection.

func (*Builder) WithOptions

func (b *Builder) WithOptions(opts ...grpc.DialOption) *Builder

WithOptions set dial options

type ConnectionBuilder

type ConnectionBuilder interface {
	WithOptions(opts ...grpc.DialOption)
	WithInsecure()
	WithKeepAliveParams(params keepalive.ClientParameters)
	GetConn(ctx context.Context, addr string) (*grpc.ClientConn, error)
	GetTLSConn(ctx context.Context, addr string) (*grpc.ClientConn, error)
}

ConnectionBuilder is a builder to create GRPC connection to the GRPC Server

type ReadSideManager

type ReadSideManager interface {
	// GetLatestOffset retrieves the latest offset across all shards
	GetLatestOffset(ctx context.Context, in *cospb.GetLatestOffsetRequest) (*cospb.GetLatestOffsetResponse, error)
	// GetLatestOffsetByShard retrieves the latest offset given a shard
	GetLatestOffsetByShard(ctx context.Context, in *cospb.GetLatestOffsetByShardRequest) (*cospb.GetLatestOffsetByShardResponse, error)
	// RestartReadSide will clear the read side offset and start it over again
	// from the first offset and this across all shards
	RestartReadSide(ctx context.Context, in *cospb.RestartReadSideRequest) (*cospb.RestartReadSideResponse, error)
	// RestartReadSideByShard will clear the read side offset for the given shard and start it over again from the first offset
	RestartReadSideByShard(ctx context.Context, in *cospb.RestartReadSideByShardRequest) (*cospb.RestartReadSideByShardResponse, error)
	// PauseReadSide pauses a read side. This can be useful when running some data
	// migration and this across all shards
	PauseReadSide(ctx context.Context, in *cospb.PauseReadSideRequest) (*cospb.PauseReadSideResponse, error)
	// PauseReadSideByShard pauses a read side. This can be useful when running some data
	// migration and this for a given shard
	PauseReadSideByShard(ctx context.Context, in *cospb.PauseReadSideByShardRequest) (*cospb.PauseReadSideByShardResponse, error)
	// ResumeReadSide resumes a paused read side and this across all shards
	ResumeReadSide(ctx context.Context, in *cospb.ResumeReadSideRequest) (*cospb.ResumeReadSideResponse, error)
	// ResumeReadSideByShard  resumes a paused read side for a given shard
	ResumeReadSideByShard(ctx context.Context, in *cospb.ResumeReadSideByShardRequest) (*cospb.ResumeReadSideByShardResponse, error)
	// SkipOffset skips the current offset to read across all shards and continue with next. The operation will automatically restart the read side.
	SkipOffset(ctx context.Context, in *cospb.SkipOffsetRequest) (*cospb.SkipOffsetResponse, error)
	// SkipOffsetByShard skips the current offset to read for a given shard and continue with next. The operation will automatically restart the read side.
	SkipOffsetByShard(ctx context.Context, in *cospb.SkipOffsetByShardRequest) (*cospb.SkipOffsetByShardResponse, error)
}

ReadSideManager will be implemented by the CoS client to send requests to CoS read side manager service

func NewClient

func NewClient(ctx context.Context, cosHost string, cosPort int) (ReadSideManager, error)

NewClient creates a new instance of ReadSideManager

Jump to

Keyboard shortcuts

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