handlers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocNodeForKeyspaceGroup

func AllocNodeForKeyspaceGroup(c *gin.Context)

AllocNodeForKeyspaceGroup allocates nodes for keyspace group.

func CreateKeyspace

func CreateKeyspace(c *gin.Context)

CreateKeyspace creates keyspace according to given input.

@Tags		keyspaces
@Summary	Create new keyspace.
@Param		body	body	CreateKeyspaceParams	true	"Create keyspace parameters"
@Produce	json
@Success	200	{object}	KeyspaceMeta
@Failure	400	{string}	string	"The input is invalid."
@Failure	500	{string}	string	"PD server failed to proceed the request."
@Router		/keyspaces [post]

func CreateKeyspaceGroups

func CreateKeyspaceGroups(c *gin.Context)

CreateKeyspaceGroups creates keyspace groups.

func DeleteKeyspaceGroupByID

func DeleteKeyspaceGroupByID(c *gin.Context)

DeleteKeyspaceGroupByID deletes keyspace group by ID.

func FinishSplitKeyspaceByID

func FinishSplitKeyspaceByID(c *gin.Context)

FinishSplitKeyspaceByID finishes split keyspace group by ID.

func GetKeyspaceGroupByID

func GetKeyspaceGroupByID(c *gin.Context)

GetKeyspaceGroupByID gets keyspace group by ID.

func GetKeyspaceGroups

func GetKeyspaceGroups(c *gin.Context)

GetKeyspaceGroups gets keyspace groups from the start ID with limit. If limit is 0, it will load all keyspace groups from the start ID.

func LoadAllKeyspaces

func LoadAllKeyspaces(c *gin.Context)

LoadAllKeyspaces loads range of keyspaces.

@Tags		keyspaces
@Summary	list keyspaces.
@Param		page_token	query	string	false	"page token"
@Param		limit		query	string	false	"maximum number of results to return"
@Produce	json
@Success	200	{object}	LoadAllKeyspacesResponse
@Failure	400	{string}	string	"The input is invalid."
@Failure	500	{string}	string	"PD server failed to proceed the request."
@Router		/keyspaces [get]

func LoadKeyspace

func LoadKeyspace(c *gin.Context)

LoadKeyspace returns target keyspace.

@Tags		keyspaces
@Summary	Get keyspace info.
@Param		name	path	string	true	"Keyspace Name"
@Produce	json
@Success	200	{object}	KeyspaceMeta
@Failure	500	{string}	string	"PD server failed to proceed the request."
@Router		/keyspaces/{name} [get]

func LoadKeyspaceByID

func LoadKeyspaceByID(c *gin.Context)

LoadKeyspaceByID returns target keyspace.

@Tags		keyspaces
@Summary	Get keyspace info.
@Param		id	path	string	true	"Keyspace id"
@Produce	json
@Success	200	{object}	KeyspaceMeta
@Failure	500	{string}	string	"PD server failed to proceed the request."
@Router		/keyspaces/id/{id} [get]

func RegisterKeyspace

func RegisterKeyspace(r *gin.RouterGroup)

RegisterKeyspace register keyspace related handlers to router paths.

func RegisterTSOKeyspaceGroup

func RegisterTSOKeyspaceGroup(r *gin.RouterGroup)

RegisterTSOKeyspaceGroup registers keyspace group handlers to the server.

func SplitKeyspaceGroupByID

func SplitKeyspaceGroupByID(c *gin.Context)

SplitKeyspaceGroupByID splits keyspace group by ID into a new keyspace group with the given new ID. And the keyspaces in the old keyspace group will be moved to the new keyspace group.

func UpdateKeyspaceConfig

func UpdateKeyspaceConfig(c *gin.Context)

UpdateKeyspaceConfig updates target keyspace's config. This api uses PATCH semantic and supports JSON Merge Patch. format and processing rules.

@Tags		keyspaces
@Summary	Update keyspace config.
@Param		name	path	string				true	"Keyspace Name"
@Param		body	body	UpdateConfigParams	true	"Update keyspace parameters"
@Produce	json
@Success	200	{object}	KeyspaceMeta
@Failure	400	{string}	string	"The input is invalid."
@Failure	500	{string}	string	"PD server failed to proceed the request."

Router /keyspaces/{name}/config [patch]

func UpdateKeyspaceState

func UpdateKeyspaceState(c *gin.Context)

UpdateKeyspaceState update the target keyspace's state.

@Tags		keyspaces
@Summary	Update keyspace state.
@Param		name	path	string				true	"Keyspace Name"
@Param		body	body	UpdateStateParam	true	"New state for the keyspace"
@Produce	json
@Success	200	{object}	KeyspaceMeta
@Failure	400	{string}	string	"The input is invalid."
@Failure	500	{string}	string	"PD server failed to proceed the request."

Router /keyspaces/{name}/state [put]

Types

type AllocNodeForKeyspaceGroupParams

type AllocNodeForKeyspaceGroupParams struct {
	Replica int `json:"replica"`
}

AllocNodeForKeyspaceGroupParams defines the params for allocating nodes for keyspace groups.

type CreateKeyspaceGroupParams

type CreateKeyspaceGroupParams struct {
	KeyspaceGroups []*endpoint.KeyspaceGroup `json:"keyspace-groups"`
}

CreateKeyspaceGroupParams defines the params for creating keyspace groups.

type CreateKeyspaceParams

type CreateKeyspaceParams struct {
	Name   string            `json:"name"`
	Config map[string]string `json:"config"`
}

CreateKeyspaceParams represents parameters needed when creating a new keyspace. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

type KeyspaceMeta

type KeyspaceMeta struct {
	*keyspacepb.KeyspaceMeta
}

KeyspaceMeta wraps keyspacepb.KeyspaceMeta to provide custom JSON marshal.

func (*KeyspaceMeta) MarshalJSON

func (meta *KeyspaceMeta) MarshalJSON() ([]byte, error)

MarshalJSON creates custom marshal of KeyspaceMeta with the following: 1. Keyspace State are marshaled to their corresponding name for better readability.

func (*KeyspaceMeta) UnmarshalJSON

func (meta *KeyspaceMeta) UnmarshalJSON(data []byte) error

UnmarshalJSON reverse KeyspaceMeta's the Custom JSON marshal.

type LoadAllKeyspacesResponse

type LoadAllKeyspacesResponse struct {
	Keyspaces []*KeyspaceMeta `json:"keyspaces"`
	// Token that can be used to read immediate next page.
	// If it's empty, then end has been reached.
	NextPageToken string `json:"next_page_token"`
}

LoadAllKeyspacesResponse represents response given when loading all keyspaces. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

type SplitKeyspaceGroupByIDParams

type SplitKeyspaceGroupByIDParams struct {
	NewID     uint32   `json:"new-id"`
	Keyspaces []uint32 `json:"keyspaces"`
}

SplitKeyspaceGroupByIDParams defines the params for splitting a keyspace group.

type UpdateConfigParams

type UpdateConfigParams struct {
	Config map[string]*string `json:"config"`
}

UpdateConfigParams represents parameters needed to modify target keyspace's configs. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it. A Map of string to string pointer is used to differentiate between json null and "", which will both be set to "" if value type is string during binding.

type UpdateStateParam

type UpdateStateParam struct {
	State string `json:"state"`
}

UpdateStateParam represents parameters needed to modify target keyspace's state. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.

Jump to

Keyboard shortcuts

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