cluster

package
v0.0.0-...-d2438c5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OperationResponse

func OperationResponse(op *operations.Operation, version string) api.Response

OperationResponse creates an API Response from an operation.

Types

type API

type API struct {
	api.DefaultService
	// contains filtered or unexported fields
}

API defines a query API

func NewAPI

func NewAPI(name string, options ...Option) *API

NewAPI creates a API with sane defaults

func (*API) Get

func (a *API) Get(ctx context.Context, req *http.Request) api.Response

Get defines a service for calling "GET" method and returns a response. Return information about the cluster.

func (*API) Name

func (a *API) Name() string

Name returns the API name

func (*API) Put

func (a *API) Put(ctx context.Context, req *http.Request) api.Response

Put defines a service for calling "PUT" method and returns a response. Depending on the parameters passed and on local state this endpoint will either:

- bootstrap a new cluster (if this node is not clustered yet) - request to join an existing cluster - disable clustering on a node

type AcceptAPI

type AcceptAPI struct {
	api.DefaultService
	// contains filtered or unexported fields
}

AcceptAPI defines a query AcceptAPI

func NewAcceptAPI

func NewAcceptAPI(name string, options ...Option) *AcceptAPI

NewAcceptAPI creates a AcceptAPI with sane defaults

func (*AcceptAPI) Name

func (a *AcceptAPI) Name() string

Name returns the AcceptAPI name

func (*AcceptAPI) Post

func (a *AcceptAPI) Post(ctx context.Context, req *http.Request) api.Response

Post defines a service for calling "POST" method and returns a response. Return information about the cluster.

type Cluster

type Cluster struct {
	ServerName string `json:"server_name" yaml:"server_name"`
	Enabled    bool   `json:"enabled" yaml:"enabled"`
}

Cluster represents high-level information about the cluster.

type ClusterAcceptRequest

type ClusterAcceptRequest struct {
	Name    string `json:"name" yaml:"name"`
	Address string `json:"address" yaml:"address"`
	Schema  int    `json:"schema" yaml:"schema"`
	API     int    `json:"api" yaml:"api"`
}

ClusterAcceptRequest is a request for the /internal/cluster/accept endpoint.

type ClusterAcceptResponse

type ClusterAcceptResponse struct {
	RaftNodes  []RaftNode `json:"raft_nodes" yaml:"raft_nodes"`
	PrivateKey []byte     `json:"private_key" yaml:"private_key"`
}

ClusterAcceptResponse is a Response for the /internal/cluster/accept endpoint.

type ClusterJoin

type ClusterJoin struct {
	Cluster            `yaml:",inline"`
	ClusterAddress     string `json:"cluster_address" yaml:"cluster_address"`
	ClusterCertificate string `json:"cluster_certificate" yaml:"cluster_certificate"`
	ClusterKey         string `json:"cluster_key" yaml:"cluster_key"`
	ServerAddress      string `json:"server_address" yaml:"server_address"`
}

ClusterJoin represents the fields required to bootstrap or join a cluster.

type ClusterPromoteRequest

type ClusterPromoteRequest struct {
	RaftNodes []RaftNode `json:"raft_nodes" yaml:"raft_nodes"`
}

ClusterPromoteRequest is a Response for the /internal/cluster/promote endpoint.

type ClusterRaftNode

type ClusterRaftNode struct {
	ServerName string `json:"server_name" yaml:"server_name"`
	URL        string `json:"url" yaml:"url"`
	Database   bool   `json:"database" yaml:"database"`
	Status     string `json:"status" yaml:"status"`
	Message    string `json:"message" yaml:"message"`
}

ClusterRaftNode represents a node part of the raft cluster

type ClusterRenameRequest

type ClusterRenameRequest struct {
	ServerName string `json:"server_name" yaml:"server_name"`
}

ClusterRenameRequest is a request for the /cluster/members/{name} endpoint.

type MemberNodesAPI

type MemberNodesAPI struct {
	api.DefaultService
	// contains filtered or unexported fields
}

MemberNodesAPI defines a query MemberNodesAPI

func NewMemberNodesAPI

func NewMemberNodesAPI(name string, options ...Option) *MemberNodesAPI

NewMemberNodesAPI creates a MemberNodesAPI with sane defaults

func (*MemberNodesAPI) Delete

func (a *MemberNodesAPI) Delete(ctx context.Context, req *http.Request) api.Response

Delete defines a service for calling "DELETE" method and returns a response.

func (*MemberNodesAPI) Get

Get defines a service for calling "POST" method and returns a response. Return information about the cluster.

func (*MemberNodesAPI) Name

func (a *MemberNodesAPI) Name() string

Name returns the MemberNodesAPI name

func (*MemberNodesAPI) Post

func (a *MemberNodesAPI) Post(ctx context.Context, req *http.Request) api.Response

Post defines a service for calling "POST" method and returns a response.

type MembersAPI

type MembersAPI struct {
	api.DefaultService
	// contains filtered or unexported fields
}

MembersAPI defines a query MembersAPI

func NewMembersAPI

func NewMembersAPI(name string, options ...Option) *MembersAPI

NewMembersAPI creates a MembersAPI with sane defaults

func (*MembersAPI) Get

func (a *MembersAPI) Get(ctx context.Context, req *http.Request) api.Response

Get defines a service for calling "POST" method and returns a response. Return information about the cluster.

func (*MembersAPI) Name

func (a *MembersAPI) Name() string

Name returns the MembersAPI name

type Option

type Option func(*options)

Option to be passed to Connect to customize the resulting instance.

func WithClock

func WithClock(clock clock.Clock) Option

WithClock sets the clock on the option

func WithFileSystem

func WithFileSystem(fileSystem fsys.FileSystem) Option

WithFileSystem sets the fileSystem on the option

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger sets the logger on the option

type PromoteAPI

type PromoteAPI struct {
	api.DefaultService
	// contains filtered or unexported fields
}

PromoteAPI defines a query PromoteAPI

func NewPromoteAPI

func NewPromoteAPI(name string, options ...Option) *PromoteAPI

NewPromoteAPI creates a PromoteAPI with sane defaults

func (*PromoteAPI) Name

func (a *PromoteAPI) Name() string

Name returns the PromoteAPI name

func (*PromoteAPI) Post

func (a *PromoteAPI) Post(ctx context.Context, req *http.Request) api.Response

Post defines a service for calling "POST" method and returns a response. Return information about the cluster.

type RaftNode

type RaftNode struct {
	ID      int64  `json:"id" yaml:"id"`
	Address string `json:"address" yaml:"address"`
}

RaftNode a node that is part of the raft cluster.

type RebalanceAPI

type RebalanceAPI struct {
	api.DefaultService
	// contains filtered or unexported fields
}

RebalanceAPI defines a query RebalanceAPI

func NewRebalanceAPI

func NewRebalanceAPI(name string, options ...Option) *RebalanceAPI

NewRebalanceAPI creates a RebalanceAPI with sane defaults

func (*RebalanceAPI) Name

func (a *RebalanceAPI) Name() string

Name returns the RebalanceAPI name

func (*RebalanceAPI) Post

func (a *RebalanceAPI) Post(ctx context.Context, req *http.Request) api.Response

Post defines a service for calling "POST" method and returns a response. Return information about the cluster.

Jump to

Keyboard shortcuts

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