goarpcsolution

package module
v0.0.0-...-08eb113 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ARPC_MSG_PREFIX_ARPC = "arpc"
View Source
const ARPC_MSG_PREFIX_ARPC_PLUS_COLUMN = ARPC_MSG_PREFIX_ARPC + ":"
View Source
const ARPC_MSG_PREFIX_ARPC_PLUS_COLUMN_LEN = len(ARPC_MSG_PREFIX_ARPC_PLUS_COLUMN)
View Source
const ARPC_MSG_PREFIX_SIMPLE = "simple"
View Source
const ARPC_MSG_PREFIX_SIMPLE_PLUST_COLUMN = ARPC_MSG_PREFIX_SIMPLE + ":"
View Source
const ARPC_MSG_PREFIX_SIMPLE_PLUST_COLUMN_LEN = len(ARPC_MSG_PREFIX_SIMPLE_PLUST_COLUMN)
View Source
const TTL_CONST_10MIN = time.Duration(time.Minute * 10)

todo: find better place for this. but, frankly, it's the best value. which, probably doesn't need to be variable

Variables

This section is empty.

Functions

func NewARPCBufferItemSpecifierFromString

func NewARPCBufferItemSpecifierFromString(
	value string,
) (*ARPCBufferItemSpecifier, ARPCBufferItemSpecifierType)

Types

type ARPCArgInfo

type ARPCArgInfo struct {
	Type  ARPCArgType
	Value any
}

func (*ARPCArgInfo) IsValid

func (self *ARPCArgInfo) IsValid() bool

func (*ARPCArgInfo) IsValidError

func (self *ARPCArgInfo) IsValidError() error

type ARPCArgType

type ARPCArgType uint8
const (
	ARPCArgTypeInvalid ARPCArgType = iota
	ARPCArgTypeBasicBool
	ARPCArgTypeBasicNumber
	ARPCArgTypeBasicString
	ARPCArgTypeBasicArray
	ARPCArgTypeBasicObject
	ARPCArgTypeBuffer
	ARPCArgTypeTransmission
	ARPCArgTypeListeningSocket
	ConnectedSocket
)

type ARPCBufferI

type ARPCBufferI interface {
	GetInfo() *ARPCBufferInfo
	ItemCount() int
	// if not found - it's not error and 2nd result is false
	GetItem(id string) (*ARPCBufferItem, bool, error)
}

type ARPCBufferInfo

type ARPCBufferInfo struct {
	Id               *gouuidtools.UUID
	HumanTitle       string
	HumanDescription string

	// todo: todo. this part is in fog for now
	Mode            ARPCBufferMode
	Finished        bool
	TechDescription any
}

type ARPCBufferItem

type ARPCBufferItem struct {
	BufferId *gouuidtools.UUID
	ItemId   string
	ItemTime time.Time

	Value any
}

type ARPCBufferItemSpecifier

type ARPCBufferItemSpecifier struct {
	Value string
}

func (*ARPCBufferItemSpecifier) Index

func (self *ARPCBufferItemSpecifier) Index() (int, bool)

func (*ARPCBufferItemSpecifier) SetIndex

func (self *ARPCBufferItemSpecifier) SetIndex(v int)

func (*ARPCBufferItemSpecifier) SetStringVal

func (self *ARPCBufferItemSpecifier) SetStringVal(s string)

func (*ARPCBufferItemSpecifier) SetTime

func (self *ARPCBufferItemSpecifier) SetTime(t time.Time)

func (*ARPCBufferItemSpecifier) StringVal

func (self *ARPCBufferItemSpecifier) StringVal() (string, bool)

func (*ARPCBufferItemSpecifier) Time

func (self *ARPCBufferItemSpecifier) Time() (time.Time, bool)

func (*ARPCBufferItemSpecifier) Type

type ARPCBufferItemSpecifierType

type ARPCBufferItemSpecifierType uint8
const (
	ARPCBufferItemSpecifierTypeInvalid ARPCBufferItemSpecifierType = iota
	// ARPCBufferItemSpecifierTypeUUID
	ARPCBufferItemSpecifierTypeIndex
	ARPCBufferItemSpecifierTypeTime
	ARPCBufferItemSpecifierTypeString
)

type ARPCBufferMode

type ARPCBufferMode uint8
const (
	ARPCBufferModeInvalid ARPCBufferMode = iota

	// if buffer items are byte slices and passed throug calls
	// as byte arrays
	ARPCBufferModeBinary

	// if buffer items are objects and passed through calls
	// as JS objects
	ARPCBufferModeObject
)

type ARPCCall

type ARPCCall struct {
	Name      string
	ReplyToId *gouuidtools.UUID

	Args   []*ARPCCallArg
	CallId *gouuidtools.UUID

	ReplyErrCode uint
	ReplyErrMsg  string
}

func NewARPCCall

func NewARPCCall(
	Name string,
	Args ...*ARPCCallArg,
) (*ARPCCall, error)

func NewARPCCallReply

func NewARPCCallReply(
	ReplyToId *gouuidtools.UUID,
	Args ...*ARPCCallArg,
) (*ARPCCall, error)

code and msg defaults to 0 and ""

func NewARPCCallReplyWithCodeAndMsg

func NewARPCCallReplyWithCodeAndMsg(
	ReplyToId *gouuidtools.UUID,

	ReplyErrCode uint,
	ReplyErrMsg string,

	Args ...*ARPCCallArg,
) (*ARPCCall, error)

func NewARPCCallWithId

func NewARPCCallWithId(
	Name string,
	CallId *gouuidtools.UUID,
	Args ...*ARPCCallArg,
) (*ARPCCall, error)

func (*ARPCCall) GenARPCCallForJSON

func (self *ARPCCall) GenARPCCallForJSON() *ARPCCallForJSON

func (*ARPCCall) HasErrorFields

func (self *ARPCCall) HasErrorFields() bool

Error != nil

func (*ARPCCall) HasReplyToIdField

func (self *ARPCCall) HasReplyToIdField() bool

ReplyToId != nil

func (*ARPCCall) HasRequestFields

func (self *ARPCCall) HasRequestFields() bool

HasReplyToIdField()

func (*ARPCCall) HasResponseFields

func (self *ARPCCall) HasResponseFields() bool

self.HasResultField() || self.HasErrorField()

func (*ARPCCall) IsError

func (self *ARPCCall) IsError() bool

is response and is error

func (*ARPCCall) IsInvalid

func (self *ARPCCall) IsInvalid() bool

func (*ARPCCall) IsResponseAndNotError

func (self *ARPCCall) IsResponseAndNotError() bool

func (*ARPCCall) IsResponseOrError

func (self *ARPCCall) IsResponseOrError() bool

func (*ARPCCall) IsValidError

func (self *ARPCCall) IsValidError() error

type ARPCCallArg

type ARPCCallArg struct {
	// leave Name empty string if it's a positional arg
	Name string

	Basic           *ARPCCallArgValueTypeBasic
	Buffer          *ARPCCallArgValueTypeBuffer
	Transmission    *ARPCCallArgValueTypeTransmission
	ListeningSocket *ARPCCallArgValueTypeListeningSocket
	ConnectedSocket *ARPCCallArgValueTypeConnectedSocket
}

func (*ARPCCallArg) IsValid

func (self *ARPCCallArg) IsValid() bool

func (*ARPCCallArg) IsValidError

func (self *ARPCCallArg) IsValidError() error

func (*ARPCCallArg) NullifyIds

func (self *ARPCCallArg) NullifyIds()

type ARPCCallArgSlice

type ARPCCallArgSlice struct {
	Args []*ARPCCallArg
}

func (*ARPCCallArgSlice) NullifyIds

func (self *ARPCCallArgSlice) NullifyIds()

type ARPCCallArgValueTypeBasic

type ARPCCallArgValueTypeBasic struct {
	OwningArg *ARPCCallArg

	Value any
}

type ARPCCallArgValueTypeBuffer

type ARPCCallArgValueTypeBuffer struct {
	OwningArg *ARPCCallArg

	Id      *gouuidtools.UUID
	Payload ARPCBufferI
}

type ARPCCallArgValueTypeConnectedSocket

type ARPCCallArgValueTypeConnectedSocket struct {
	OwningArg *ARPCCallArg

	Id      *gouuidtools.UUID
	Payload ARPCConnectedSocketI
}

type ARPCCallArgValueTypeListeningSocket

type ARPCCallArgValueTypeListeningSocket struct {
	OwningArg *ARPCCallArg

	Id      *gouuidtools.UUID
	Payload ARPCListeningSocketI
}

type ARPCCallArgValueTypeTransmission

type ARPCCallArgValueTypeTransmission struct {
	OwningArg *ARPCCallArg

	Id      *gouuidtools.UUID
	Payload ARPCTransmissionI
}

type ARPCCallForJSON

type ARPCCallForJSON struct {
	CallId       *gouuidtools.UUID
	ReplyToId    *gouuidtools.UUID `json:,omitempty`
	Name         string            `json:,omitempty`
	ReplyErrCode uint              `json:,omitempty`
	ReplyErrMsg  string            `json:,omitempty`
}

type ARPCCallShortItem

type ARPCCallShortItem struct {
	CallId  *gouuidtools.UUID
	ReplyTo *gouuidtools.UUID
}

type ARPCConnectedSocketI

type ARPCConnectedSocketI interface{}

type ARPCListeningSocketI

type ARPCListeningSocketI interface{}

type ARPCNode

type ARPCNode struct {
	PushMessageToOutsideCB func(data []byte) error
	// contains filtered or unexported fields
}

some functions inherited from ARPCSolutionCtlI. respective function documentation - placed into interface

func NewARPCNode

func NewARPCNode(
	controller ARPCNodeCtlI,
) *ARPCNode

func (*ARPCNode) BufferBinaryGetSize

func (self *ARPCNode) BufferBinaryGetSize(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	size int,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferBinaryGetSlice

func (self *ARPCNode) BufferBinaryGetSlice(
	buffer_id *gouuidtools.UUID,
	start_index, end_index int,
	response_timeout time.Duration,
) (
	data []byte,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetInfo

func (self *ARPCNode) BufferGetInfo(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	info *ARPCBufferInfo,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetIsSubscribedOnUpdatesNotification

func (self *ARPCNode) BufferGetIsSubscribedOnUpdatesNotification(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	result bool,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetItemsByIds

func (self *ARPCNode) BufferGetItemsByIds(
	buffer_id *gouuidtools.UUID,
	ids []string,
	response_timeout time.Duration,
) (
	buffer_items []*ARPCBufferItem,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetItemsCount

func (self *ARPCNode) BufferGetItemsCount(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	count int,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetItemsFirstTime

func (self *ARPCNode) BufferGetItemsFirstTime(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	time_ time.Time,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetItemsIds

func (self *ARPCNode) BufferGetItemsIds(
	buffer_id *gouuidtools.UUID,
	first_spec, last_spec *ARPCBufferItemSpecifier,

	response_timeout time.Duration,
) (
	ids []string,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetItemsLastTime

func (self *ARPCNode) BufferGetItemsLastTime(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	time_ time.Time,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferGetListSubscribedUpdatesNotifications

func (self *ARPCNode) BufferGetListSubscribedUpdatesNotifications(
	response_timeout time.Duration,
) (
	buffer_id *gouuidtools.UUID,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferSubscribeOnUpdatesNotification

func (self *ARPCNode) BufferSubscribeOnUpdatesNotification(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferUnsubscribeFromUpdatesNotification

func (self *ARPCNode) BufferUnsubscribeFromUpdatesNotification(
	buffer_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) BufferUpdated

func (self *ARPCNode) BufferUpdated(
	buffer_id *gouuidtools.UUID,
) error

func (*ARPCNode) CallClose

func (self *ARPCNode) CallClose(
	call_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) CallGetArgCount

func (self *ARPCNode) CallGetArgCount(
	call_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	res int,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) CallGetArgValues

func (self *ARPCNode) CallGetArgValues(
	call_id *gouuidtools.UUID,
	first, last int,
	response_timeout time.Duration,
) (
	res []*ARPCArgInfo,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) CallGetInfo

func (self *ARPCNode) CallGetInfo(
	call_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	result *ARPCCallForJSON,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) CallGetList

func (self *ARPCNode) CallGetList(
	response_timeout time.Duration,
) (
	buffer_id *gouuidtools.UUID,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) Close

func (self *ARPCNode) Close()

if controller is set - calls it's Close(); if jrpc2 node is set - calls it's Close(); sets this node into invalid state. node can't be reused after Close() and should be replaced.

func (*ARPCNode) DebugPrintfln

func (self *ARPCNode) DebugPrintfln(format string, data ...any)

func (*ARPCNode) DebugPrintln

func (self *ARPCNode) DebugPrintln(data ...any)

func (*ARPCNode) GetController

func (self *ARPCNode) GetController() ARPCNodeCtlI

func (*ARPCNode) GetDebugName

func (self *ARPCNode) GetDebugName() string

func (*ARPCNode) NewCall

func (self *ARPCNode) NewCall(
	call_id *gouuidtools.UUID,
	response_on *gouuidtools.UUID,
) error

func (*ARPCNode) NewTransmission

func (self *ARPCNode) NewTransmission(
	tarnsmission_id *gouuidtools.UUID,
) error

func (*ARPCNode) PushMessageFromOutside

func (self *ARPCNode) PushMessageFromOutside(data []byte) (error, error)

#0 protocol violation - not critical for server running, #1 error - should be treated as server errors

func (*ARPCNode) SendError

func (self *ARPCNode) SendError(msg *gojsonrpc2.Message) error

func (*ARPCNode) SendMessage

func (self *ARPCNode) SendMessage(msg *gojsonrpc2.Message) error

note: this function always adds "s:" prefix to msg.Method note: just like in gojsonrpc2 this function doesn't check msg on

validity

func (*ARPCNode) SendNotification

func (self *ARPCNode) SendNotification(msg *gojsonrpc2.Message) error

note: this function always adds "s:" prefix to msg.Method note: error if msg invalid

func (*ARPCNode) SendRequest

func (self *ARPCNode) SendRequest(
	msg *gojsonrpc2.Message,
	genid bool,
	unhandled bool,
	rh *gojsonrpc2.JSONRPC2NodeRespHandler,
	response_timeout time.Duration,
	request_id_hook *gojsonrpc2.JSONRPC2NodeNewRequestIdHook,
) (ret_any any, ret_err error)

note: this function always adds "s:" prefix to msg.Method note: error if msg invalid

func (*ARPCNode) SendResponse

func (self *ARPCNode) SendResponse(msg *gojsonrpc2.Message) error

func (*ARPCNode) SetDebug

func (self *ARPCNode) SetDebug(val bool)

func (*ARPCNode) SetDebugName

func (self *ARPCNode) SetDebugName(name string)

func (*ARPCNode) SocketClose

func (self *ARPCNode) SocketClose(
	connected_socket_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) SocketGetList

func (self *ARPCNode) SocketGetList(
	response_timeout time.Duration,
) (
	buffer_id *gouuidtools.UUID,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) SocketOpen

func (self *ARPCNode) SocketOpen(
	listening_socket_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	connected_socket_id *gouuidtools.UUID,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) SocketRead

func (self *ARPCNode) SocketRead(
	connected_socket_id *gouuidtools.UUID,
	try_read_size int,
	response_timeout time.Duration,
) (
	b []byte,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) SocketSetDeadline

func (self *ARPCNode) SocketSetDeadline(
	connected_socket_id *gouuidtools.UUID,
	t time.Time,
	response_timeout time.Duration,
) (
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) SocketSetReadDeadline

func (self *ARPCNode) SocketSetReadDeadline(
	connected_socket_id *gouuidtools.UUID,
	t time.Time,
	response_timeout time.Duration,
) (
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) SocketSetWriteDeadline

func (self *ARPCNode) SocketSetWriteDeadline(
	connected_socket_id *gouuidtools.UUID,
	t time.Time,
	response_timeout time.Duration,
) (
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) SocketWrite

func (self *ARPCNode) SocketWrite(
	connected_socket_id *gouuidtools.UUID,
	b []byte,
	response_timeout time.Duration,
) (
	n int,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) TransmissionGetInfo

func (self *ARPCNode) TransmissionGetInfo(
	transmission_id *gouuidtools.UUID,
	response_timeout time.Duration,
) (
	info *ARPCTransmissionInfo,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

func (*ARPCNode) TransmissionGetList

func (self *ARPCNode) TransmissionGetList(
	response_timeout time.Duration,
) (
	buffer_id *gouuidtools.UUID,
	timedout bool,
	closed bool,
	result_err error,
	err error,
)

type ARPCNodeCtlBasic

type ARPCNodeCtlBasic struct {
	// the resulting errors are returned to PushMessageFromOutsied caller.
	//   error #0 - if protocol error
	//   error #1 - error preventing normal error response
	OnCallCB            func(call *ARPCCall) (error, error)
	OnUnhandledResultCB func(result *ARPCCall)

	// the resulting errors are returned to PushMessageFromOutsied caller.
	//   error #0 - if protocol error
	//   error #1 - error preventing normal error response
	OnSimpleRequestCB func(msg *gojsonrpc2.Message) (error, error)
	// contains filtered or unexported fields
}

func NewARPCNodeCtlBasic

func NewARPCNodeCtlBasic() *ARPCNodeCtlBasic

func (*ARPCNodeCtlBasic) BufferBinaryGetSize

func (self *ARPCNodeCtlBasic) BufferBinaryGetSize(
	buffer_id *gouuidtools.UUID,
) (
	size int,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferBinaryGetSlice

func (self *ARPCNodeCtlBasic) BufferBinaryGetSlice(
	buffer_id *gouuidtools.UUID,
	start_index, end_index int,
) (
	data []byte,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetInfo

func (self *ARPCNodeCtlBasic) BufferGetInfo(
	buffer_id *gouuidtools.UUID,
) (
	info *ARPCCallForJSON,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetIsSubscribedOnUpdatesNotification

func (self *ARPCNodeCtlBasic) BufferGetIsSubscribedOnUpdatesNotification(
	buffer_id *gouuidtools.UUID,
) (
	r bool,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetItemsByIds

func (self *ARPCNodeCtlBasic) BufferGetItemsByIds(
	buffer_id *gouuidtools.UUID,
	ids []string,
) (
	buffer_items []*ARPCBufferItem,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetItemsCount

func (self *ARPCNodeCtlBasic) BufferGetItemsCount(
	buffer_id *gouuidtools.UUID,
) (
	count int,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetItemsFirstTime

func (self *ARPCNodeCtlBasic) BufferGetItemsFirstTime(
	buffer_id *gouuidtools.UUID,
) (
	time_ time.Time,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetItemsIds

func (self *ARPCNodeCtlBasic) BufferGetItemsIds(
	buffer_id *gouuidtools.UUID,
	first_spec, last_spec *ARPCBufferItemSpecifier,
) (
	ids []string,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetItemsLastTime

func (self *ARPCNodeCtlBasic) BufferGetItemsLastTime(
	buffer_id *gouuidtools.UUID,
) (
	time_ time.Time,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetItemsTimesByIds

func (self *ARPCNodeCtlBasic) BufferGetItemsTimesByIds(
	buffer_id *gouuidtools.UUID,
	ids []string,
) (
	times []time.Time,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferGetListSubscribedUpdatesNotifications

func (self *ARPCNodeCtlBasic) BufferGetListSubscribedUpdatesNotifications() (
	buffer_id *gouuidtools.UUID,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferSubscribeOnUpdatesNotification

func (self *ARPCNodeCtlBasic) BufferSubscribeOnUpdatesNotification(
	buffer_id *gouuidtools.UUID,
) (
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferUnsubscribeFromUpdatesNotification

func (self *ARPCNodeCtlBasic) BufferUnsubscribeFromUpdatesNotification(
	buffer_id *gouuidtools.UUID,
) (
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) BufferUpdated

func (self *ARPCNodeCtlBasic) BufferUpdated(
	buffer_id *gouuidtools.UUID,
)

func (*ARPCNodeCtlBasic) Call

func (self *ARPCNodeCtlBasic) Call(
	name string,
	args []*ARPCCallArg,

	unhandled bool,
	response_handler *ARPCNodeCtlBasicCallResHandler,
) (ret_any *gouuidtools.UUID, ret_err error)

func (*ARPCNodeCtlBasic) CallClose

func (self *ARPCNodeCtlBasic) CallClose(
	call_id *gouuidtools.UUID,
) (
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) CallGetArgCount

func (self *ARPCNodeCtlBasic) CallGetArgCount(
	call_id *gouuidtools.UUID,
) (
	res int,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) CallGetArgValues

func (self *ARPCNodeCtlBasic) CallGetArgValues(
	call_id *gouuidtools.UUID,
	first, last int,
) (
	res []*ARPCArgInfo,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) CallGetList

func (self *ARPCNodeCtlBasic) CallGetList() (
	buffer_id *gouuidtools.UUID,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) CallGetName

func (self *ARPCNodeCtlBasic) CallGetName(
	call_id *gouuidtools.UUID,
) (
	name string,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) Close

func (self *ARPCNodeCtlBasic) Close()

func (*ARPCNodeCtlBasic) DebugPrintfln

func (self *ARPCNodeCtlBasic) DebugPrintfln(format string, data ...any)

func (*ARPCNodeCtlBasic) DebugPrintln

func (self *ARPCNodeCtlBasic) DebugPrintln(data ...any)

func (*ARPCNodeCtlBasic) GetDebugName

func (self *ARPCNodeCtlBasic) GetDebugName() string

func (*ARPCNodeCtlBasic) NewBuffer

func (self *ARPCNodeCtlBasic) NewBuffer(
	buffer_id *gouuidtools.UUID,
)

func (*ARPCNodeCtlBasic) NewCall

func (self *ARPCNodeCtlBasic) NewCall(
	call_id *gouuidtools.UUID,
	response_on *gouuidtools.UUID,
)

func (*ARPCNodeCtlBasic) NewSocket

func (self *ARPCNodeCtlBasic) NewSocket(
	listening_socket_id *gouuidtools.UUID,
)

func (*ARPCNodeCtlBasic) NewTransmission

func (self *ARPCNodeCtlBasic) NewTransmission(
	tarnsmission_id *gouuidtools.UUID,
)

func (*ARPCNodeCtlBasic) Reply

func (self *ARPCNodeCtlBasic) Reply(
	reply_to_id *gouuidtools.UUID,
	args ...*ARPCCallArg,
) (
	err error,
)

func (*ARPCNodeCtlBasic) SetDebug

func (self *ARPCNodeCtlBasic) SetDebug(val bool)

func (*ARPCNodeCtlBasic) SetDebugName

func (self *ARPCNodeCtlBasic) SetDebugName(name string)

func (*ARPCNodeCtlBasic) SetNode

func (self *ARPCNodeCtlBasic) SetNode(node *ARPCNode)

func (*ARPCNodeCtlBasic) SimpleRequest

func (self *ARPCNodeCtlBasic) SimpleRequest(msg *gojsonrpc2.Message) (error, error)

func (*ARPCNodeCtlBasic) SocketClose

func (self *ARPCNodeCtlBasic) SocketClose(
	connected_socket_id *gouuidtools.UUID,
) (
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) SocketGetConn

func (self *ARPCNodeCtlBasic) SocketGetConn(
	connected_socket_id *gouuidtools.UUID,
) (net.Conn, error)

func (*ARPCNodeCtlBasic) SocketGetList

func (self *ARPCNodeCtlBasic) SocketGetList() (
	buffer_id *gouuidtools.UUID,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) SocketOpen

func (self *ARPCNodeCtlBasic) SocketOpen(
	listening_socket_id *gouuidtools.UUID,
) (
	connected_socket_id *gouuidtools.UUID,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) SocketRead

func (self *ARPCNodeCtlBasic) SocketRead(
	connected_socket_id *gouuidtools.UUID,
	try_read_size int,
) (
	b []byte,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) SocketSetDeadline

func (self *ARPCNodeCtlBasic) SocketSetDeadline(
	connected_socket_id *gouuidtools.UUID,
	t time.Time,
) (
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) SocketSetReadDeadline

func (self *ARPCNodeCtlBasic) SocketSetReadDeadline(
	connected_socket_id *gouuidtools.UUID,
	t time.Time,
) (
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) SocketSetWriteDeadline

func (self *ARPCNodeCtlBasic) SocketSetWriteDeadline(
	connected_socket_id *gouuidtools.UUID,
	t time.Time,
) (
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) SocketWrite

func (self *ARPCNodeCtlBasic) SocketWrite(
	connected_socket_id *gouuidtools.UUID,
	b []byte,
) (
	n int,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) TransmissionGetInfo

func (self *ARPCNodeCtlBasic) TransmissionGetInfo(
	transmission_id *gouuidtools.UUID,
) (
	info *ARPCTransmissionInfo,
	err_processing_not_internal, err_processing_internal error,
)

func (*ARPCNodeCtlBasic) TransmissionGetList

func (self *ARPCNodeCtlBasic) TransmissionGetList() (
	buffer_id *gouuidtools.UUID,
	err_processing_not_internal, err_processing_internal error,
)

type ARPCNodeCtlBasicBufferR

type ARPCNodeCtlBasicBufferR struct {
	Ctl *ARPCNodeCtlBasic

	BufferId *gouuidtools.UUID

	Buffer ARPCBufferI

	TTL time.Duration
}

func (*ARPCNodeCtlBasicBufferR) Deleted

func (self *ARPCNodeCtlBasicBufferR) Deleted()

type ARPCNodeCtlBasicCallR

type ARPCNodeCtlBasicCallR struct {
	Ctl *ARPCNodeCtlBasic

	CallId    *gouuidtools.UUID
	ReplyToId *gouuidtools.UUID

	Name string
	Args []*ARPCCallArg

	Handled         bool
	ResponseHandler *ARPCNodeCtlBasicCallResHandler
	TTL             time.Duration
}

func (*ARPCNodeCtlBasicCallR) Deleted

func (self *ARPCNodeCtlBasicCallR) Deleted()

type ARPCNodeCtlBasicCallResHandler

type ARPCNodeCtlBasicCallResHandler struct {
	OnTimeout  func()
	OnClose    func()
	OnResponse func(args *ARPCCall)
}

func NewChannelledARPCNodeCtlBasicRespHandler

func NewChannelledARPCNodeCtlBasicRespHandler() (
	timedout <-chan struct{},
	closed <-chan struct{},
	call <-chan *ARPCCall,
	rh *ARPCNodeCtlBasicCallResHandler,
)

type ARPCNodeCtlBasicConnectedSocketR

type ARPCNodeCtlBasicConnectedSocketR struct {
	Ctl *ARPCNodeCtlBasic

	ConnectedSocketId *gouuidtools.UUID

	ConnectedSocket ARPCConnectedSocketI

	TTL time.Duration
}

func (*ARPCNodeCtlBasicConnectedSocketR) Deleted

func (self *ARPCNodeCtlBasicConnectedSocketR) Deleted()

type ARPCNodeCtlBasicListeningSocketR

type ARPCNodeCtlBasicListeningSocketR struct {
	Ctl *ARPCNodeCtlBasic

	ListeningSocketId *gouuidtools.UUID

	ListeningSocket ARPCListeningSocketI

	TTL time.Duration
}

func (*ARPCNodeCtlBasicListeningSocketR) Deleted

func (self *ARPCNodeCtlBasicListeningSocketR) Deleted()

type ARPCNodeCtlBasicTransmissionR

type ARPCNodeCtlBasicTransmissionR struct {
	Ctl *ARPCNodeCtlBasic

	TransmissionId *gouuidtools.UUID

	Transmission ARPCTransmissionI

	TTL time.Duration
}

func (*ARPCNodeCtlBasicTransmissionR) Deleted

func (self *ARPCNodeCtlBasicTransmissionR) Deleted()

type ARPCNodeCtlI

type ARPCNodeCtlI interface {

	// node will call this func on node init and
	// pass pointer to self to controller
	SetNode(node *ARPCNode)

	// this is just like OnRequestCB on JSONRPC2Node, with exception:
	// to get here, (on jsonrpc2 level) message should be sent with "s:"
	// prefix in method name. but this msg.Method will be with "s:" removed.
	SimpleRequest(msg *gojsonrpc2.Message) (error, error)

	// get local representation of remote connected socket
	SocketGetConn(connected_socket_id *gouuidtools.UUID) (net.Conn, error)

	Close()

	// inform node about new call availability
	NewCall(
		call_id *gouuidtools.UUID,
		response_on *gouuidtools.UUID,
	)

	// you have to subscribe to bufffer updates to receive this
	// notifications (see BufferSubscribeOnUpdatesNotification())
	BufferUpdated(
		buffer_id *gouuidtools.UUID,
	)

	// inform node about new transmission availability
	NewTransmission(
		transmission_id *gouuidtools.UUID,
	)

	// generates list of active calls and returns it's buffer_id
	CallGetList() (
		buffer_id *gouuidtools.UUID,
		err_processing_not_internal, err_processing_internal error,
	)

	// returns name of method which call is calling
	CallGetName(
		call_id *gouuidtools.UUID,
	) (
		name string,
		err_processing_not_internal, err_processing_internal error,
	)

	// returns int count of attributes of call
	CallGetArgCount(
		call_id *gouuidtools.UUID,
	) (
		res int,
		err_processing_not_internal, err_processing_internal error,
	)

	// returns ARPCArgInfo for selected arg of selected call
	CallGetArgValues(
		call_id *gouuidtools.UUID,
		first, last int,
	) (
		res []*ARPCArgInfo,
		err_processing_not_internal, err_processing_internal error,
	)

	// inform node what call isn't longer needed
	CallClose(
		call_id *gouuidtools.UUID,
	) (
		err_processing_not_internal, err_processing_internal error,
	)

	// get information about bufffer
	BufferGetInfo(
		buffer_id *gouuidtools.UUID,
	) (
		info *ARPCCallForJSON,
		err_processing_not_internal, err_processing_internal error,
	)

	// get count of items in buffer.
	// note: for binary buffers use BufferBinary* functions to get
	// bytes count and bytes slices
	BufferGetItemsCount(
		buffer_id *gouuidtools.UUID,
	) (
		count int,
		err_processing_not_internal, err_processing_internal error,
	)

	// get exact ids of buffer items using Buffer Item Specifiers
	BufferGetItemsIds(
		buffer_id *gouuidtools.UUID,
		first_spec, last_spec *ARPCBufferItemSpecifier,

	) (
		ids []string,
		err_processing_not_internal, err_processing_internal error,
	)

	// returns Times of specified buffer items
	BufferGetItemsTimesByIds(
		buffer_id *gouuidtools.UUID,
		ids []string,
	) (
		times []time.Time,
		err_processing_not_internal, err_processing_internal error,
	)

	// retrive actual buffer items with payloads
	BufferGetItemsByIds(
		buffer_id *gouuidtools.UUID,
		ids []string,
	) (
		buffer_items []*ARPCBufferItem,
		err_processing_not_internal, err_processing_internal error,
	)

	BufferGetItemsFirstTime(
		buffer_id *gouuidtools.UUID,
	) (
		time_ time.Time,
		err_processing_not_internal, err_processing_internal error,
	)

	BufferGetItemsLastTime(
		buffer_id *gouuidtools.UUID,
	) (
		time_ time.Time,
		err_processing_not_internal, err_processing_internal error,
	)

	// receive notifications on buffer updates
	BufferSubscribeOnUpdatesNotification(
		buffer_id *gouuidtools.UUID,
	) (
		err_processing_not_internal, err_processing_internal error,
	)

	BufferUnsubscribeFromUpdatesNotification(
		buffer_id *gouuidtools.UUID,
	) (
		err_processing_not_internal, err_processing_internal error,
	)

	BufferGetIsSubscribedOnUpdatesNotification(
		buffer_id *gouuidtools.UUID,
	) (
		r bool,
		err_processing_not_internal, err_processing_internal error,
	)

	BufferGetListSubscribedUpdatesNotifications() (
		buffer_id *gouuidtools.UUID,
		err_processing_not_internal, err_processing_internal error,
	)

	BufferBinaryGetSize(
		buffer_id *gouuidtools.UUID,
	) (
		size int,
		err_processing_not_internal, err_processing_internal error,
	)

	BufferBinaryGetSlice(
		buffer_id *gouuidtools.UUID,
		start_index, end_index int,
	) (
		data []byte,
		err_processing_not_internal, err_processing_internal error,
	)

	// like the CallGetList(), same here but for transmissions:
	// result is buffer with ids.
	TransmissionGetList() (
		buffer_id *gouuidtools.UUID,
		err_processing_not_internal, err_processing_internal error,
	)

	TransmissionGetInfo(
		transmission_id *gouuidtools.UUID,
	) (
		info *ARPCTransmissionInfo,
		err_processing_not_internal, err_processing_internal error,
	)

	// just like the CallGetList() or TransmissionGetList(),
	// same here but for sockets:
	// result is buffer with ids.
	// except: only sockets available to be opened are listed -
	// already connected sockets - are not returned
	SocketGetList() (
		buffer_id *gouuidtools.UUID,
		err_processing_not_internal, err_processing_internal error,
	)

	SocketOpen(
		listening_socket_id *gouuidtools.UUID,
	) (
		connected_socket_id *gouuidtools.UUID,
		err_processing_not_internal, err_processing_internal error,
	)

	SocketRead(
		connected_socket_id *gouuidtools.UUID,
		try_read_size int,
	) (
		b []byte,
		err_processing_not_internal, err_processing_internal error,
	)

	SocketWrite(
		connected_socket_id *gouuidtools.UUID,
		b []byte,
	) (
		n int,
		err_processing_not_internal, err_processing_internal error,
	)

	SocketClose(
		connected_socket_id *gouuidtools.UUID,
	) (
		err_processing_not_internal, err_processing_internal error,
	)

	SocketSetDeadline(
		connected_socket_id *gouuidtools.UUID,
		t time.Time,
	) (
		err_processing_not_internal, err_processing_internal error,
	)

	SocketSetReadDeadline(
		connected_socket_id *gouuidtools.UUID,
		t time.Time,
	) (
		err_processing_not_internal, err_processing_internal error,
	)

	SocketSetWriteDeadline(
		connected_socket_id *gouuidtools.UUID,
		t time.Time,
	) (
		err_processing_not_internal, err_processing_internal error,
	)
}

type ARPCTransmissionI

type ARPCTransmissionI interface{}

type ARPCTransmissionInfo

type ARPCTransmissionInfo struct {
	HumanTitle       string
	HumanDescription string
	BufferIds        []*gouuidtools.UUID
}

type ReadWriteSeekCloser

type ReadWriteSeekCloser interface {
	io.Reader
	io.Writer
	io.Closer
	io.Seeker
}

Jump to

Keyboard shortcuts

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