functionHandler

package
v0.0.0-...-5951314 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TempPause funcHandlerState = iota
	Paused

	Undeployed

	Deployed
)
View Source
const (
	NoStateChange   = uint8(0)
	Started         = uint8(1)
	CheckpointDone  = uint8(2)
	StateChangeDone = uint8(Started | CheckpointDone)
)

Variables

This section is empty.

Functions

func NewDummyFunctionHandler

func NewDummyFunctionHandler() dummy

NewDummyFunctionHandler creates a dummy function handler

Types

type Config

type Config struct {
	LeaderHandler bool
}

type CursorCheckpointHandler

type CursorCheckpointHandler interface {
	GetCursors(keyspace application.Keyspace) (map[string]struct{}, bool)
}

type FunctionHandler

type FunctionHandler interface {
	AddFunctionDetails(funcDetails *application.FunctionDetails)

	// ChangeState will changes the state of an app
	// It can be called for spawn/pause/undeploy/RuntimeEnvironment crash
	ChangeState(re RuntimeEnvironment, state funcHandlerState)
	TrapEvent(trapEvent TrapEventOp, value interface{}) error

	// ReceiveMessage is when msg is received from the c++ side
	ReceiveMessage(msg *processManager.ResponseMessage)

	// Stats gives the stats back for the app
	Stats(statsType common.StatsType) *common.Stats
	GetInsight() *common.Insight

	GetApplicationLog(size int64) ([]string, error)

	// ResetStats will reset all the stats
	ResetStats()

	// ApplicationLog will write the message to the application log
	ApplicationLog(msg string)

	// NotifyOwnershipChange will be called when new vbs need to be acquired or givenup
	NotifyOwnershipChange(version string)

	// NotifyGlobalConfigChange will be called when global config is changed
	NotifyGlobalConfigChange()

	// GetRebalanceProgress how many vbs need to be claimed
	GetRebalanceProgress(version string, appProgress *common.AppRebalanceProgress) bool

	CloseFunctionHandler()
}

Calling style NewFunctionHandler() -> AddFunctionDetails() -> ChangeState(RunApp/PauseApp) -> ChangeState(StopApp) -> AddFunctionDetails()

func NewFunctionHandler

func NewFunctionHandler(id uint16, fd *application.FunctionDetails, re RuntimeEnvironment, config Config, location application.AppLocation,
	clusterSettings *common.ClusterSettings, interruptHandler InterruptHandler,
	systemResourceDetails vbhandler.SystemResourceDetails,
	observer notifier.Observer, ownershipRoutine vbhandler.Ownership,
	pool eventPool.ManagerPool, serverConfig serverConfig.ServerConfig, cursorCheckpointHandler CursorCheckpointHandler,
	utilityWorker UtilityWorker, broadcaster common.Broadcaster) FunctionHandler

type InterruptHandler

type InterruptHandler func(id uint16, seq uint32, appLocation application.AppLocation, err error)

Called when the function asked by caller is done Like OwnershipChanges or Stop finished

type LogWriter

type LogWriter interface {
	Write(p []byte) (n int, err error)
	Tail(sz int64) ([]byte, error)
	Flush()
	Close() error
}

func NewDummyLogWriter

func NewDummyLogWriter() LogWriter

type RuntimeEnvironment

type RuntimeEnvironment interface {
	InitEvent(version uint32, opcode uint8, handlerID []byte, value interface{})
	LifeCycleOp(version uint32, opcode uint8, handlerID []byte)
	SendControlMessage(version uint32, cmd processManager.Command, opcode uint8, handlerID []byte, key, value interface{})
	GetStats(version uint32, opcode uint8, handlerName []byte)

	WriteDcpMessage(version uint32, buffer *bytes.Buffer, opcode uint8, workerID uint8,
		instanceID []byte, msg *dcpMessage.DcpEvent, internalInfo *checkpointManager.ParsedInternalDetails) int32

	FlushMessage(version uint32, buffer *bytes.Buffer)
	VbSettings(version uint32, opcode uint8, handlerID []byte, key interface{}, value interface{})

	GetProcessDetails() processManager.ProcessDetails
	GetRuntimeStats() common.StatsInterface
}

type TrapEventOp

type TrapEventOp uint8
const (
	StartTrapEvent TrapEventOp = iota
	StopTrapEvent
)

type UtilityWorker

type UtilityWorker interface {
	CreateUtilityWorker(id string, md processManager.MessageDeliver) processManager.ProcessManager
	GetUtilityWorker() processManager.ProcessManager
	DoneUtilityWorker(id string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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