client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLeaseTTL = 9000000000

MaxLeaseTTL is the maximum lease TTL value

Variables

View Source
var (
	ErrNoAvailableEndpoint = errors.New("cita-cloud-ctl: no available endpoint")
)

Functions

This section is empty.

Types

type AccountInterface

type AccountInterface interface {
	CreateAccount(ctx context.Context, in *pb.Account) (*pb.Account, error)
	ListAccount(ctx context.Context, in *pb.ListAccountRequest) (*pb.AccountList, error)
}

func NewAccount

func NewAccount(c *Client) AccountInterface

type AllInOneInterface

type AllInOneInterface interface {
	Create(ctx context.Context, request *pb.AllInOneCreateRequest) (*pb.AllInOneCreateResponse, error)
}

func NewAllInOne

func NewAllInOne(c *Client) AllInOneInterface

type ChainInterface

type ChainInterface interface {
	Init(ctx context.Context, chain *pb.Chain) (*pb.ChainSimpleResponse, error)
	Online(ctx context.Context, request *pb.ChainOnlineRequest) (*pb.ChainSimpleResponse, error)
	List(ctx context.Context, request *pb.ListChainRequest) (*pb.ChainList, error)
	Describe(ctx context.Context, request *pb.ChainDescribeRequest) (*pb.ChainDescribeResponse, error)
	Delete(ctx context.Context, request *pb.ChainDeleteRequest) (*emptypb.Empty, error)
}

func NewChain

func NewChain(c *Client) ChainInterface

type Client

type Client struct {
	ChainInterface
	AccountInterface
	NodeInterface
	AllInOneInterface
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Client, error)

func (*Client) Dial

func (c *Client) Dial(ep string) (*grpc.ClientConn, error)

Dial connects to a single endpoint using the client's config.

type Config

type Config struct {
	// Endpoints is a list of URLs.
	Endpoint string `json:"endpoint"`

	// AutoSyncInterval is the interval to update endpoints with its latest members.
	// 0 disables auto-sync. By default auto-sync is disabled.
	AutoSyncInterval time.Duration `json:"auto-sync-interval"`

	// DialTimeout is the timeout for failing to establish a connection.
	DialTimeout time.Duration `json:"dial-timeout"`

	// DialKeepAliveTime is the time after which client pings the server to see if
	// transport is alive.
	DialKeepAliveTime time.Duration `json:"dial-keep-alive-time"`

	// DialKeepAliveTimeout is the time that the client waits for a response for the
	// keep-alive probe. If the response is not received in this time, the connection is closed.
	DialKeepAliveTimeout time.Duration `json:"dial-keep-alive-timeout"`

	// MaxCallSendMsgSize is the client-side request send limit in bytes.
	// If 0, it defaults to 2.0 MiB (2 * 1024 * 1024).
	// Make sure that "MaxCallSendMsgSize" < server-side default send/recv limit.
	// ("--max-request-bytes" flag to etcd or "embed.Config.MaxRequestBytes").
	MaxCallSendMsgSize int

	// MaxCallRecvMsgSize is the client-side response receive limit.
	// If 0, it defaults to "math.MaxInt32", because range response can
	// easily exceed request send limits.
	// Make sure that "MaxCallRecvMsgSize" >= server-side default send/recv limit.
	// ("--max-request-bytes" flag to etcd or "embed.Config.MaxRequestBytes").
	MaxCallRecvMsgSize int

	// TLS holds the client secure credentials, if any.
	TLS *tls.Config

	// DialOptions is a list of dial options for the grpc client (e.g., for interceptors).
	// For example, pass "grpc.WithBlock()" to block until the underlying connection is up.
	// Without this, Dial returns immediately and connecting the server happens in background.
	DialOptions []grpc.DialOption

	// Context is the default client context; it can be used to cancel grpc dial out and
	// other operations that do not have an explicit context.
	Context context.Context

	// PermitWithoutStream when set will allow client to send keepalive pings to server without any active streams(RPCs).
	PermitWithoutStream bool `json:"permit-without-stream"`
}

type NodeInterface

type NodeInterface interface {
	Init(ctx context.Context, node *pb.Node) (*pb.NodeSimpleResponse, error)
	List(ctx context.Context, request *pb.ListNodeRequest) (*pb.NodeList, error)
	Start(ctx context.Context, request *pb.NodeStartRequest) (*pb.NodeSimpleResponse, error)
	Stop(ctx context.Context, request *pb.NodeStopRequest) (*emptypb.Empty, error)
	ReloadConfig(ctx context.Context, request *pb.ReloadConfigRequest) (*emptypb.Empty, error)
	Delete(ctx context.Context, request *pb.NodeDeleteRequest) (*emptypb.Empty, error)
}

func NewNode

func NewNode(c *Client) NodeInterface

Jump to

Keyboard shortcuts

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