2019-10-22 01:32:56 +02:00
|
|
|
package srpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
2019-10-22 15:36:14 +02:00
|
|
|
type argumentType uint8
|
|
|
|
|
2019-10-22 01:32:56 +02:00
|
|
|
const (
|
2019-10-22 15:36:14 +02:00
|
|
|
AIN argumentType = 0
|
|
|
|
AOUT argumentType = 1
|
|
|
|
AINOUT argumentType = 2
|
2019-10-22 01:32:56 +02:00
|
|
|
)
|
|
|
|
|
2019-10-22 15:36:14 +02:00
|
|
|
type responseStatus uint8
|
|
|
|
|
2019-10-22 01:32:56 +02:00
|
|
|
const (
|
2019-10-22 15:36:14 +02:00
|
|
|
OK responseStatus = 0
|
|
|
|
ERR responseStatus = 1
|
2019-10-22 01:32:56 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var RESPONSE_HEADER_SIZE = int32(9)
|
|
|
|
|
|
|
|
type responseHeader struct {
|
|
|
|
size int64
|
2019-10-22 15:36:14 +02:00
|
|
|
status responseStatus
|
2019-10-22 01:32:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type Server struct {
|
|
|
|
serviceMap sync.Map
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewServer() *Server {
|
|
|
|
return &Server{}
|
|
|
|
}
|
|
|
|
|
|
|
|
var DefaultServer = NewServer()
|