Documentation
¶
Overview ¶
Foliage primary statefun package. Provides all everything that is needed for Foliage stateful functions and Foliage applications
Index ¶
- Constants
- func AddRequestSourceNatsCore(ft *FunctionType) error
- func AddSignalSourceJetstreamQueuePushConsumer(ft *FunctionType) error
- func ContextMutexLock(ft *FunctionType, id string, errorOnLocked bool) (uint64, error)
- func ContextMutexUnlock(ft *FunctionType, id string, lockRevisionID uint64) error
- func FunctionTypeMutexLock(ft *FunctionType, errorOnLocked bool) (uint64, error)
- func FunctionTypeMutexUnlock(ft *FunctionType, lockRevisionID uint64) error
- func KeyMutexLock(runtime *Runtime, key string, errorOnLocked bool) (uint64, error)
- func KeyMutexLockUpdate(runtime *Runtime, key string, lockRevisionID uint64) (uint64, error)
- func KeyMutexUnlock(runtime *Runtime, key string, lockRevisionID uint64) error
- type FunctionLogicHandler
- type FunctionType
- type FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetBalanceNeeded(balanceNeeded bool) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetMaxIdHandlers(maxIdHandlers int) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetMsgAckChannelSize(msgAckChannelSize int) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetMsgAckWaitMs(msgAckWaitMs int) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetMsgChannelSize(msgChannelSize int) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetMultipleInstancesAllowance(allowed bool) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetMutexLifeTimeSec(mutexLifeTimeSec int) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetOptions(options *easyjson.JSON) *FunctionTypeConfig
- func (ftc *FunctionTypeConfig) SetServiceState(active bool) *FunctionTypeConfig
- type FunctionTypeMsg
- type HandlerMsgRefusalType
- type RefusalCallbackAction
- type RequestCallbackAction
- type Runtime
- func (r *Runtime) Request(requestProvider sfPlugins.RequestProvider, typename string, id string, ...) (*easyjson.JSON, error)
- func (r *Runtime) Signal(signalProvider sfPlugins.SignalProvider, typename string, id string, ...) error
- func (r *Runtime) Start(cacheConfig *cache.Config, onAfterStart func(runtime *Runtime) error) (err error)
- type RuntimeConfig
- func (ro *RuntimeConfig) SeKeyValueStoreBucketName(keyValueStoreBucketName string) *RuntimeConfig
- func (ro *RuntimeConfig) SetFunctionTypeIDLifetimeMs(functionTypeIDLifetimeMs int) *RuntimeConfig
- func (ro *RuntimeConfig) SetKVMutexIsOldPollingIntervalSec(kvMutexIsOldPollingIntervalSec int) *RuntimeConfig
- func (ro *RuntimeConfig) SetKVMutexLifeTimeSec(kvMutexLifeTimeSec int) *RuntimeConfig
- func (ro *RuntimeConfig) SetNatsURL(natsURL string) *RuntimeConfig
- func (ro *RuntimeConfig) SetRequestTimeoutSec(requestTimeoutSec int) *RuntimeConfig
- type SignalCallbackAction
Constants ¶
View Source
const ( MsgAckWaitTimeoutMs = 10000 MsgChannelSize = 64 MsgAckChannelSize = 64 BalanceNeeded = true MutexLifetimeSec = 120 MultipleInstancesAllowed = false MaxIdHandlers = 20 )
View Source
const ( NatsURL = "nats://nats:foliage@nats:4222" RuntimeName = "foliage_runtime" KeyValueStoreBucketName = RuntimeName + "_kv_store" KVMutexLifetimeSec = 120 KVMutexIsOldPollingInterval = 10 FunctionTypeIDLifetimeMs = 5000 RequestTimeoutSec = 60 )
Variables ¶
This section is empty.
Functions ¶
func AddRequestSourceNatsCore ¶ added in v0.1.1
func AddRequestSourceNatsCore(ft *FunctionType) error
func AddSignalSourceJetstreamQueuePushConsumer ¶ added in v0.1.1
func AddSignalSourceJetstreamQueuePushConsumer(ft *FunctionType) error
func ContextMutexLock ¶
func ContextMutexLock(ft *FunctionType, id string, errorOnLocked bool) (uint64, error)
func ContextMutexUnlock ¶
func ContextMutexUnlock(ft *FunctionType, id string, lockRevisionID uint64) error
func FunctionTypeMutexLock ¶
func FunctionTypeMutexLock(ft *FunctionType, errorOnLocked bool) (uint64, error)
func FunctionTypeMutexUnlock ¶
func FunctionTypeMutexUnlock(ft *FunctionType, lockRevisionID uint64) error
func KeyMutexLock ¶
errorOnLocked - if mutex is already locked, exit with error (do not wait for unlocking)
func KeyMutexLockUpdate ¶ added in v0.1.3
Types ¶
type FunctionLogicHandler ¶ added in v0.1.1
type FunctionLogicHandler func(sfPlugins.StatefunExecutor, *sfPlugins.StatefunContextProcessor)
type FunctionType ¶
type FunctionType struct {
// contains filtered or unexported fields
}
func NewFunctionType ¶
func NewFunctionType(runtime *Runtime, name string, logicHandler FunctionLogicHandler, config FunctionTypeConfig) *FunctionType
func (*FunctionType) SetExecutor ¶
func (ft *FunctionType) SetExecutor(alias string, content string, constructor func(alias string, source string) sfPlugins.StatefunExecutor) error
type FunctionTypeConfig ¶
type FunctionTypeConfig struct {
// contains filtered or unexported fields
}
func NewFunctionTypeConfig ¶
func NewFunctionTypeConfig() *FunctionTypeConfig
func (*FunctionTypeConfig) SetBalanceNeeded ¶
func (ftc *FunctionTypeConfig) SetBalanceNeeded(balanceNeeded bool) *FunctionTypeConfig
func (*FunctionTypeConfig) SetMaxIdHandlers ¶ added in v0.1.3
func (ftc *FunctionTypeConfig) SetMaxIdHandlers(maxIdHandlers int) *FunctionTypeConfig
func (*FunctionTypeConfig) SetMsgAckChannelSize ¶
func (ftc *FunctionTypeConfig) SetMsgAckChannelSize(msgAckChannelSize int) *FunctionTypeConfig
func (*FunctionTypeConfig) SetMsgAckWaitMs ¶
func (ftc *FunctionTypeConfig) SetMsgAckWaitMs(msgAckWaitMs int) *FunctionTypeConfig
func (*FunctionTypeConfig) SetMsgChannelSize ¶ added in v0.1.3
func (ftc *FunctionTypeConfig) SetMsgChannelSize(msgChannelSize int) *FunctionTypeConfig
func (*FunctionTypeConfig) SetMultipleInstancesAllowance ¶ added in v0.1.3
func (ftc *FunctionTypeConfig) SetMultipleInstancesAllowance(allowed bool) *FunctionTypeConfig
func (*FunctionTypeConfig) SetMutexLifeTimeSec ¶
func (ftc *FunctionTypeConfig) SetMutexLifeTimeSec(mutexLifeTimeSec int) *FunctionTypeConfig
func (*FunctionTypeConfig) SetOptions ¶
func (ftc *FunctionTypeConfig) SetOptions(options *easyjson.JSON) *FunctionTypeConfig
func (*FunctionTypeConfig) SetServiceState ¶ added in v0.1.1
func (ftc *FunctionTypeConfig) SetServiceState(active bool) *FunctionTypeConfig
TODO: if serviceActive == false GOLANG local call should also be not possible! TODO: SetAccessebility([]string = "golang local request" | "golang local signal" | "jetstream signal" | "nats core request")
type FunctionTypeMsg ¶ added in v0.1.1
type FunctionTypeMsg struct { Caller *sfPlugins.StatefunAddress Payload *easyjson.JSON Options *easyjson.JSON RefusalCallback RefusalCallbackAction RequestCallback RequestCallbackAction AckCallback SignalCallbackAction }
type HandlerMsgRefusalType ¶ added in v0.1.1
type HandlerMsgRefusalType int
type RefusalCallbackAction ¶ added in v0.1.1
type RefusalCallbackAction = func()
type RequestCallbackAction ¶ added in v0.1.1
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func NewRuntime(config RuntimeConfig) (r *Runtime, err error)
type RuntimeConfig ¶
type RuntimeConfig struct {
// contains filtered or unexported fields
}
func NewRuntimeConfig ¶
func NewRuntimeConfig() *RuntimeConfig
func NewRuntimeConfigSimple ¶
func NewRuntimeConfigSimple(natsURL string, runtimeName string) *RuntimeConfig
func (*RuntimeConfig) SeKeyValueStoreBucketName ¶
func (ro *RuntimeConfig) SeKeyValueStoreBucketName(keyValueStoreBucketName string) *RuntimeConfig
func (*RuntimeConfig) SetFunctionTypeIDLifetimeMs ¶
func (ro *RuntimeConfig) SetFunctionTypeIDLifetimeMs(functionTypeIDLifetimeMs int) *RuntimeConfig
func (*RuntimeConfig) SetKVMutexIsOldPollingIntervalSec ¶
func (ro *RuntimeConfig) SetKVMutexIsOldPollingIntervalSec(kvMutexIsOldPollingIntervalSec int) *RuntimeConfig
func (*RuntimeConfig) SetKVMutexLifeTimeSec ¶
func (ro *RuntimeConfig) SetKVMutexLifeTimeSec(kvMutexLifeTimeSec int) *RuntimeConfig
func (*RuntimeConfig) SetNatsURL ¶
func (ro *RuntimeConfig) SetNatsURL(natsURL string) *RuntimeConfig
func (*RuntimeConfig) SetRequestTimeoutSec ¶ added in v0.1.3
func (ro *RuntimeConfig) SetRequestTimeoutSec(requestTimeoutSec int) *RuntimeConfig
type SignalCallbackAction ¶ added in v0.1.1
type SignalCallbackAction = func(ack bool)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.