statefun

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Overview

Foliage primary statefun package. Provides all everything that is needed for Foliage stateful functions and Foliage applications

Index

Constants

View Source
const (
	MsgAckWaitTimeoutMs = 10000
	MsgChannelSize      = 64
	MsgAckChannelSize   = 64
	BalanceNeeded       = true
	MutexLifetimeSec    = 120
)
View Source
const (
	NatsURL                      = "nats://nats:foliage@nats:4222"
	RuntimeName                  = "foliage_runtime"
	KeyValueStoreBucketName      = RuntimeName + "_kv_store"
	FunctionTypesStreamName      = RuntimeName + "_stream"
	KVMutexLifetimeSec           = 120
	KVMutexIsOldPollingInterval  = 10
	FunctionTypeIDLifetimeMs     = 5000
	IngressCallGolangSyncTimeout = 60
)

Variables

This section is empty.

Functions

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

func KeyMutexLock(runtime *Runtime, key string, errorOnLocked bool, debugCaller ...string) (uint64, error)

func KeyMutexUnlock

func KeyMutexUnlock(runtime *Runtime, key string, lockRevisionID uint64, debugCaller ...string) error

Types

type FunctionType

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

func NewFunctionType

func NewFunctionType(runtime *Runtime, name string, handler FunctionHandler, config FunctionTypeConfig) *FunctionType

func (*FunctionType) SetExecutor

func (ft *FunctionType) SetExecutor(alias string, content string, constructor func(alias string, source string) sfPlugins.StatefunExecutor) error

func (*FunctionType) Start

func (ft *FunctionType) Start(streamName string) error

type FunctionTypeConfig

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

func NewFunctionTypeConfig

func NewFunctionTypeConfig() *FunctionTypeConfig

func (*FunctionTypeConfig) SeMsgChannelSize

func (ftc *FunctionTypeConfig) SeMsgChannelSize(msgChannelSize int) *FunctionTypeConfig

func (*FunctionTypeConfig) SetBalanceNeeded

func (ftc *FunctionTypeConfig) SetBalanceNeeded(balanceNeeded bool) *FunctionTypeConfig

func (*FunctionTypeConfig) SetMsgAckChannelSize

func (ftc *FunctionTypeConfig) SetMsgAckChannelSize(msgAckChannelSize int) *FunctionTypeConfig

func (*FunctionTypeConfig) SetMsgAckWaitMs

func (ftc *FunctionTypeConfig) SetMsgAckWaitMs(msgAckWaitMs int) *FunctionTypeConfig

func (*FunctionTypeConfig) SetMutexLifeTimeSec

func (ftc *FunctionTypeConfig) SetMutexLifeTimeSec(mutexLifeTimeSec int) *FunctionTypeConfig

func (*FunctionTypeConfig) SetOptions

func (ftc *FunctionTypeConfig) SetOptions(options *easyjson.JSON) *FunctionTypeConfig

type GoMsg

type GoMsg struct {
	ResultJSONChannel chan *easyjson.JSON
	Caller            *sfPlugins.StatefunAddress
	Payload           *easyjson.JSON
	Options           *easyjson.JSON
}

type Runtime

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

func NewRuntime

func NewRuntime(config RuntimeConfig) (r *Runtime, err error)

func (*Runtime) IngressGolangSync

func (r *Runtime) IngressGolangSync(typename string, id string, payload *easyjson.JSON, options *easyjson.JSON) (*easyjson.JSON, error)

func (*Runtime) IngressNATS

func (r *Runtime) IngressNATS(typename string, id string, payload *easyjson.JSON, options *easyjson.JSON)

func (*Runtime) Start

func (r *Runtime) Start(cacheConfig *cache.Config, onAfterStart func(runtime *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) SetFunctionTypesStreamName

func (ro *RuntimeConfig) SetFunctionTypesStreamName(functionTypesStreamName string) *RuntimeConfig

func (*RuntimeConfig) SetIngressCallGoLangSyncTimeoutSec

func (ro *RuntimeConfig) SetIngressCallGoLangSyncTimeoutSec(ingressCallGoLangSyncTimeoutSec 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

Directories

Path Synopsis
Foliage statefun cache package.
Foliage statefun cache package.
Foliage statefun plugins package.
Foliage statefun plugins package.
js
Foliage primary statefun system package.
Foliage primary statefun system package.

Jump to

Keyboard shortcuts

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