Documentation ¶
Index ¶
Constants ¶
View Source
const ( MSG_FLAG_CONNECTED byte = 0 MSG_FLAG_CONNECTED_ACK byte = 1 MSG_FLAG_ORDER byte = 2 MSG_FLAG_ORDER_ACK byte = 3 MSG_FLAG_ORDER_CANCEL byte = 4 MSG_FLAG_ORDER_RESULT byte = 5 MSG_FLAG_STATUS_SUBMIT byte = 6 MSG_FLAG_STATUS_BOARDCASE byte = 7 MSG_FLAG_STATUS_PING byte = 8 MSG_FLAG_STATUS_INHERIT byte = 9 )
Variables ¶
View Source
var ( DefaultTokenHashSalt = "ca205de6a03db4bf5376facdb172cb79" DefaultTokenHash = tokenHash )
View Source
var ( ErrOffline = errors.New("offline") ErrInvalidResponse = errors.New("invalid response") ErrOrderAckTimeout = errors.New("order ack timeout") ErrOrderTimeout = errors.New("order timeout") ErrMenuNotServing = errors.New("menu not serving") )
View Source
var ( DefaultListenAddr = "0.0.0.0" DefaultPubPort = 19527 DefaultRepPort = 29527 DefaultOrderHandleConcurrentLimit = 500 DefaultReqSocketMax = int32(100) DefaultOrderTimeout = time.Second * 10 DefaultOrderAckTimeout = time.Second * 3 DefaultStatusBroadcastInterval = time.Second * 1 LogErr = func(str string, err error, arg ...interface{}) { fmt.Println(str, err, arg) } LogInfo = func(args ...interface{}) { fmt.Println(args...) } LogDebug = func(args ...interface{}) { } )
View Source
var (
ErrRunInLocal = errors.New("run in local")
)
View Source
var (
NewLoadBalancer = newLoadBalancer
)
Functions ¶
This section is empty.
Types ¶
type Deliverable ¶
type ILoadBalancer ¶
type ILogistic ¶
type ILogistic interface { Init() error SetOrderHandlerPerMenu([]func(context.Context, *Order)) SwitchLeader(url string, port uint16) // Shutdown is for shutting down the logistic server keep every call in local Shutdown() IsLeader() bool // Order is for sending orders to cluster Order(menuId, dishId uint16, skipNodeIds ...uint32) (func(ctx context.Context, input []byte) ([]byte, error), error) }
ILogistic is an interface of managing scaling of kitchen.
Click to show internal directories.
Click to hide internal directories.