shared

package
v0.0.0-...-8923af6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyOperationResult   = errors.New("empty operation result")
	ErrInvalidOperationResult = errors.New("invalid operation result")
)
View Source
var (
	CreatedOperation = Operation("created")
	UpdatedOperation = Operation("updated")
	DeletedOperation = Operation("deleted")
)
View Source
var (
	HubStream  = goka.Stream("Hub")  // Hubmessages Entity-> Hub
	HubGroup   = goka.Group("Hub")   // Hubmessages Entity-> Hub
	InputGroup = goka.Group("Input") // Neo4jMessages  -> Incoming
)
View Source
var (
	Neo4jDriver neo4j.Driver
)

Functions

func ComposeKey

func ComposeKey(label string, id int64) string

func RandStringBytes

func RandStringBytes(n int) string

Types

type BaseDescriptor

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

func NewBaseDescriptor

func NewBaseDescriptor(label string) *BaseDescriptor

func (*BaseDescriptor) EventGroup

func (p *BaseDescriptor) EventGroup() goka.Group

func (*BaseDescriptor) EventInputStream

func (p *BaseDescriptor) EventInputStream() goka.Stream

func (*BaseDescriptor) EventOutputStream

func (p *BaseDescriptor) EventOutputStream() goka.Stream

func (*BaseDescriptor) HubGroup

func (p *BaseDescriptor) HubGroup() goka.Group

func (*BaseDescriptor) HubInputStream

func (p *BaseDescriptor) HubInputStream() goka.Stream

func (*BaseDescriptor) HubOutputStream

func (p *BaseDescriptor) HubOutputStream() goka.Stream

func (*BaseDescriptor) Label

func (p *BaseDescriptor) Label() string

type ChainHandledState

type ChainHandledState int
const (
	ChainHandledStateThenFailed ChainHandledState = iota
	ChainHandledStateElseFailed
	ChainHandledStateUnhandled
	ChainHandledStateThen
	ChainHandledStateElse
)

func (ChainHandledState) Failed

func (p ChainHandledState) Failed() bool

func (ChainHandledState) String

func (i ChainHandledState) String() string

type ChangeInfo

type ChangeInfo struct {
	Before interface{} `json:"before"`
	After  interface{} `json:"after"`
}

func (ChangeInfo) Created

func (p ChangeInfo) Created() bool

func (ChangeInfo) Deleted

func (p ChangeInfo) Deleted() bool

func (ChangeInfo) Updated

func (p ChangeInfo) Updated() bool

type ChangeInfos

type ChangeInfos map[string]ChangeInfo

func (ChangeInfos) Created

func (p ChangeInfos) Created(field string) bool

func (ChangeInfos) Deleted

func (p ChangeInfos) Deleted(field string) bool

func (ChangeInfos) Updated

func (p ChangeInfos) Updated(field string) bool

type ContextDefinition

type ContextDefinition map[string]CypherQuery

type CypherQuery

type CypherQuery string

func (CypherQuery) String

func (p CypherQuery) String() string

type DispatcherFunc

type DispatcherFunc func(ctx context.Context, kServers, zServers []string) func() error

type EntityContext

type EntityContext struct {
	NodeID  int64
	Context map[string]Properties
}

func (*EntityContext) Append

func (p *EntityContext) Append(key string, prop Properties)

type EntityDescriptor

type EntityDescriptor interface {
	HubInputStream() goka.Stream
	HubOutputStream() goka.Stream
	HubGroup() goka.Group
	EventInputStream() goka.Stream
	EventOutputStream() goka.Stream
	EventGroup() goka.Group
	ContextDef() ContextDefinition
	Label() string
}

type ErrorHandler

type ErrorHandler func(err error)

type ErrorHandlers

type ErrorHandlers []ErrorHandler

type EvalFunc

type EvalFunc func(arg interface{}) bool

type EvalFuncs

type EvalFuncs []EvalFunc

type EventContext

type EventContext struct {
	TimeStamp   time.Time   `json:"time_stamp"`
	Operation   Operation   `json:"operation"`
	NodeID      int64       `json:"node_id"`
	ChangeInfos ChangeInfos `json:"change_infos"`
	Properties  Properties  `json:"properties"`
}

func (*EventContext) BuildChanges

func (p *EventContext) BuildChanges(before bool, props map[string]interface{})

func (*EventContext) Match

func (p *EventContext) Match(

	operation Operation,
	fieldName string,
	fieldOperation Operation,
	conditions EvalFuncs,

) bool

type EventContextCodec

type EventContextCodec struct{}

func (*EventContextCodec) Decode

func (p *EventContextCodec) Decode(data []byte) (interface{}, error)

func (*EventContextCodec) Encode

func (p *EventContextCodec) Encode(value interface{}) ([]byte, error)

type Executor

type Executor struct {
	*HandlerContext
}

func NewExecutor

func NewExecutor(ctx *HandlerContext) *Executor

func (*Executor) ApplyProperties

func (p *Executor) ApplyProperties(nodeID int64, ctx Properties) error

func (*Executor) BuildEntityContext

func (p *Executor) BuildEntityContext(nodeID int64) (*EntityContext, error)

func (*Executor) NotifySuperOrdinates

func (p *Executor) NotifySuperOrdinates(

	sender string,
	senderID int64,
	operation Operation,
	props Properties,

) error

func (*Executor) Run

func (p *Executor) Run(cypher CypherQuery, ctx Properties, onRecord OnRecordFunc) error

type Handler

type Handler func(ctx *HandlerContext) error

type HandlerContext

type HandlerContext struct {
	GokaContext      goka.Context
	EntityDescriptor EntityDescriptor
	EventContext     *EventContext
	HubContext       *HubContext
	// contains filtered or unexported fields
}

func (*HandlerContext) Get

func (p *HandlerContext) Get(key string) interface{}

func (*HandlerContext) GetEntityContext

func (p *HandlerContext) GetEntityContext() *EntityContext

func (*HandlerContext) Set

func (p *HandlerContext) Set(key string, value interface{})

type Handlers

type Handlers []Handler

type HubContext

type HubContext struct {
	Sender     string     `json:"sender"`
	SenderID   int64      `json:"sender_id"`
	Operation  Operation  `json:"operation"`
	Receiver   string     `json:"receiver"`
	ReceiverID int64      `json:"receiver_id"`
	Properties Properties `json:"properties"`
}

func (*HubContext) Match

func (p *HubContext) Match(

	operation Operation,
	sender string,
	conditions EvalFuncs,

) bool

type HubContextCodec

type HubContextCodec struct{}

func (*HubContextCodec) Decode

func (p *HubContextCodec) Decode(data []byte) (interface{}, error)

func (*HubContextCodec) Encode

func (p *HubContextCodec) Encode(value interface{}) ([]byte, error)

type Matcher

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

func NewMatcher

func NewMatcher(fns ...MatcherFunc) *Matcher

func (*Matcher) Eval

func (p *Matcher) Eval(arg interface{}) bool

type MatcherFunc

type MatcherFunc func() (bool, EvalFunc)

func MatchConditions

func MatchConditions(conditions ...EvalFunc) MatcherFunc

type OnRecordFunc

type OnRecordFunc func(rec neo4j.Record) error

type Operation

type Operation string

type Operations

type Operations []Operation

type Properties

type Properties map[string]interface{}

func (Properties) MustBool

func (p Properties) MustBool(field string) bool

func (Properties) MustGet

func (p Properties) MustGet(field string) interface{}

func (Properties) MustInt64

func (p Properties) MustInt64(field string) int64

func (Properties) MustString

func (p Properties) MustString(field string) string

Jump to

Keyboard shortcuts

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