machine

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 9 Imported by: 13

README

Closures logo

Go GoDoc Codacy Badge Codacy Badge

Machine is a


Usage Overview

Usage




Want more?

If you were hoping to see an API converted using closures and came up empty handed, there's a chance all can be right. Simply vote on a feature by adding a 👍 reaction.


License

Machine is provided under the APL 2.0 License.

Copyright 2020 jonathan whitaker

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder builder type for starting a machine

func New

func New(id, name string, fifo bool, i Initium) *Builder

New func for providing an instance of Builder

func (*Builder) Build

func (m *Builder) Build(bufferSize int, recorders ...func(string, string, []*Packet)) *Machine

Build func for providing the underlying machine

func (*Builder) Route

func (m *Builder) Route(r *RouterBuilder) *Builder

Route func for sending the payload to a router

func (*Builder) Terminate

func (m *Builder) Terminate(t *TerminationBuilder) *Builder

Terminate func for sending the payload to a cap

func (*Builder) Then

func (m *Builder) Then(v *VertexBuilder) *Builder

Then func for sending the payload to a processor

type Initium

type Initium func(context.Context) chan []map[string]interface{}

Initium type for providing the data to flow into the system

type Machine

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

Machine execution graph for a system

func (*Machine) ID

func (m *Machine) ID() string

ID func to return the ID

func (*Machine) Inject

func (m *Machine) Inject(logs map[string][]*Packet)

Inject func to inject the logs into the machine

func (*Machine) Run

func (m *Machine) Run(ctx context.Context) error

Run func to start the Machine

type Packet

type Packet struct {
	ID    string
	Data  map[string]interface{}
	Error error
}

Packet type that holds information traveling through the machine

type Processus

type Processus func(map[string]interface{}) error

Processus type for applying a change to a context

type RouteHandler

type RouteHandler func(list []*Packet) (t, f []*Packet)

RouteHandler func for splitting a payload into 2

type RouterBuilder

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

RouterBuilder builder type for adding a router to the machine

func NewRouter

func NewRouter(id, name string, fifo bool, r RouteHandler) *RouterBuilder

NewRouter func for providing an instance of RouterBuilder

func (*RouterBuilder) RouteLeft

func (m *RouterBuilder) RouteLeft(left *RouterBuilder) *RouterBuilder

RouteLeft func for sending the payload to a router

func (*RouterBuilder) RouteRight

func (m *RouterBuilder) RouteRight(right *RouterBuilder) *RouterBuilder

RouteRight func for sending the payload to a router

func (*RouterBuilder) TerminateLeft

func (m *RouterBuilder) TerminateLeft(t *TerminationBuilder) *RouterBuilder

TerminateLeft func for sending the payload to a cap

func (*RouterBuilder) TerminateRight

func (m *RouterBuilder) TerminateRight(t *TerminationBuilder) *RouterBuilder

TerminateRight func for sending the payload to a cap

func (*RouterBuilder) ThenLeft

func (m *RouterBuilder) ThenLeft(left *VertexBuilder) *RouterBuilder

ThenLeft func for sending the payload to a processor

func (*RouterBuilder) ThenRight

func (m *RouterBuilder) ThenRight(right *VertexBuilder) *RouterBuilder

ThenRight func for sending the payload to a processor

type RouterDuplicate

type RouterDuplicate struct{}

RouterDuplicate type for splitting errors from successes

func (RouterDuplicate) Handler

func (d RouterDuplicate) Handler(payload []*Packet) (a, b []*Packet)

Handler func for providing a RouteHandler

type RouterError

type RouterError struct{}

RouterError type for splitting errors from successes

func (RouterError) Handler

func (e RouterError) Handler(payload []*Packet) (s, f []*Packet)

Handler func for providing a RouteHandler

type RouterRule

type RouterRule func(map[string]interface{}) bool

RouterRule type for validating a context at the beginning of a Machine

func (RouterRule) Handler

func (r RouterRule) Handler(payload []*Packet) (t, f []*Packet)

Handler func for providing a RouteHandler

type TerminationBuilder

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

TerminationBuilder builder type for adding a termination to the machine

func NewTermination

func NewTermination(id, name string, fifo bool, t Terminus) *TerminationBuilder

NewTermination func for providing an instance of TerminationBuilder

type Terminus

type Terminus func([]map[string]interface{}) error

Terminus type for ending a chain and returning an error if exists

type VertexBuilder

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

VertexBuilder builder type for adding a processor to the machine

func NewVertex

func NewVertex(id, name string, fifo bool, p Processus) *VertexBuilder

NewVertex func for providing an instance of VertexBuilder

func (*VertexBuilder) Route

Route func for sending the payload to a router

func (*VertexBuilder) Terminate

Terminate func for sending the payload to a cap

func (*VertexBuilder) Then

Then func for sending the payload to a processor

Directories

Path Synopsis
cmd module
common module
edge
http module
pubsub module
telemetry module

Jump to

Keyboard shortcuts

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