sxutil

package module
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 16 Imported by: 16

README

synerex_sxutil

Documentation

Index

Constants

View Source
const WAIT_TIME = 30

Variables

View Source
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 GenerateIntID

func GenerateIntID() uint64

GenerateIntID for generate uniquie ID

func GrpcConnectServer added in v0.3.4

func GrpcConnectServer(serverAddress string) api.SynerexClient

GrpcConnectServer is a 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 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

func SetNodeStatus(status int32, arg string)

SetNodeStatus updates KeepAlive info to NodeServer

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 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 api.SynerexClient, 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

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
	NI          *NodeServInfo
}

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) CreateMbus added in v0.4.12

func (clt *SXServiceClient) CreateMbus(ctx context.Context, opt *api.MbusOpt) (*api.Mbus, error)

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) 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) SendMbusMsg added in v0.4.12

func (clt *SXServiceClient) SendMbusMsg(ctx context.Context, msg *api.MbusMsg) 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, 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