sxutil

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2019 License: Apache-2.0 Imports: 15 Imported by: 16

README

synerex_sxutil

Documentation

Index

Constants

This section is empty.

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 HandleSigInt added in v0.0.2

func HandleSigInt()

func InitNodeNum

func InitNodeNum(n int)

InitNodeNum for initialize NodeNum again

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 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 SMServiceClient

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

SMServiceClient Wrappter Structure for market client

func NewSMServiceClient

func NewSMServiceClient(clt api.SynerexClient, mtype uint32, argJson string) *SMServiceClient

NewSMServiceClient Creates wrapper structre SMServiceClient from SynerexClient

func (*SMServiceClient) CloseMbus

func (clt *SMServiceClient) CloseMbus(ctx context.Context) error

func (*SMServiceClient) Confirm

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

Confirm sends confirm message to sender

func (*SMServiceClient) IsDemandTarget

func (clt *SMServiceClient) IsDemandTarget(dm *api.Demand, idlist []uint64) bool

IsDemandTarget is a helper function to check target

func (*SMServiceClient) IsSupplyTarget

func (clt *SMServiceClient) IsSupplyTarget(sp *api.Supply, idlist []uint64) bool

IsSupplyTarget is a helper function to check target

func (*SMServiceClient) NotifyDemand

func (clt *SMServiceClient) NotifyDemand(dmo *DemandOpts) uint64

NotifyDemand sends Typed Demand to Server

func (*SMServiceClient) NotifySupply

func (clt *SMServiceClient) NotifySupply(smo *SupplyOpts) uint64

NotifySupply sends Typed Supply to Server

func (*SMServiceClient) ProposeSupply

func (clt *SMServiceClient) ProposeSupply(spo *SupplyOpts) uint64

ProposeSupply send proposal Supply message to server

func (*SMServiceClient) SelectDemand

func (clt *SMServiceClient) SelectDemand(dm *api.Demand) error

SelectDemand send select message to server

func (*SMServiceClient) SelectSupply

func (clt *SMServiceClient) SelectSupply(sp *api.Supply) (uint64, error)

SelectSupply send select message to server

func (*SMServiceClient) SendMsg

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

func (*SMServiceClient) SubscribeDemand

func (clt *SMServiceClient) SubscribeDemand(ctx context.Context, dmcb func(*SMServiceClient, *api.Demand)) error

SubscribeDemand Wrapper function for SMServiceClient

func (*SMServiceClient) SubscribeMbus

func (clt *SMServiceClient) SubscribeMbus(ctx context.Context, mbcb func(*SMServiceClient, *api.MbusMsg)) error

SubscribeMbus Wrapper function for SMServiceClient

func (*SMServiceClient) SubscribeSupply

func (clt *SMServiceClient) SubscribeSupply(ctx context.Context, spcb func(*SMServiceClient, *api.Supply)) error

SubscribeSupply Wrapper function for SMServiceClient

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 {
	ServerAddress string
	ClusterId     int32
	AreaId        string
}

Jump to

Keyboard shortcuts

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