response

package
v0.0.0-...-31abfad Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// System events done through rest
	EventStartTracing eventCode = iota
	EventStopTracing
	EventStartDebugger
	EventStopDebugger
	EventCleanupEventing
	EventDie
	EventTriggerGC
	EventFreeOSMemory
	EventGetUUID
	EventGetVersion
	EventGetErrCodes
	EventGetCpuCount
	EventGetWorkerCount
	EventGetLogFileLocation
	EventSaveConfig
	EventGetConfig

	// Eventing function crud operation
	EventCreateFunction
	EventDeployFunction
	EventPauseFunction
	EventResumeFunction
	EventUndeployFunction
	EventDeleteFunction
	// Includes settings change and function change
	EventUpdateFunction
	EventSetFunctionConfig

	// Function stat event
	EventClearStats
	EventFetchStats
	EventFetchProcessingStats
	EventFetchLatencyStats
	EventFetchExecutionStats
	EventFetchFailureStats

	// Function retrieve
	EventImportFunctions
	EventExportFunctions
	EventGetDeployedApps
	EventGetRunningApps
	EventGetBootstrappingApps
	EventGetPausingApps
	EventGetFunctionStatus
	EventBackupFunctions
	EventRestoreFunctions
	EventGetFunctionDraft
	EventGetInsight
	EventGetAppLog
	EventGetFunctionConfig
	EventListAllfunction
	EventGetAnnotations
	EventGetDebuggerUrl
	EventWriteDebuggerUrl

	// Miscellaneous functions
	EventResdistributeWorkload
	EventGetRebalanceProgress
	EventGetRebalanceStatus
	EventGetBootstrapStatus
	EventGetSeqProcessed
	EventGetDcpEventsRemaining
	EventGetConsumerPids
	EventGetUserInfo
	EventGetRuntimeProfiling

	EventGetAppStats
)
View Source
const (
	AuditLog  log = 0b_00000001
	SystemLog     = 0b_00000010
)

Variables

View Source
var (
	Ok                        = errCode(0)
	ErrDelAppPs               = errCode(1)
	ErrDelAppTs               = errCode(2)
	ErrSaveAppPs              = errCode(5)
	ErrSaveAppTs              = errCode(6)
	ErrSetSettingsPs          = errCode(7)
	ErrDelAppSettingsPs       = errCode(11)
	ErrAppNotDeployed         = errCode(12)
	ErrAppNotFoundTs          = errCode(13)
	ErrMarshalResp            = errCode(14)
	ErrReadReq                = errCode(15)
	ErrUnmarshalPld           = errCode(16)
	ErrSrcMbSame              = errCode(17)
	ErrAppDeployed            = errCode(20)
	ErrAppNotInit             = errCode(21)
	ErrAppNotUndeployed       = errCode(22)
	ErrStatusesNotFound       = errCode(23)
	ErrBucketTypeCheck        = errCode(25)
	ErrMemcachedBucket        = errCode(26)
	ErrHandlerCompile         = errCode(27)
	ErrAppNameMismatch        = errCode(29)
	ErrSaveConfig             = errCode(33)
	ErrGetConfig              = errCode(34)
	ErrGetRebStatus           = errCode(35)
	ErrRebOrFailoverOngoing   = errCode(36)
	ErrInvalidConfig          = errCode(38)
	ErrAppCodeSize            = errCode(39)
	ErrBucketMissing          = errCode(41)
	ErrClusterVersion         = errCode(42)
	ErrDebuggerDisabled       = errCode(45)
	ErrMixedMode              = errCode(46)
	ErrBucketAccess           = errCode(49)
	ErrInterFunctionRecursion = errCode(50)
	ErrInterBucketRecursion   = errCode(51)
	ErrUnsupportedSGW         = errCode(52)
	ErrSGWDetection           = errCode(53)
	ErrAppNotFound            = errCode(54)
	ErrMetakvWriteFailed      = errCode(55)
	ErrRequestedOpFailed      = errCode(56)
	ErrCollectionMissing      = errCode(57)
	ErrMagmaStorage           = errCode(58)
	ErrInternalServer         = errCode(59)
	ErrForbidden              = errCode(60)
	ErrUnauthenticated        = errCode(61)
	ErrMethodNotAllowed       = errCode(62)
	ErrInvalidRequest         = errCode(63)
	ErrAppPaused              = errCode(64)
	ErrCursorLimitReached     = errCode(65)
	ErrOnDeployFailed         = errCode(66)
)

Functions

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter, r *http.Request, event eventCode) *responseWriter

Types

type ErrorInfo

type ErrorInfo struct {
	Name        string      `json:"name"`
	Code        int         `json:"code"`
	Attributes  []string    `json:"attributes,omitempty"`
	Description interface{} `json:"description"`
	// contains filtered or unexported fields
}

func (*ErrorInfo) GetDescription

func (e *ErrorInfo) GetDescription() interface{}

func (*ErrorInfo) GetName

func (e *ErrorInfo) GetName() string

func (*ErrorInfo) GetStatusCode

func (e *ErrorInfo) GetStatusCode() int

type Response

type Response interface {
	// Adds request made by the user
	AddRequestData(key string, value interface{})

	// Add the requested event
	SetRequestEvent(event eventCode)

	// Logs if the context is to be logged
	// currently logging to audit and system logs
	// Error will be logged by errCode
	LogAndSend(runtimeInfo *RuntimeInfo)

	Log(runtimeInfo *RuntimeInfo)
}

type RuntimeInfo

type RuntimeInfo struct {
	ErrCode     errCode     `json:"code"`
	Description interface{} `json:"info,omitempty"`
	WarningInfo interface{} `json:"warning_info,omitempty"`
	// For system event
	ExtraAttributes interface{} `json:"-"`

	// Some response don't need to be json marshalled
	// If set it to true then sender won't marshal the response and
	// send the description as given by the caller
	SendRawDescription bool `json:"-"`

	// If true then sender will only send the description
	OnlyDescription bool `json:"-"`
	// Defaults to "application/json"
	ContentType string `json:"-"`
}

type WarningsInfo

type WarningsInfo struct {
	Status   string   `json:"status"`
	Warnings []string `json:"warnings"`
}

Jump to

Keyboard shortcuts

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