caf

package module
v0.0.0-...-71af304 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2015 License: MIT Imports: 9 Imported by: 6

README

cascades-caf

A Context-Awareness Framework as components for Cascades

Examples

Using HttpProperty with the system agent

'3s' -> INT HttpProperty(caf/http-property)

'{
	"url": "http://localhost:9000/rest/System/PS", 
	"method": "GET",
	"content-type": "application/json"
}' -> REQ HttpProperty

'{
	"type": "float",	
	"name": "ProcessCount",
	"template": "{{ .count }}",
	"group": "SystemA"
}' -> TMPL HttpProperty


HttpProperty PROP -> IN Log(core/console)

Documentation

Index

Constants

View Source
const (
	PropTypeFloat  = "float"
	PropTypeBool   = "bool"
	PropTypeString = "string"
)

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	ID          string        `json:"id"`
	Name        string        `json:"name"`
	Group       string        `json:"group"`
	Description string        `json:"description"`
	Condition   string        `json:"condition"`
	Determined  bool          `json:"determined"` // Whether the context state is determined
	Matching    bool          `json:"matching"`
	Timestamp   int64         `json:"timestamp"`
	Entries     []interface{} `json:"entries"`
}

Context describes a context (primary or secondary)

func (*Context) Evaluate

func (c *Context) Evaluate() (bool, error)

Evaluate evaluates the context against its condition

type ContextTemplate

type ContextTemplate struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Condition   string `json:"condition"`
}

ContextTemplate is used to configure the context component

type Property

type Property struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Group       string   `json:"group"`
	Timestamp   *int64   `json:"t,omitempty"`
	Value       *float64 `json:"v,omitempty"`
	BoolValue   *bool    `json:"bv,omitempty"`
	StringValue *string  `json:"sv,omitempty"`
}

Property describes a context property

func (*Property) GetValue

func (p *Property) GetValue() (interface{}, error)

GetValue returns the value of a Property (the one that is set)

type PropertyTemplate

type PropertyTemplate struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Group    string `json:"group"`
	Template string `json:"template"`
}

PropertyTemplate is used to configure *-property components

func (*PropertyTemplate) Fill

func (pt *PropertyTemplate) Fill(data interface{}) (*Property, error)

Fill fills the template with provided data and returns the resulting property

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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