http

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseRequest    = coderr.NewCodeError(coderr.BadRequest, "parse request params")
	ErrDropTable       = coderr.NewCodeError(coderr.Internal, "drop table")
	ErrRouteTable      = 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 fail")
)

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(clusterManager cluster.Manager, serverStatus *status.ServerStatus, forwardClient *ForwardClient) *API

func (*API) NewAPIRouter

func (a *API) NewAPIRouter() *Router

type DropTableRequest

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

type ForwardClient

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

func NewForwardClient

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

type GetShardTables

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

type NodeShardsRequest

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

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) 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) 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 UpdateEnableScheduleRequest added in v1.2.0

type UpdateEnableScheduleRequest struct {
	ClusterName    string `json:"clusterName"`
	EnableSchedule bool   `json:"enableSchedule"`
}

Jump to

Keyboard shortcuts

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