manage

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2017 License: Apache-2.0 Imports: 5 Imported by: 42

Documentation

Index

Constants

View Source
const (
	// special service operations
	SpecialOpPrefix      = "?"
	ListServiceOp        = SpecialOpPrefix + "List-Service"
	ListServiceMemberOp  = SpecialOpPrefix + "List-ServiceMember"
	GetConfigFileOp      = SpecialOpPrefix + "Get-Config-File"
	GetServiceStatusOp   = SpecialOpPrefix + "Get-Service-Status"
	ServiceInitializedOp = SpecialOpPrefix + "Set-Service-Initialized"
	RunTaskOp            = SpecialOpPrefix + "Run-Task"
	GetTaskStatusOp      = SpecialOpPrefix + "Get-Task-Status"
	DeleteTaskOp         = SpecialOpPrefix + "Delete-Task"

	CatalogOpPrefix           = SpecialOpPrefix + "Catalog-"
	CatalogCreateMongoDBOp    = CatalogOpPrefix + "Create-MongoDB"
	CatalogCreatePostgreSQLOp = CatalogOpPrefix + "Create-PostgreSQL"
	CatalogCreateCassandraOp  = CatalogOpPrefix + "Create-Cassandra"
	CatalogCreateZooKeeperOp  = CatalogOpPrefix + "Create-ZooKeeper"
	CatalogCreateKafkaOp      = CatalogOpPrefix + "Create-Kafka"
	CatalogCreateRedisOp      = CatalogOpPrefix + "Create-Redis"
	CatalogCheckServiceInitOp = CatalogOpPrefix + "Check-Service-Init"
	CatalogSetServiceInitOp   = CatalogOpPrefix + "Set-Service-Init"
	CatalogSetRedisInitOp     = CatalogOpPrefix + "Set-Redis-Init"

	InternalOpPrefix                 = SpecialOpPrefix + "Internal-"
	InternalGetServiceTaskOp         = InternalOpPrefix + "GetServiceTask"
	InternalListActiveServiceTasksOp = InternalOpPrefix + "ListActiveServiceTasks"

	// response headers
	RequestID       = "x-RequestId"
	Server          = "Server"
	ContentType     = "Content-Type"
	JsonContentType = "application/json"
)

Variables

This section is empty.

Functions

func ConvertHTTPError

func ConvertHTTPError(httperrcode int) error

func ConvertToHTTPError

func ConvertToHTTPError(err error) (errmsg string, errcode int)

func CreateConfigFile

func CreateConfigFile(ctx context.Context, dbIns db.DB, cfgfile *common.ConfigFile, requuid string) (*common.ConfigFile, error)

Types

type CatalogCheckServiceInitRequest

type CatalogCheckServiceInitRequest struct {
	ServiceType string

	Service *ServiceCommonRequest

	Admin       string
	AdminPasswd string

	// Redis specific fields.
	// TODO they should be moved to ServiceAttr.UserData.
	Shards           int64
	ReplicasPerShard int64
}

CatalogCheckServiceInitRequest checks whether one catalog service is initialized.

type CatalogCheckServiceInitResponse

type CatalogCheckServiceInitResponse struct {
	Initialized   bool
	StatusMessage string
}

CatalogCheckServiceInitResponse returns the service init status

type CatalogCreateCassandraRequest

type CatalogCreateCassandraRequest struct {
	Service  *ServiceCommonRequest
	Resource *common.Resources

	Replicas     int64
	VolumeSizeGB int64
}

CatalogCreateCassandraRequest creates a Cassandra service.

type CatalogCreateKafkaRequest

type CatalogCreateKafkaRequest struct {
	Service  *ServiceCommonRequest
	Resource *common.Resources

	Replicas     int64
	VolumeSizeGB int64

	AllowTopicDel  bool
	RetentionHours int64
	// the existing ZooKeeper service that Kafka will use.
	ZkServiceName string
}

CatalogCreateKafkaRequest creates a Kafka service.

type CatalogCreateMongoDBRequest

type CatalogCreateMongoDBRequest struct {
	Service  *ServiceCommonRequest
	Resource *common.Resources

	Replicas     int64
	VolumeSizeGB int64

	Admin       string
	AdminPasswd string
}

CatalogCreateMongoDBRequest creates a MongoDB ReplicaSet service.

type CatalogCreatePostgreSQLRequest

type CatalogCreatePostgreSQLRequest struct {
	Service  *ServiceCommonRequest
	Resource *common.Resources

	Replicas     int64
	VolumeSizeGB int64

	Admin          string
	AdminPasswd    string
	ReplUser       string
	ReplUserPasswd string
}

CatalogCreatePostgreSQLRequest creates a PostgreSQL service.

type CatalogCreateRedisRequest

type CatalogCreateRedisRequest struct {
	Service *ServiceCommonRequest

	// Resources.MaxMemoryMB should always be set.
	// if cluster mode is enabled (Shards >= 3), the actual redis memory will be
	// Resources.MaxMemoryMB - default output buffer for the slaves (512MB).
	Resource *common.Resources

	Options *CatalogRedisOptions
}

CatalogCreateRedisRequest creates a Redis service.

type CatalogCreateZooKeeperRequest

type CatalogCreateZooKeeperRequest struct {
	Service  *ServiceCommonRequest
	Resource *common.Resources

	Replicas     int64
	VolumeSizeGB int64
}

CatalogCreateZooKeeperRequest creates a ZooKeeper service.

type CatalogRedisOptions

type CatalogRedisOptions struct {
	// The number of shards for Redis cluster, minimal 3.
	// Setting to 1 will disable cluster mode. 2 is invalid.
	Shards           int64
	ReplicasPerShard int64

	VolumeSizeGB int64

	// whether disable Redis "append only file", not recommended unless for cache only.
	DisableAOF bool
	// The AUTH password, recommended to set it for production environment. Empty string means disable it.
	AuthPass string
	// minimal 60s, not recommend to change unless necessary. see Redis Readme for details.
	ReplTimeoutSecs int64
	// how Redis will select what to remove when maxmemory is reached
	MaxMemPolicy string
	// rename the CONFIG command
	ConfigCmdName string
}

CatalogRedisOptions includes the config options for Redis.

type CatalogSetRedisInitRequest

type CatalogSetRedisInitRequest struct {
	Region      string
	Cluster     string
	ServiceName string
	// The Redis node ids, format: "MemberName RedisNodeID Role(master/slave)"
	NodeIds []string
}

CatalogSetRedisInitRequest sets the Redis catalog service initialized.

type CatalogSetServiceInitRequest

type CatalogSetServiceInitRequest struct {
	Region      string
	Cluster     string
	ServiceName string
	ServiceType string
}

CatalogSetServiceInitRequest sets the catalog service initialized. This is an internal request sent from the service's init task. It should not be called directly by the application.

type CreateServiceRequest

type CreateServiceRequest struct {
	Service  *ServiceCommonRequest
	Resource *common.Resources

	ContainerImage string
	Replicas       int64
	VolumeSizeGB   int64
	ContainerPath  string // The mount path inside container
	PortMappings   []common.PortMapping
	Envkvs         []*common.EnvKeyValuePair

	RegisterDNS    bool
	ReplicaConfigs []*ReplicaConfig
}

CreateServiceRequest contains the parameters for creating a service. Currently every replica should have its own ReplicaConfig. This aims to provide the flexibility for different services. CreateService simply returns success or not.

type DeleteTaskRequest

type DeleteTaskRequest struct {
	Service  *ServiceCommonRequest
	TaskType string
}

DeleteTaskRequest deletes the service task.

type GetConfigFileRequest

type GetConfigFileRequest struct {
	Region      string
	Cluster     string
	ServiceUUID string
	FileID      string
}

GetConfigFileRequest gets one config file.

type GetConfigFileResponse

type GetConfigFileResponse struct {
	ConfigFile *common.ConfigFile
}

GetConfigFileResponse rturns the config file.

type GetServiceAttributesResponse

type GetServiceAttributesResponse struct {
	Service *common.ServiceAttr
}

GetServiceAttributesResponse returns the service's attributes. GetServiceAttributesRequest just sends a "GET" with ServiceCommonRequest.

type GetServiceStatusResponse

type GetServiceStatusResponse struct {
	Status *common.ServiceStatus
}

GetServiceStatusResponse returns the service's status. GetServiceStatusRequest just sends a "GET" with ServiceCommonRequest.

type GetTaskStatusRequest

type GetTaskStatusRequest struct {
	Service *ServiceCommonRequest
	TaskID  string
}

GetTaskStatusRequest gets the task status for the task of one service.

type GetTaskStatusResponse

type GetTaskStatusResponse struct {
	Status *common.TaskStatus
}

GetTaskStatusResponse returns the task status.

type InternalGetServiceTaskRequest

type InternalGetServiceTaskRequest struct {
	Region              string
	Cluster             string
	ServiceName         string
	ContainerInstanceID string
}

InternalGetServiceTaskRequest gets the service task from the container framework.

type InternalGetServiceTaskResponse

type InternalGetServiceTaskResponse struct {
	ServiceTaskID string
}

InternalGetServiceTaskResponse returns the service task ID.

type InternalListActiveServiceTasksRequest

type InternalListActiveServiceTasksRequest struct {
	Region      string
	Cluster     string
	ServiceName string
}

InternalListActiveServiceTasksRequest gets the service active tasks from the container framework.

type InternalListActiveServiceTasksResponse

type InternalListActiveServiceTasksResponse struct {
	ServiceTaskIDs map[string]bool
}

InternalListActiveServiceTasksResponse returns the active task IDs of the service.

type ListServiceMemberRequest

type ListServiceMemberRequest struct {
	Service *ServiceCommonRequest
}

ListServiceMemberRequest lists the serviceMembers of one service

type ListServiceMemberResponse

type ListServiceMemberResponse struct {
	ServiceMembers []*common.ServiceMember
}

ListServiceMemberResponse returns the serviceMembers of one service

type ListServiceRequest

type ListServiceRequest struct {
	// region, az and cluster are for the management service to verify
	// the request is sent to the correct server
	Region  string
	Cluster string

	// The prefix of the service name
	Prefix string
}

ListServiceRequest lists the services according to the filter. TODO change "Prefix" to the common filter.

type ListServiceResponse

type ListServiceResponse struct {
	Services []*common.ServiceAttr
}

ListServiceResponse returns all listed services' attributes.

type ReplicaConfig

type ReplicaConfig struct {
	// The availability zone this replica should run.
	Zone string
	// The detail config files for this replica.
	Configs []*ReplicaConfigFile
}

ReplicaConfig contains the required config files for one replica.

type ReplicaConfigFile

type ReplicaConfigFile struct {
	FileName string
	FileMode uint32
	Content  string
}

ReplicaConfigFile contains the detail config file name and content.

type RunTaskRequest

type RunTaskRequest struct {
	Service        *ServiceCommonRequest
	Resource       *common.Resources
	ContainerImage string
	TaskType       string
	Envkvs         []*common.EnvKeyValuePair
}

RunTaskRequest contains the parameters to run a task.

type RunTaskResponse

type RunTaskResponse struct {
	TaskID string
}

RunTaskResponse returns the TaskID for the task.

type ServiceCommonRequest

type ServiceCommonRequest struct {
	Region      string
	Cluster     string
	ServiceName string
}

ServiceCommonRequest contains the common service parameters. region and cluster are for the management service to verify the request is sent to the correct server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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