context

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package context defines the global context object used by Netrix.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RootContext

type RootContext struct {
	// Config and instance of the configuration object
	Config *config.Config
	// EventIDGen a thread safe counter to generate event ids
	EventIDGen *util.Counter
	// Replicas instance of the ReplicaStore which contains information of all the replicas
	Replicas *types.ReplicaStore
	// MessageQueue stores the messages that are _intercepted_ as a queue
	MessageQueue *types.Queue[*types.Message]
	// MessageStore stores the messages that are _intercepted_ as a map
	MessageStore *types.Map[types.MessageID, *types.Message]
	// EventQueue stores the events sent by the replicas as a queue
	EventQueue *types.Queue[*types.Event]
	// Logger for logging purposes
	Logger *log.Logger
	// ReportStore contains a log of important events
	ReportStore *types.ReportLogs
}

RootContext stores the context of the scheduler

func NewRootContext

func NewRootContext(config *config.Config, logger *log.Logger) *RootContext

NewRootContext creates an instance of the RootContext from the configuration

func (*RootContext) PauseQueues added in v0.2.1

func (c *RootContext) PauseQueues()

PauseQueues invokes types.Queue.Pause on the message and event queues

func (*RootContext) Reset

func (c *RootContext) Reset()

Reset implements Service

func (*RootContext) ResumeQueues added in v0.2.1

func (c *RootContext) ResumeQueues()

ResumeQueues invokes types.Queue.Resume on the message and event queues

func (*RootContext) Start

func (c *RootContext) Start()

Start implements Service and initializes the queues

func (*RootContext) Stop

func (c *RootContext) Stop()

Stop implements Service and terminates the queues

Jump to

Keyboard shortcuts

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