rule

package
v0.0.0-...-e67e6ae Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

/* * Copyright (C) 2019 Yunify, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this work except in compliance with the License. * You may obtain a copy of the License in the LICENSE file, or at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEventTypeUndefined = errors.New("event type undefined")
	ErrActionMetaLoadFail = errors.New("action Load meta fail")
	ErrActionLoadFail     = errors.New("action load fail")
	ErrActionUnloadFail   = errors.New("action unload fail")
	ErrActionSetupError   = errors.New("action setup fail")
	ErrActionInvokeError  = errors.New("action invoke fail")
	ErrActionCloseError   = errors.New("action close fail")
	ErrActionOnError      = errors.New("action has error")
)

Functions

This section is empty.

Types

type ActionTask

type ActionTask struct {
	ActionData *metapb.Action
	Action     types.Action
	EntityID   string
	// contains filtered or unexported fields
}

func NewAction

func NewAction(ctx context.Context, entityID string, event *metapb.Action) (*ActionTask, error)

func (*ActionTask) Close

func (this *ActionTask) Close() error

func (*ActionTask) Context

func (this *ActionTask) Context(ctx context.Context) types.ActionContent

func (*ActionTask) Invoke

func (this *ActionTask) Invoke(ctx types.ActionContent, message metapb.Message) error

func (*ActionTask) SetErrorCallback

func (this *ActionTask) SetErrorCallback(fn func(*ActionTask, error))

func (*ActionTask) Setup

func (this *ActionTask) Setup(ctx context.Context) error

type ErrorMessage

type ErrorMessage struct {
	RuleName              string           `json:"ruleName,omitempty"`
	Topic                 string           `json:"topic,omitempty"`
	DeviceId              string           `json:"deviceId,omitempty"`
	MessageId             string           `json:"messageId,omitempty"`
	Base64OriginalPayload []byte           `json:"base64OriginalPayload,omitempty"`
	Failures              []FailureMessage `json:"failures,omitempty"`
}

type Factor

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

func NewFactor

func NewFactor(opt *Option) *Factor

func (*Factor) Tasks

type FailureMessage

type FailureMessage struct {
	ActionId     string `json:"actionId,omitempty"`
	ActionType   string `json:"actionType,omitempty"`
	ErrorMessage string `json:"errorMessage,omitempty"`
}

type Option

type Option struct {
	Tracer          opentracing.Tracer
	Logger          log.Factory
	ResourceManager types.ResourceManager
}

Option

type Task

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

func (*Task) Check

func (this *Task) Check() error

func (*Task) Close

func (this *Task) Close(ctx context.Context) error

func (*Task) ID

func (this *Task) ID() string

func (*Task) Invoke

func (this *Task) Invoke(ctx context.Context, vCtx ruleql.Context, msg stream.PublishMessage) error

func (*Task) RefreshTime

func (this *Task) RefreshTime() int64

func (*Task) String

func (this *Task) String() string

func (*Task) UserID

func (this *Task) UserID() string

Jump to

Keyboard shortcuts

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