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: 3 Imported by: 0

Documentation

Overview

Package memory is an in-memory database used to store and retrieve groups

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGroupNotFound = errors.New("pkg/group/memory: the group was not found in the repository")
)

Functions

This section is empty.

Types

type Repository

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

Repository is a structure that implements the group package's Repository interface

func NewRepository

func NewRepository() *Repository

NewRepository is a factory that returns a structure that implements the group package's Repository interface

func (*Repository) AddAgent

func (r *Repository) AddAgent(group string, id uuid.UUID) error

AddAgent will add the provided Agent ID to the provided group name. If the group name does not exist, it will be created.

func (*Repository) Groups

func (r *Repository) Groups() (groups []string)

Groups returns a list of all the created groups

func (*Repository) Members

func (r *Repository) Members() (members map[string][]uuid.UUID)

Members returns a list of lists that contains all created groups and their Agent members

func (*Repository) RemoveAgent

func (r *Repository) RemoveAgent(group string, id uuid.UUID) error

RemoveAgent removes an agent from a group

Jump to

Keyboard shortcuts

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