Documentation
¶
Index ¶
- Constants
- Variables
- func CallDeferFunctions()
- func CombinedSubscribeDemand(client *SXServiceClient, ndcb func(*SXServiceClient, *api.Demand), ...) (*sync.Mutex, *bool)
- func GenerateIntID() uint64
- func HandleSigInt()
- func InitNodeNum(n int)
- func MsgCountUp()
- func RegisterDeferFunction(f func())
- func RegisterDemandHandler(client *SXServiceClient, dh DemandHandler) (*sync.Mutex, *bool)
- func RegisterNode(nodesrv string, nm string, channels []uint32, serv *SxServerOpt) (string, error)
- func RegisterNodeWithCmd(nodesrv string, nm string, channels []uint32, serv *SxServerOpt, ...) (string, error)
- func SetNodeStatus(status int32, arg string)
- func SimpleSubscribeDemand(client *SXServiceClient, dmcb func(*SXServiceClient, *api.Demand)) (*sync.Mutex, *bool)
- func SimpleSubscribeSupply(client *SXServiceClient, spcb func(*SXServiceClient, *api.Supply)) (*sync.Mutex, *bool)
- func SubscribeDemand(client *SXServiceClient, dmcb func(*SXServiceClient, *api.Demand), ...)
- func SubscribeSupply(client *SXServiceClient, spcb func(*SXServiceClient, *api.Supply), ...)
- func UnRegisterNode()
- type DemandHandler
- type DemandOpts
- type IDType
- type NodeServInfo
- func (ni *NodeServInfo) GenerateIntID() uint64
- func (ni *NodeServInfo) GetNodeName(n int) string
- func (ni *NodeServInfo) MsgCountUp()
- func (ni *NodeServInfo) NewSXServiceClient(clt *SXSynerexClient, mtype uint32, argJson string) *SXServiceClient
- func (ni *NodeServInfo) RegisterNodeWithCmd(nodesrv string, nm string, channels []uint32, serv *SxServerOpt, ...) (string, error)
- func (ni *NodeServInfo) SetNodeStatus(status int32, arg string)
- func (ni *NodeServInfo) UnRegisterNode()
- type NodeState
- type SXServiceClient
- func (clt *SXServiceClient) CloseMbus(ctx context.Context, mbusId uint64) error
- func (clt *SXServiceClient) Confirm(id IDType, pid IDType) error
- func (clt *SXServiceClient) CreateMbus(ctx context.Context, opt *api.MbusOpt) (*api.Mbus, error)
- func (clt *SXServiceClient) GetMbusStatus(ctx context.Context, mb *api.Mbus) (*api.MbusState, error)
- func (clt *SXServiceClient) IsDemandTarget(dm *api.Demand, idlist []uint64) bool
- func (clt *SXServiceClient) IsSupplyTarget(sp *api.Supply, idlist []uint64) bool
- func (clt *SXServiceClient) MbusIndex(id uint64) int
- func (clt *SXServiceClient) NotifyDemand(dmo *DemandOpts) (uint64, error)
- func (clt *SXServiceClient) NotifySupply(smo *SupplyOpts) (uint64, error)
- func (clt *SXServiceClient) ProposeDemand(dmo *DemandOpts) uint64
- func (clt *SXServiceClient) ProposeSupply(spo *SupplyOpts) uint64
- func (clt *SXServiceClient) SelectDemand(dm *api.Demand) (uint64, error)
- func (clt *SXServiceClient) SelectSupply(sp *api.Supply) (uint64, error)
- func (clt *SXServiceClient) SendMbusMsg(ctx context.Context, mbusId uint64, msg *api.MbusMsg) (uint64, error)
- func (clt *SXServiceClient) SubscribeDemand(ctx context.Context, dmcb func(*SXServiceClient, *api.Demand)) error
- func (clt *SXServiceClient) SubscribeMbus(ctx context.Context, mbusId uint64, mbcb func(*SXServiceClient, *api.MbusMsg)) error
- func (clt *SXServiceClient) SubscribeSupply(ctx context.Context, spcb func(*SXServiceClient, *api.Supply)) error
- type SXSynerexClient
- type SupplyHandler
- type SupplyOpts
- type SxServerOpt
Constants ¶
const MSG_TIME_OUT = 20 // from v0.6.1 10sec -> 20sec
this is for Message Timeout for synerex server
const RECONNECT_WAIT = 5 // from v0.6.1
const WAIT_TIME = 30
Variables ¶
var ( Sha1Ver string // sha1 version used to build the program BuildTime string // when the executable was built GitVer string // git release tag )
for git versions
Functions ¶
func CallDeferFunctions ¶ added in v0.0.2
func CallDeferFunctions()
func CombinedSubscribeDemand ¶ added in v0.5.1
func CombinedSubscribeDemand(client *SXServiceClient, ndcb func(*SXServiceClient, *api.Demand), sscb func(*SXServiceClient, *api.Demand)) (*sync.Mutex, *bool)
Composit Subscriber for demand (ndcb = notify demand callback, sscb = selectsupply cb)
func HandleSigInt ¶ added in v0.0.2
func HandleSigInt()
func MsgCountUp ¶ added in v0.3.9
func MsgCountUp()
func RegisterDeferFunction ¶ added in v0.0.2
func RegisterDeferFunction(f func())
register closing functions.
func RegisterDemandHandler ¶ added in v0.5.1
func RegisterDemandHandler(client *SXServiceClient, dh DemandHandler) (*sync.Mutex, *bool)
Register DemandHandler
func RegisterNode ¶ added in v0.2.1
RegisterNode is a function to register Node with node server address
func RegisterNodeWithCmd ¶ added in v0.4.2
func RegisterNodeWithCmd(nodesrv string, nm string, channels []uint32, serv *SxServerOpt, cmd_func func(nodeapi.KeepAliveCommand, string)) (string, error)
RegisterNodeWithCmd is a function to register Node with node server address and KeepAlive Command Callback
func SetNodeStatus ¶
SetNodeStatus updates KeepAlive info to NodeServer
func SimpleSubscribeDemand ¶ added in v0.5.0
func SimpleSubscribeDemand(client *SXServiceClient, dmcb func(*SXServiceClient, *api.Demand)) (*sync.Mutex, *bool)
Simple Continuous (error free) subscriber for demand
func SimpleSubscribeSupply ¶ added in v0.5.0
func SimpleSubscribeSupply(client *SXServiceClient, spcb func(*SXServiceClient, *api.Supply)) (*sync.Mutex, *bool)
Simple Continuous (error free) subscriber for supply
func SubscribeDemand ¶ added in v0.5.0
func SubscribeDemand(client *SXServiceClient, dmcb func(*SXServiceClient, *api.Demand), mu *sync.Mutex, loopFlag *bool)
Continuous (error free) subscriber for demand
func SubscribeSupply ¶ added in v0.5.0
func SubscribeSupply(client *SXServiceClient, spcb func(*SXServiceClient, *api.Supply), mu *sync.Mutex, loopFlag *bool)
Continuous (error free) subscriber for supply
Types ¶
type DemandHandler ¶ added in v0.5.1
type DemandHandler interface { OnNotifyDemand(*SXServiceClient, *api.Demand) *SupplyOpts // if propose return proposedID OnSelectSupply(*SXServiceClient, *api.Demand) bool // if confirm return true OnConfirmResponse(*SXServiceClient, IDType, error) // result of confirm }
type DemandOpts ¶
DemandOpts is sender options for Demand
type NodeServInfo ¶ added in v0.4.7
type NodeServInfo struct {
// contains filtered or unexported fields
}
NodeservInfo is a connection info for each Node Server
func GetDefaultNodeServInfo ¶ added in v0.4.7
func GetDefaultNodeServInfo() *NodeServInfo
GetDefaultNodeServInfo returns Default NodeServ Info for sxutil
func NewNodeServInfo ¶ added in v0.4.7
func NewNodeServInfo() *NodeServInfo
NewNodeServInfo returns new NodeServ Info for sxutil
func (*NodeServInfo) GenerateIntID ¶ added in v0.4.7
func (ni *NodeServInfo) GenerateIntID() uint64
GenerateIntID for generate uniquie ID
func (*NodeServInfo) GetNodeName ¶ added in v0.4.7
func (ni *NodeServInfo) GetNodeName(n int) string
GetNodeName returns node name from node_id
func (*NodeServInfo) MsgCountUp ¶ added in v0.4.7
func (ni *NodeServInfo) MsgCountUp()
func (*NodeServInfo) NewSXServiceClient ¶ added in v0.4.7
func (ni *NodeServInfo) NewSXServiceClient(clt *SXSynerexClient, mtype uint32, argJson string) *SXServiceClient
NewSXServiceClient Creates wrapper structre SXServiceClient from SynerexClient
func (*NodeServInfo) RegisterNodeWithCmd ¶ added in v0.4.7
func (ni *NodeServInfo) RegisterNodeWithCmd(nodesrv string, nm string, channels []uint32, serv *SxServerOpt, cmd_func func(nodeapi.KeepAliveCommand, string)) (string, error)
RegisterNodeWithCmd is a function to register Node with node server address and KeepAlive Command Callback
func (*NodeServInfo) SetNodeStatus ¶ added in v0.4.7
func (ni *NodeServInfo) SetNodeStatus(status int32, arg string)
SetNodeStatus updates KeepAlive info to NodeServer
func (*NodeServInfo) UnRegisterNode ¶ added in v0.4.7
func (ni *NodeServInfo) UnRegisterNode()
UnRegisterNode de-registrate node id
type NodeState ¶ added in v0.3.12
func NewNodeState ¶ added in v0.3.12
func NewNodeState() *NodeState
type SXServiceClient ¶ added in v0.3.3
type SXServiceClient struct { ClientID IDType ChannelType uint32 SXClient *SXSynerexClient ArgJson string MbusIDs []IDType NI *NodeServInfo // contains filtered or unexported fields }
SXServiceClient Wrappter Structure for synerex client
func NewSXServiceClient ¶ added in v0.3.3
func NewSXServiceClient(clt *SXSynerexClient, mtype uint32, argJson string) *SXServiceClient
NewSXServiceClient Creates wrapper structre SXServiceClient from SynerexClient
func (*SXServiceClient) CloseMbus ¶ added in v0.3.3
func (clt *SXServiceClient) CloseMbus(ctx context.Context, mbusId uint64) error
func (*SXServiceClient) Confirm ¶ added in v0.3.3
func (clt *SXServiceClient) Confirm(id IDType, pid IDType) error
Confirm sends confirm message to sender
func (*SXServiceClient) CreateMbus ¶ added in v0.4.12
from synerex_api v0.4.0
func (*SXServiceClient) GetMbusStatus ¶ added in v0.4.12
func (clt *SXServiceClient) GetMbusStatus(ctx context.Context, mb *api.Mbus) (*api.MbusState, error)
from synerex_api v0.4.0
func (*SXServiceClient) IsDemandTarget ¶ added in v0.3.3
func (clt *SXServiceClient) IsDemandTarget(dm *api.Demand, idlist []uint64) bool
IsDemandTarget is a helper function to check target
func (*SXServiceClient) IsSupplyTarget ¶ added in v0.3.3
func (clt *SXServiceClient) IsSupplyTarget(sp *api.Supply, idlist []uint64) bool
IsSupplyTarget is a helper function to check target
func (*SXServiceClient) MbusIndex ¶ added in v0.6.2
func (clt *SXServiceClient) MbusIndex(id uint64) int
func (*SXServiceClient) NotifyDemand ¶ added in v0.3.3
func (clt *SXServiceClient) NotifyDemand(dmo *DemandOpts) (uint64, error)
NotifyDemand sends Typed Demand to Server
func (*SXServiceClient) NotifySupply ¶ added in v0.3.3
func (clt *SXServiceClient) NotifySupply(smo *SupplyOpts) (uint64, error)
NotifySupply sends Typed Supply to Server
func (*SXServiceClient) ProposeDemand ¶ added in v0.5.1
func (clt *SXServiceClient) ProposeDemand(dmo *DemandOpts) uint64
ProposeDemand send proposal Demand message to server
func (*SXServiceClient) ProposeSupply ¶ added in v0.3.3
func (clt *SXServiceClient) ProposeSupply(spo *SupplyOpts) uint64
ProposeSupply send proposal Supply message to server
func (*SXServiceClient) SelectDemand ¶ added in v0.3.3
func (clt *SXServiceClient) SelectDemand(dm *api.Demand) (uint64, error)
SelectDemand send select message to server
func (*SXServiceClient) SelectSupply ¶ added in v0.3.3
func (clt *SXServiceClient) SelectSupply(sp *api.Supply) (uint64, error)
SelectSupply send select message to server
func (*SXServiceClient) SendMbusMsg ¶ added in v0.4.12
func (clt *SXServiceClient) SendMbusMsg(ctx context.Context, mbusId uint64, msg *api.MbusMsg) (uint64, error)
v0.4.1 name change
func (*SXServiceClient) SubscribeDemand ¶ added in v0.3.3
func (clt *SXServiceClient) SubscribeDemand(ctx context.Context, dmcb func(*SXServiceClient, *api.Demand)) error
SubscribeDemand Wrapper function for SXServiceClient
func (*SXServiceClient) SubscribeMbus ¶ added in v0.3.3
func (clt *SXServiceClient) SubscribeMbus(ctx context.Context, mbusId uint64, mbcb func(*SXServiceClient, *api.MbusMsg)) error
SubscribeMbus Wrapper function for SXServiceClient
func (*SXServiceClient) SubscribeSupply ¶ added in v0.3.3
func (clt *SXServiceClient) SubscribeSupply(ctx context.Context, spcb func(*SXServiceClient, *api.Supply)) error
SubscribeSupply Wrapper function for SXServiceClient
type SXSynerexClient ¶ added in v0.5.0
type SXSynerexClient struct { ServerAddress string Client api.SynerexClient GrpcConn *grpc.ClientConn }
SXSynerexClient is for each server from v0.5.0
func GrpcConnectServer ¶ added in v0.3.4
func GrpcConnectServer(serverAddress string) *SXSynerexClient
GrpcConnectServer is a utility function for conneting gRPC server
type SupplyHandler ¶ added in v0.5.1
type SupplyHandler interface { }
type SupplyOpts ¶
SupplyOpts is sender options for Supply