sxutil

package module
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2020 License: Apache-2.0 Imports: 17 Imported by: 16

README

synerex_sxutil

Documentation

Index

Constants

View Source
const WAIT_TIME = 30

Variables

This section is empty.

Functions

func CallDeferFunctions added in v0.0.2

func CallDeferFunctions()

func GenerateIntID

func GenerateIntID() uint64

GenerateIntID for generate uniquie ID

func GetNodeName

func GetNodeName(n int) string

func GrpcConnectServer added in v0.3.4

func GrpcConnectServer(serverAddress string) api.SynerexClient

Utility Function for Conneting gRPC server

func HandleSigInt added in v0.0.2

func HandleSigInt()

func InitNodeNum

func InitNodeNum(n int)

InitNodeNum for initialize NodeNum again

func MsgCountUp added in v0.3.9

func MsgCountUp()

func RegisterDeferFunction added in v0.0.2

func RegisterDeferFunction(f func())

register closing functions.

func RegisterNode added in v0.2.1

func RegisterNode(nodesrv string, nm string, channels []uint32, serv *SxServerOpt) (string, error)

RegisterNode is a function to register Node with node server address

func RegisterNodeAndProc added in v0.3.12

func RegisterNodeAndProc(nodesrv string, nm string, channels []uint32, serv *SxServerOpt, fn func()) (string, error)

func SetNodeStatus

func SetNodeStatus(status int32, arg string)

func UnRegisterNode

func UnRegisterNode()

UnRegisterNode de-registrate node id

Types

type DemandOpts

type DemandOpts struct {
	ID     uint64
	Target uint64
	Name   string
	JSON   string
	Cdata  *api.Content
}

DemandOpts is sender options for Demand

type IDType

type IDType uint64

IDType for all ID in Synerex

type NodeState added in v0.3.12

type NodeState struct {
	ProposedSupply []api.Supply
	ProposedDemand []api.Demand
	Locked         bool
}

func NewNodeState added in v0.3.12

func NewNodeState() *NodeState

type SXServiceClient added in v0.3.3

type SXServiceClient struct {
	ClientID    IDType
	ChannelType uint32
	Client      api.SynerexClient
	ArgJson     string
	MbusID      IDType
}

SXServiceClient Wrappter Structure for market client

func NewSXServiceClient added in v0.3.3

func NewSXServiceClient(clt api.SynerexClient, 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) error

func (*SXServiceClient) Confirm added in v0.3.3

func (clt *SXServiceClient) Confirm(id IDType) error

Confirm sends confirm message to sender

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) 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) 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) 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) SendMsg added in v0.3.3

func (clt *SXServiceClient) SendMsg(ctx context.Context, msg *api.MbusMsg) error

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, 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 SupplyOpts

type SupplyOpts struct {
	ID     uint64
	Target uint64
	Name   string
	JSON   string
	Cdata  *api.Content
}

SupplyOpts is sender options for Supply

type SxServerOpt added in v0.2.1

type SxServerOpt struct {
	NodeType   nodeapi.NodeType
	ServerInfo string
	ClusterId  int32
	AreaId     string
	GwInfo     string
}

Jump to

Keyboard shortcuts

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