cmds

package
v0.0.0-...-c7aefa9 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRegistered is the code has been registered
	ErrRegistered = errors.New("this code has beed registered")
)

Functions

func CreateCred

func CreateCred(certFile, keyFile string) (grpc.ServerOption, error)

CreateCred is helper to create creadential for grpc server

Types

type Action

type Action = func(s string) error

Action do something

type CMDServer

type CMDServer interface {
	//Send(code Code, param string) error
	server.CommandServiceServer
	Register(code Code, action Action, force bool) error
	Run(addr string, opts ...grpc.ServerOption)
}

CMDServer interface

func InitCMDS

func InitCMDS(set Set) CMDServer

InitCMDS initial a commander service

type Code

type Code = int32

Code for an action

type Set

type Set = map[Code]Action

Set is the set list for code and action

Jump to

Keyboard shortcuts

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