fbcontext

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Code generated by mockery v1.0.0. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context is the default implementation of a firebolt context.

func (*Context) AckMessage

func (c *Context) AckMessage(msg Message) error

AckMessage acknowledges receipt of a Message; it will not be redelivered.

func (*Context) ConfigureLeader

func (c *Context) ConfigureLeader(leader func() bool)

ConfigureLeader adds handler for returning leader election results.

func (*Context) ConfigureMessaging

func (c *Context) ConfigureMessaging(send MessageFunc, ack MessageFunc)

ConfigureMessaging adds send and ack handlers for delivering and acknowledging messages.

func (*Context) InstanceID

func (c *Context) InstanceID() string

InstanceID returns the unique ID of this application instance.

func (*Context) IsLeader

func (c *Context) IsLeader() bool

IsLeader indicates whether this instance is currently the cluster leader as determined by a leader election. If zookeeper was not configured, this will always return false.

func (*Context) SendMessage

func (c *Context) SendMessage(msg Message) error

SendMessage sends a Message using the configured internaldata transport.

type ContextAware

type ContextAware struct {
	ID string

	Ctx FBContext
	// contains filtered or unexported fields
}

ContextAware is intended to be embedded in Node types to provide the node's application code with access to execution context.

func (*ContextAware) AcceptsMessage

func (c *ContextAware) AcceptsMessage(messageType string) bool

AcceptsMessage is used when delivering messages to determine if a Source/Node requests delivery of messages with a given messageType.

func (*ContextAware) Init

func (c *ContextAware) Init(id string, ctx FBContext)

Init provides a new Source/Node with its execution context.

func (*ContextAware) Subscribe

func (c *ContextAware) Subscribe(messageTypes []string)

Subscribe sets the message types that this node will accept.

type FBContext

type FBContext interface {
	ConfigureMessaging(send MessageFunc, ack MessageFunc)
	ConfigureLeader(leader func() bool)
	SendMessage(msg Message) error
	AckMessage(msg Message) error
	IsLeader() bool
	InstanceID() string
}

FBContext is a firebolt context. It provides a source/node with access to inter-node or global operations. Currently it supports sending messages to other source/nodes (across the cluster) and acknowledging receipt of those messages. After any changes, regenerate the mock with:

mockery -name FBContext -inpkg .

func NewFBContext

func NewFBContext(instanceID func() string) FBContext

NewFBContext creates a firebolt context with default/dummy implementations

type Message

type Message struct {
	MessageType string
	Key         string `json:"key"`
	Payload     []byte `json:"payload"`
}

Message is the context representation of a 'message.Message'. Message depends on node.kafkaconsumer, so node must not depend on message.

type MessageFunc

type MessageFunc func(msg Message) error

MessageFunc is a function supplied by Executor, which uses them to relay messages to the target source/node

type MockFBContext

type MockFBContext struct {
	mock.Mock
}

MockFBContext is an autogenerated mock type for the FBContext type

func (*MockFBContext) AckMessage

func (_m *MockFBContext) AckMessage(msg Message) error

AckMessage provides a mock function with given fields: msg

func (*MockFBContext) ConfigureLeader

func (_m *MockFBContext) ConfigureLeader(leader func() bool)

ConfigureLeader provides a mock function with given fields: leader

func (*MockFBContext) ConfigureMessaging

func (_m *MockFBContext) ConfigureMessaging(send MessageFunc, ack MessageFunc)

ConfigureMessaging provides a mock function with given fields: send, ack

func (*MockFBContext) InstanceID

func (_m *MockFBContext) InstanceID() string

InstanceID provides a mock function with given fields:

func (*MockFBContext) IsLeader

func (_m *MockFBContext) IsLeader() bool

IsLeader provides a mock function with given fields:

func (*MockFBContext) SendMessage

func (_m *MockFBContext) SendMessage(msg Message) error

SendMessage provides a mock function with given fields: msg

Jump to

Keyboard shortcuts

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