cloudi

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ASYNC is the requestType provided when handling an asynchronous service request
	ASYNC = 1
	// SYNC is the requestType provided when handling a synchronous service request
	SYNC = -1
)

Variables

This section is empty.

Functions

func Assert

func Assert(value bool)

Assert that a value is true

func ErrorExit

func ErrorExit(stream *os.File, err error)

ErrorExit outputs error information and exits

func ErrorWrite

func ErrorWrite(stream *os.File, err error)

ErrorWrite outputs error information to the cloudi.log file through stderr

func FatalErrorNew

func FatalErrorNew() error

Create a FatalError

func InfoKeyValueNew

func InfoKeyValueNew(pairs map[string][]string, extra ...interface{}) ([]byte, error)

InfoKeyValueNew encodes service response info key/value data

func InfoKeyValueParse

func InfoKeyValueParse(info []byte) map[string][]string

InfoKeyValueParse decodes service request info key/value data

func StackErrorWrapNew

func StackErrorWrapNew(value interface{}) error

StackErrorWrapNew creates a new error with a stack trace from any data

func ThreadCount

func ThreadCount() (uint32, error)

ThreadCount returns the thread count from the service configuration

Types

type AssertionError

type AssertionError struct {
	// contains filtered or unexported fields
}

AssertionError indicates an unrecoverable condition in a CloudI service

func (*AssertionError) Error

func (e *AssertionError) Error() string

func (*AssertionError) Stack

func (e *AssertionError) Stack() []byte

Stack return the stack stored when the error was created

type Callback

type Callback func(int, string, string, []byte, []byte, uint32, int8, [16]byte, Source, interface{}, *Instance) ([]byte, []byte, error)

Callback is a function to handle a service request

type FatalError

type FatalError struct {
	// contains filtered or unexported fields
}

FatalError indicates an unrecoverable error in a CloudI service

func (*FatalError) Error

func (e *FatalError) Error() string

func (*FatalError) Stack

func (e *FatalError) Stack() []byte

Stack return the stack stored when the error was created

type ForwardAsyncError

type ForwardAsyncError struct {
}

ForwardAsyncError indicates a request was handled with an async forward

func (*ForwardAsyncError) Error

func (e *ForwardAsyncError) Error() string

type ForwardSyncError

type ForwardSyncError struct {
}

ForwardSyncError indicates a request was handled with a sync forward

func (*ForwardSyncError) Error

func (e *ForwardSyncError) Error() string

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance is an instance of the CloudI API

func API

func API(threadIndex uint32, state interface{}) (*Instance, error)

API creates an instance of the CloudI API

func (*Instance) Forward

func (api *Instance) Forward(requestType int, name string, requestInfo, request []byte, timeout uint32, priority int8, transId [16]byte, pid Source)

Forward forwards a service request to a different service name

func (*Instance) ForwardAsync

func (api *Instance) ForwardAsync(name string, requestInfo, request []byte, timeout uint32, priority int8, transId [16]byte, pid Source)

ForwardAsync forwards an asynchronous service request to a different service name

func (*Instance) ForwardSync

func (api *Instance) ForwardSync(name string, requestInfo, request []byte, timeout uint32, priority int8, transId [16]byte, pid Source)

ForwardSync forwards a synchronous service request to a different service name

func (*Instance) McastAsync

func (api *Instance) McastAsync(name string, requestInfo, request []byte, timeoutPriority ...interface{}) ([][]byte, error)

McastAsync sends asynchronous service requests to all subscribers of the matching service name pattern

func (*Instance) Poll

func (api *Instance) Poll(timeout int32) (bool, error)

Poll blocks to process incoming CloudI service requests

func (*Instance) Prefix

func (api *Instance) Prefix() string

Prefix returns the service name pattern prefix from the service configuration

func (*Instance) ProcessCount

func (api *Instance) ProcessCount() uint32

ProcessCount returns the current process count based on the service configuration

func (*Instance) ProcessCountMax

func (api *Instance) ProcessCountMax() uint32

ProcessCountMax returns the count_process_dynamic maximum count based on the service configuration

func (*Instance) ProcessCountMin

func (api *Instance) ProcessCountMin() uint32

ProcessCountMin returns the count_process_dynamic minimum count based on the service configuration

func (*Instance) ProcessIndex

func (api *Instance) ProcessIndex() uint32

ProcessIndex returns the 0-based index of this process in the service instance

func (*Instance) RecvAsync

func (api *Instance) RecvAsync(extra ...interface{}) ([]byte, []byte, []byte, error)

RecvAsync blocks to receive an asynchronous service request response

func (*Instance) Return

func (api *Instance) Return(requestType int, name, pattern string, responseInfo, response []byte, timeout uint32, transId [16]byte, pid Source)

Return provides a response to a service request

func (*Instance) ReturnAsync

func (api *Instance) ReturnAsync(name, pattern string, responseInfo, response []byte, timeout uint32, transId [16]byte, pid Source)

ReturnAsync provides a response to an asynchronous service request

func (*Instance) ReturnSync

func (api *Instance) ReturnSync(name, pattern string, responseInfo, response []byte, timeout uint32, transId [16]byte, pid Source)

ReturnSync provides a response to a synchronous service request

func (*Instance) SendAsync

func (api *Instance) SendAsync(name string, requestInfo, request []byte, timeoutPriority ...interface{}) ([]byte, error)

SendAsync sends an asynchronous service request

func (*Instance) SendSync

func (api *Instance) SendSync(name string, requestInfo, request []byte, timeoutPriority ...interface{}) ([]byte, []byte, []byte, error)

SendSync sends a synchronous service request

func (*Instance) Shutdown added in v1.8.0

func (api *Instance) Shutdown(extra ...interface{}) error

Shutdown the service successfully

func (*Instance) Subscribe

func (api *Instance) Subscribe(pattern string, function Callback) error

Subscribe subscribes to a service name pattern with a callback

func (*Instance) SubscribeCount

func (api *Instance) SubscribeCount(pattern string) (uint32, error)

SubscribeCount returns the number of subscriptions for a single service name pattern

func (*Instance) TimeoutAsync

func (api *Instance) TimeoutAsync() uint32

TimeoutAsync returns the default asynchronous service request send timeout from the service configuration

func (*Instance) TimeoutInitialize

func (api *Instance) TimeoutInitialize() uint32

TimeoutInitialize returns the service initialization timeout from the service configuration

func (*Instance) TimeoutSync

func (api *Instance) TimeoutSync() uint32

TimeoutSync returns the default synchronous service request send timeout from the service configuration

func (*Instance) TimeoutTerminate

func (api *Instance) TimeoutTerminate() uint32

TimeoutTerminate returns the service termination timeout based on the service configuration

func (*Instance) Unsubscribe

func (api *Instance) Unsubscribe(pattern string) error

Unsubscribe unsubscribes from a service name pattern once

type InvalidInputError

type InvalidInputError struct {
	// contains filtered or unexported fields
}

InvalidInputError indicates that invalid input was provided

func (*InvalidInputError) Error

func (e *InvalidInputError) Error() string

func (*InvalidInputError) Stack

func (e *InvalidInputError) Stack() []byte

Stack return the stack stored when the error was created

type MessageDecodingError

type MessageDecodingError struct {
	// contains filtered or unexported fields
}

MessageDecodingError indicates an error decoding CloudI messages

func (*MessageDecodingError) Error

func (e *MessageDecodingError) Error() string

func (*MessageDecodingError) Stack

func (e *MessageDecodingError) Stack() []byte

Stack return the stack stored when the error was created

type ReturnAsyncError

type ReturnAsyncError struct {
}

ReturnAsyncError indicates a request was handled with an async return

func (*ReturnAsyncError) Error

func (e *ReturnAsyncError) Error() string

type ReturnSyncError

type ReturnSyncError struct {
}

ReturnSyncError indicates a request was handled with a sync return

func (*ReturnSyncError) Error

func (e *ReturnSyncError) Error() string

type Source

type Source erlang.OtpErlangPid

Source is the Erlang pid that is the source of the service request

type StackError

type StackError interface {
	Stack() []byte
}

StackError provides an interface for error structs that provide a stacktrace

type StackErrorWrap

type StackErrorWrap struct {
	Value error
	// contains filtered or unexported fields
}

StackErrorWrap is used to attach a stacktrace to panic data as an error

func (*StackErrorWrap) Error

func (e *StackErrorWrap) Error() string

func (*StackErrorWrap) Stack

func (e *StackErrorWrap) Stack() []byte

Stack return the stack stored when the error was created

type TerminateError

type TerminateError struct {
	// contains filtered or unexported fields
}

TerminateError indicates that unavoidable termination is occurring

func (*TerminateError) Error

func (e *TerminateError) Error() string

func (*TerminateError) Timeout

func (e *TerminateError) Timeout() uint32

Timeout provides the termination timeout configured for the service

Jump to

Keyboard shortcuts

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