Documentation ¶
Overview ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License 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.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License 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.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License 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.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License 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.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License 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.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License 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.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License 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
- Variables
- func DeleteDeployment(userId string, deploymentId string) error
- func DeleteRuleChain(userId string, chainId string) error
- func GetRuleChainMetadata(userId string, chainId string) ([]byte, error)
- func Initialize()
- func SaveRuleChain(userId string, chain *RuleChain) error
- func SaveRuleChainMetadata(userId string, chainId string, metadata []byte) error
- func SetDeploymentStatus(userId string, deploymentId string, status string) error
- func UpdateDeployment(userId string, deployment *Deployment) error
- type Deployment
- type Message
- type Metadata
- type Model
- type Query
- type Reader
- type ReaderObserver
- type RuleChain
Constants ¶
const ( DEPLOYMENT_STATUS_CREATED = "created" DEPLOYMENT_STATUS_RUNNING = "running" DEPLOYMENT_STATUS_STOPPED = "stopped" DEPLOYMENT_STATUS_UNKNOWN = "unknown" )
const ( METADATA_DEVICE_TYPE = "deviceType" METADATA_DEVICE_NAME = "deviceName" METADATA_REQUEST_ID = "requestId" METADATA_USER_NAME = "userName" METADATA_USER_ID = "userId" METADATA_TIMESTAMP = "timestamp" )
Predefined metadata key
const ( MESSAGE_TYPE_POST_ATTRIBUTES_REQUEST = "Post attributes" MESSAGE_TYPE_POST_TELEMETRY_REQUEST = "Post telemetry" MESSAGE_TYPE_ACTIVITY_EVENT = "Activity event" MESSAGE_TYPE_INACTIVITY_EVENT = "Inactivity event" MESSAGE_TYPE_CONNECT_EVENT = "Connect event" MESSAGE_TYPE_DISCONNECT_EVENT = "Disconnect event" )
Predefined message types
const ( ModelActionCreated = "created" ModelActionUpdated = "updated" ModelActionDeleted = "deleted" )
const ( RULESTATUS_CREATED = "created" RULESTATUS_STARTED = "started" RULESTATUS_STOPPED = "stopped" RULESTATUS_UNKNOWN = "unknown" )
Variables ¶
Functions ¶
func DeleteDeployment ¶
DeleteDeployment delete an existed deployment and notify peer nodes
func DeleteRuleChain ¶
Delete will delete a specified rule chain
func GetRuleChainMetadata ¶
GetRuleChainMetadata return a chain's metadata
func Initialize ¶
func Initialize()
Initialize initialize the models environment, a global repository must be created successfully
func SaveRuleChain ¶
SaveRuleChain update an existed rule chain
func SaveRuleChainMetadata ¶
SaveRuleChainMetadata will save a rule chain's metadata
func SetDeploymentStatus ¶
SetDeploymentStatus set a deployment status according to user's request
func UpdateDeployment ¶
func UpdateDeployment(userId string, deployment *Deployment) error
UpdateDeployment update an existed deployment
Types ¶
type Deployment ¶
type Deployment struct { gorm.Model UserId string `json:"userId" yaml:"userId" gorm:"size:255"` Name string `json:"name" yaml:"name" gorm:"size:255"` RuleChainId string `json:"ruleChainId" yaml:"ruleChainId" gorm:type:vchar(100)` Reader string `json:"reader" yaml:"reader"` ReaderConfigs map[string]string `json:"readerConfigs" yaml:"readerConfigs"` Status string `json:"status" yaml:"status"` CreatedAt *time.Time `json:"createdAt" yaml:"createdAt"` Id string `json:"id" yaml:"id" gorm:"type:vchar(100),unique_index"` }
func AddDeployment ¶
func AddDeployment(userId string, deployment *Deployment) (*Deployment, error)
AddDeployment create a new deployment
func GetDeployment ¶
func GetDeployment(userId string, deploymentId string) (*Deployment, error)
GetDeploynent return a specified deployment
func ListDeployments ¶
func ListDeployments(query Query) ([]*Deployment, error)
ListDeployments return all deployments
func (Deployment) Path ¶
func (obj Deployment) Path() string
type Message ¶
type Message interface { GetId() string GetOriginator() string GetType() string GetPayload() []byte GetMetadata() Metadata SetType(string) SetPayload([]byte) SetMetadata(Metadata) SetOriginator(string) }
func NewMessage ¶
func NewMessage() Message
type Metadata ¶
type Metadata interface { Keys() []string GetKeyValue(key string) interface{} SetKeyValue(key string, val interface{}) }
func NewMetadata ¶
func NewMetadata() Metadata
type Reader ¶
type Reader interface { Name() string Config() map[string]interface{} Start() error RegisterObserver(ReaderObserver) GracefulShutdown() error }
type ReaderObserver ¶
type RuleChain ¶
type RuleChain struct { gorm.Model DebugMode bool `json:"debugMode" yaml:"debugMode"` Description string `json:"description" yaml:"description" gorm:"size:255"` Name string `json:"name" yaml:"name" gorm:"size:255"` Id string `json:"chainId" yaml:"chainId" gorm:"size:100,unique_index"` UserId string `json:"userId" yaml:"userId" gorm:"size:255"` Type string `json:"type" yaml:"type" gorm:"type:char(100)"` Domain string `json:"domain" yaml:"domain"` Status string `json:"status" yaml:"status"` Metadata []byte `json:"metadata" yaml:"metadata"` Root bool `json:"bool" yaml:"bool"` }
func GetRuleChain ¶
GetRuleChain return a specified rule chain
func ListRuleChains ¶
ListRuleChains return a user's rule chains