Documentation ¶
Overview ¶
Package buffer links an input and an output together and buffers messages in between.
Index ¶
- Variables
- func Descriptions() string
- func SanitiseConfig(conf Config) (interface{}, error)
- type Config
- type Empty
- type Parallel
- type ParallelWrapper
- type Single
- type SingleWrapper
- type Type
- func New(conf Config, log log.Modular, stats metrics.Type) (Type, error)
- func NewBadger(config Config, log log.Modular, stats metrics.Type) (Type, error)
- func NewEmpty(config Config, log log.Modular, stats metrics.Type) (Type, error)
- func NewMemory(config Config, log log.Modular, stats metrics.Type) (Type, error)
- func NewMmapFile(config Config, log log.Modular, stats metrics.Type) (Type, error)
- func NewParallelWrapper(conf Config, buffer Parallel, log log.Modular, stats metrics.Type) Type
- func NewSingleWrapper(conf Config, buffer Single, log log.Modular, stats metrics.Type) Type
- type TypeSpec
Constants ¶
This section is empty.
Variables ¶
var Constructors = map[string]TypeSpec{}
Constructors is a map of all buffer types with their specs.
Functions ¶
func Descriptions ¶
func Descriptions() string
Descriptions returns a formatted string of collated descriptions of each type.
func SanitiseConfig ¶
SanitiseConfig returns a sanitised version of the Config, meaning sections that aren't relevant to behaviour are removed.
Types ¶
type Config ¶
type Config struct { Type string `json:"type" yaml:"type"` Badger parallel.BadgerConfig `json:"badger" yaml:"badger"` Memory single.MemoryConfig `json:"memory" yaml:"memory"` Mmap single.MmapBufferConfig `json:"mmap_file" yaml:"mmap_file"` None struct{} `json:"none" yaml:"none"` }
Config is the all encompassing configuration struct for all input types.
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
Empty is an empty buffer, simply forwards messages on directly.
func (*Empty) CloseAsync ¶
func (e *Empty) CloseAsync()
CloseAsync shuts down the StackBuffer output and stops processing messages.
func (*Empty) ErrorsChan ¶
ErrorsChan returns the errors channel.
func (*Empty) StartReceiving ¶
func (e *Empty) StartReceiving(msgs <-chan types.Transaction) error
StartReceiving assigns a messages channel for the output to read.
func (*Empty) TransactionChan ¶
func (e *Empty) TransactionChan() <-chan types.Transaction
TransactionChan returns the channel used for consuming messages from this input.
type Parallel ¶
type Parallel interface { // NextMessage reads the next oldest message, the message is preserved until // the returned AckFunc is called. NextMessage() (types.Message, parallel.AckFunc, error) // PushMessage adds a new message to the stack. Returns the backlog in // bytes. PushMessage(types.Message) (int, error) // CloseOnceEmpty closes the Buffer once the buffer has been emptied, this // is a way for a writer to signal to a reader that it is finished writing // messages, and therefore the reader can close once it is caught up. This // call blocks until the close is completed. CloseOnceEmpty() // Close closes the Buffer so that blocked readers or writers become // unblocked. Close() }
Parallel represents a method of buffering sequential messages, supporting only a single consumer.
type ParallelWrapper ¶
type ParallelWrapper struct {
// contains filtered or unexported fields
}
ParallelWrapper wraps a buffer with a Producer/Consumer interface.
func (*ParallelWrapper) CloseAsync ¶
func (m *ParallelWrapper) CloseAsync()
CloseAsync shuts down the ParallelWrapper and stops processing messages.
func (*ParallelWrapper) StartReceiving ¶
func (m *ParallelWrapper) StartReceiving(msgs <-chan types.Transaction) error
StartReceiving assigns a messages channel for the output to read.
func (*ParallelWrapper) TransactionChan ¶
func (m *ParallelWrapper) TransactionChan() <-chan types.Transaction
TransactionChan returns the channel used for consuming messages from this buffer.
func (*ParallelWrapper) WaitForClose ¶
func (m *ParallelWrapper) WaitForClose(timeout time.Duration) error
WaitForClose blocks until the ParallelWrapper output has closed down.
type Single ¶
type Single interface { // ShiftMessage removes the oldest message from the stack. Returns the // backlog in bytes. ShiftMessage() (int, error) // NextMessage reads the oldest message, the message is preserved until // ShiftMessage is called. NextMessage() (types.Message, error) // PushMessage adds a new message to the stack. Returns the backlog in // bytes. PushMessage(types.Message) (int, error) // CloseOnceEmpty closes the Buffer once the buffer has been emptied, this // is a way for a writer to signal to a reader that it is finished writing // messages, and therefore the reader can close once it is caught up. This // call blocks until the close is completed. CloseOnceEmpty() // Close closes the Buffer so that blocked readers or writers become // unblocked. Close() }
Single represents a method of buffering sequential messages, supporting only a single consumer.
type SingleWrapper ¶
type SingleWrapper struct {
// contains filtered or unexported fields
}
SingleWrapper wraps a buffer with a Producer/Consumer interface.
func (*SingleWrapper) CloseAsync ¶
func (m *SingleWrapper) CloseAsync()
CloseAsync shuts down the SingleWrapper and stops processing messages.
func (*SingleWrapper) StartReceiving ¶
func (m *SingleWrapper) StartReceiving(msgs <-chan types.Transaction) error
StartReceiving assigns a messages channel for the output to read.
func (*SingleWrapper) TransactionChan ¶
func (m *SingleWrapper) TransactionChan() <-chan types.Transaction
TransactionChan returns the channel used for consuming messages from this buffer.
func (*SingleWrapper) WaitForClose ¶
func (m *SingleWrapper) WaitForClose(timeout time.Duration) error
WaitForClose blocks until the SingleWrapper output has closed down.
type Type ¶
Type is the standard interface of an agent type.
func NewMmapFile ¶
NewMmapFile creates a buffer held in memory and persisted to file through memory map.
func NewParallelWrapper ¶
NewParallelWrapper creates a new Producer/Consumer around a buffer.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package parallel contains implementations of various buffer types where the buffer can be consumed by any number of parallel consumer threads.
|
Package parallel contains implementations of various buffer types where the buffer can be consumed by any number of parallel consumer threads. |
Package single contains implementations of various buffer types where the buffer can only be consumed by a single thread (but any number of writers).
|
Package single contains implementations of various buffer types where the buffer can only be consumed by a single thread (but any number of writers). |