http

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 29 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseRequest       = coderr.NewCodeError(coderr.BadRequest, "parse request params")
	ErrTable              = coderr.NewCodeError(coderr.Internal, "table")
	ErrRoute              = coderr.NewCodeError(coderr.Internal, "route table")
	ErrGetNodeShards      = coderr.NewCodeError(coderr.Internal, "get node shards")
	ErrCreateProcedure    = coderr.NewCodeError(coderr.Internal, "create procedure")
	ErrSubmitProcedure    = coderr.NewCodeError(coderr.Internal, "submit procedure")
	ErrGetCluster         = coderr.NewCodeError(coderr.Internal, "get cluster")
	ErrAllocShardID       = coderr.NewCodeError(coderr.Internal, "alloc shard id")
	ErrForwardToLeader    = coderr.NewCodeError(coderr.Internal, "forward to leader")
	ErrParseLeaderAddr    = coderr.NewCodeError(coderr.Internal, "parse leader addr")
	ErrHealthCheck        = coderr.NewCodeError(coderr.Internal, "server health check")
	ErrParseTopology      = coderr.NewCodeError(coderr.Internal, "parse topology type")
	ErrUpdateFlowLimiter  = coderr.NewCodeError(coderr.Internal, "update flow limiter")
	ErrGetDeployMode      = coderr.NewCodeError(coderr.Internal, "get deploy mode")
	ErrUpdateDeployMode   = coderr.NewCodeError(coderr.Internal, "update deploy mode")
	ErrAddLearner         = coderr.NewCodeError(coderr.Internal, "add member as learner")
	ErrListMembers        = coderr.NewCodeError(coderr.Internal, "get member list")
	ErrRemoveMembers      = coderr.NewCodeError(coderr.Internal, "remove member")
	ErrGetMember          = coderr.NewCodeError(coderr.Internal, "get member")
	ErrListAffinityRules  = coderr.NewCodeError(coderr.Internal, "list affinity rules")
	ErrAddAffinityRule    = coderr.NewCodeError(coderr.Internal, "add affinity rule")
	ErrRemoveAffinityRule = coderr.NewCodeError(coderr.Internal, "remove affinity rule")
)

Functions

func Param added in v1.2.1

func Param(ctx context.Context, p string) string

Param returns param p for the context, or the empty string when param does not exist in context.

Types

type API

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

func NewAPI

func NewAPI(clusterManager cluster.Manager, serverStatus *status.ServerStatus, forwardClient *ForwardClient, flowLimiter *limiter.FlowLimiter, etcdClient *clientv3.Client) *API

func (*API) NewAPIRouter

func (a *API) NewAPIRouter() *Router

type AddMemberRequest added in v1.2.5

type AddMemberRequest struct {
	MemberAddrs []string `json:"memberAddrs"`
}

type CreateClusterRequest added in v1.2.1

type CreateClusterRequest struct {
	Name           string `json:"Name"`
	NodeCount      uint32 `json:"NodeCount"`
	ShardTotal     uint32 `json:"ShardTotal"`
	EnableSchedule bool   `json:"enableSchedule"`
	TopologyType   string `json:"topologyType"`
}

type DiagnoseShardResult added in v1.2.7

type DiagnoseShardResult struct {
	// shardID -> nodeName
	UnregisteredShards []storage.ShardID                       `json:"unregistered_shards"`
	UnreadyShards      map[storage.ShardID]DiagnoseShardStatus `json:"unready_shards"`
}

type DiagnoseShardStatus added in v1.2.7

type DiagnoseShardStatus struct {
	NodeName string `json:"node_name"`
	Status   string `json:"status"`
}

type DropTableRequest

type DropTableRequest struct {
	ClusterName string `json:"clusterName"`
	SchemaName  string `json:"schemaName"`
	Table       string `json:"table"`
}

type EtcdAPI added in v1.2.5

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

func NewEtcdAPI added in v1.2.5

func NewEtcdAPI(etcdClient *clientv3.Client, forwardClient *ForwardClient) EtcdAPI

type ForwardClient

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

func NewForwardClient

func NewForwardClient(member *member.Member, port int) *ForwardClient

func (*ForwardClient) GetLeaderAddr added in v1.2.4

func (s *ForwardClient) GetLeaderAddr(ctx context.Context) (string, error)

type GetShardTablesRequest added in v1.2.4

type GetShardTablesRequest struct {
	ClusterName string   `json:"clusterName"`
	ShardIDs    []uint32 `json:"shardIDs"`
}

type MoveLeaderRequest added in v1.2.5

type MoveLeaderRequest struct {
	MemberName string `json:"memberName"`
}

type NodeShardsRequest

type NodeShardsRequest struct {
	ClusterName string `json:"clusterName"`
}

type PromoteLearnerRequest added in v1.2.5

type PromoteLearnerRequest struct {
	LearnerName string `json:"learnerName"`
}

type QueryTableRequest added in v1.2.7

type QueryTableRequest struct {
	ClusterName string   `json:"clusterName"`
	SchemaName  string   `json:"schemaName"`
	Names       []string `json:"names"`
	IDs         []uint64 `json:"ids"`
}

type RemoveMemberRequest added in v1.2.5

type RemoveMemberRequest struct {
	MemberName string `json:"memberName"`
}

type RemoveShardAffinitiesRequest added in v1.2.7

type RemoveShardAffinitiesRequest struct {
	ShardIDs []storage.ShardID `json:"shardIDs"`
}

type RouteRequest

type RouteRequest struct {
	ClusterName string   `json:"clusterName"`
	SchemaName  string   `json:"schemaName"`
	Tables      []string `json:"table"`
}

type Router

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

Router wraps httprouter.Router and adds support for prefixed sub-routers, per-request context injections and instrumentation.

func New

func New() *Router

New returns a new Router.

func (*Router) Del

func (r *Router) Del(path string, h http.HandlerFunc)

Del registers a new DELETE route.

func (*Router) Get

func (r *Router) Get(path string, h http.HandlerFunc)

Get registers a new GET route.

func (*Router) GetWithoutPrefix added in v1.2.7

func (r *Router) GetWithoutPrefix(path string, h http.HandlerFunc)

GetWithoutPrefix registers a new GET route without prefix.

func (*Router) Head

func (r *Router) Head(path string, h http.HandlerFunc)

Head registers a new HEAD route.

func (*Router) Options

func (r *Router) Options(path string, h http.HandlerFunc)

Options registers a new OPTIONS route.

func (*Router) Post

func (r *Router) Post(path string, h http.HandlerFunc)

Post registers a new POST route.

func (*Router) Put

func (r *Router) Put(path string, h http.HandlerFunc)

Put registers a new PUT route.

func (*Router) PutWithoutPrefix added in v1.2.7

func (r *Router) PutWithoutPrefix(path string, h http.HandlerFunc)

PutWithoutPrefix registers a new PUT route without prefix.

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler.

func (*Router) WithInstrumentation

func (r *Router) WithInstrumentation(instrh func(handlerName string, handler http.HandlerFunc) http.HandlerFunc) *Router

WithInstrumentation returns a router with instrumentation support.

func (*Router) WithPrefix

func (r *Router) WithPrefix(prefix string) *Router

WithPrefix returns a router that prefixes all registered routes with prefix.

type Service

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

Service is wrapper for http.Server

func NewHTTPService

func NewHTTPService(port int, readTimeout time.Duration, writeTimeout time.Duration, router *Router) *Service

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop() error

type SplitRequest

type SplitRequest struct {
	ClusterName string   `json:"clusterName"`
	SchemaName  string   `json:"schemaName"`
	ShardID     uint32   `json:"shardID"`
	SplitTables []string `json:"splitTables"`
	NodeName    string   `json:"nodeName"`
}

type TransferLeaderRequest

type TransferLeaderRequest struct {
	ClusterName       string `json:"clusterName"`
	ShardID           uint32 `json:"shardID"`
	OldLeaderNodeName string `json:"OldLeaderNodeName"`
	NewLeaderNodeName string `json:"newLeaderNodeName"`
}

type UpdateClusterRequest added in v1.2.1

type UpdateClusterRequest struct {
	NodeCount                   uint32 `json:"nodeCount"`
	ShardTotal                  uint32 `json:"shardTotal"`
	EnableSchedule              bool   `json:"enableSchedule"`
	TopologyType                string `json:"topologyType"`
	ProcedureExecutingBatchSize uint32 `json:"procedureExecutingBatchSize"`
}

type UpdateDeployModeRequest added in v1.2.7

type UpdateDeployModeRequest struct {
	Enable bool `json:"enable"`
}

type UpdateFlowLimiterRequest added in v1.2.1

type UpdateFlowLimiterRequest struct {
	Limit  int  `json:"limit"`
	Burst  int  `json:"burst"`
	Enable bool `json:"enable"`
}

type UpdateMemberRequest added in v1.2.5

type UpdateMemberRequest struct {
	OldMemberName string   `json:"oldMemberName"`
	NewMemberAddr []string `json:"newMemberAddr"`
}

Jump to

Keyboard shortcuts

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