memory

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package memory provides an in-memory repository for messages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Repository is the in-memory data structure to store messages

func NewRepository

func NewRepository() *Repository

NewRepository is a factory that returns an instantiated in-memory repository

func (*Repository) Add

func (r *Repository) Add(message *message.Message)

Add stores a message in the Repository

func (*Repository) Get

func (r *Repository) Get(id uuid.UUID) (msg *message.Message, err error)

Get retrieves a message by its ID

func (*Repository) GetAll

func (r *Repository) GetAll() (messages []*message.Message)

GetAll returns all messages

func (*Repository) GetQueue

func (r *Repository) GetQueue() *message.Message

GetQueue returns a channel to recieve messages from

Jump to

Keyboard shortcuts

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