govern

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

Module mechanism

Service center(SC) support an extend modules mechanism that developers can new some features in SC easily.

Just 4 steps, you can add a module in service center

  1. Create a module(package) under the github.com/apache/servicecomb-service-center/server package.
  2. Here you just need to implement the controller and service interfaces in your module.
  3. And register service to SC when the module initializes.
  4. Import the package in github.com/apache/servicecomb-service-center/server/bootstrap/bootstrap.go

Quit start for the RESTful module

Implement the ROAServantService interface.

package hello

import (
	"net/http"
	"github.com/apache/servicecomb-service-center/pkg/rest"
)

type HelloService struct {
}

func (s *HelloService) URLPatterns() []rest.Route {
	return []rest.Route{
		{
		    rest.HTTP_METHOD_GET, // Method is one of the following: GET,PUT,POST,DELETE
		    "/helloWorld", // Path contains a path pattern
		    s.SayHello, // rest callback function for the specified Method and Path
        },
	}
}

func (s *HelloService) SayHello(w http.ResponseWriter, r *http.Request) {
    // say Hi
}

Register the service in SC ROA framework when the module initializes.

package hello

import roa "github.com/apache/servicecomb-service-center/pkg/rest"

func init() {
    roa.RegisterServant(&HelloService{})
}

Modify bootstarp.go file to import your module.

// module
import _ "github.com/apache/servicecomb-service-center/server/hello"

About GRPC module

To see govern module for help.

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Circle

type Circle struct {
	Nodes []Node `json:"nodes"`
}

Circle 环信息

type GetInstanceCountByDomainResponse

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

type Graph

type Graph struct {
	Nodes   []Node   `json:"nodes"`
	Lines   []Line   `json:"lines"`
	Circles []Circle `json:"circles"`
	Visits  []string `json:"-"`
}

Graph 图全集信息

type Line

type Line struct {
	From        Node   `json:"from"`
	To          Node   `json:"to"`
	Type        string `json:"type"`
	Color       string `json:"color"`
	Description string `json:"descriptor"`
}

Line 连接线信息

type Node

type Node struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	AppID    string   `json:"appId"`
	Version  string   `json:"version"`
	Type     string   `json:"type"`
	Color    string   `json:"color"`
	Position string   `json:"position"`
	Visits   []string `json:"-"`
}

Node 节点信息

type ResourceV3

type ResourceV3 struct {
	ResourceV4
}

Service 治理相关接口服务

func (*ResourceV3) URLPatterns

func (governService *ResourceV3) URLPatterns() []rest.Route

URLPatterns 路由

type ResourceV4

type ResourceV4 struct {
}

Service 治理相关接口服务

func (*ResourceV4) GetAllApplications

func (governService *ResourceV4) GetAllApplications(w http.ResponseWriter, r *http.Request)

func (*ResourceV4) GetAllServicesInfo

func (governService *ResourceV4) GetAllServicesInfo(w http.ResponseWriter, r *http.Request)

func (*ResourceV4) GetGraph

func (governService *ResourceV4) GetGraph(w http.ResponseWriter, r *http.Request)

GetGraph 获取依赖连接图详细依赖关系

func (*ResourceV4) GetServiceDetail

func (governService *ResourceV4) GetServiceDetail(w http.ResponseWriter, r *http.Request)

GetServiceDetail 查询服务详细信息

func (*ResourceV4) URLPatterns

func (governService *ResourceV4) URLPatterns() []rest.Route

URLPatterns 路由

type Service

type Service struct {
}

func (*Service) GetApplications

func (governService *Service) GetApplications(ctx context.Context, in *pb.GetAppsRequest) (*pb.GetAppsResponse, error)

func (*Service) GetServiceDetail

func (governService *Service) GetServiceDetail(ctx context.Context, in *pb.GetServiceRequest) (*pb.GetServiceDetailResponse, error)

func (*Service) GetServicesInfo

func (governService *Service) GetServicesInfo(ctx context.Context, in *pb.GetServicesInfoRequest) (*pb.GetServicesInfoResponse, error)

type ServiceDetailOpt

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

Jump to

Keyboard shortcuts

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