Documentation ¶
Index ¶
- Variables
- type Repository
- func (r *Repository) Add(agent agents.Agent) error
- func (r *Repository) AddLinkedAgent(id uuid.UUID, link uuid.UUID) error
- func (r *Repository) Exists(id uuid.UUID) bool
- func (r *Repository) Get(id uuid.UUID) (agents.Agent, error)
- func (r *Repository) GetAll() (agents []agents.Agent)
- func (r *Repository) Log(id uuid.UUID, message string) error
- func (r *Repository) Remove(id uuid.UUID) (err error)
- func (r *Repository) RemoveLinkedAgent(id uuid.UUID, link uuid.UUID) error
- func (r *Repository) SetSecret(id uuid.UUID, secret []byte) error
- func (r *Repository) Update(agent agents.Agent) error
- func (r *Repository) UpdateAlive(id uuid.UUID, alive bool) error
- func (r *Repository) UpdateAuthenticated(id uuid.UUID, authenticated bool) error
- func (r *Repository) UpdateBuild(id uuid.UUID, build agents.Build) error
- func (r *Repository) UpdateComms(id uuid.UUID, comms agents.Comms) error
- func (r *Repository) UpdateHost(id uuid.UUID, host agents.Host) error
- func (r *Repository) UpdateInitial(id uuid.UUID, t time.Time) error
- func (r *Repository) UpdateListener(id, listener uuid.UUID) error
- func (r *Repository) UpdateNote(id uuid.UUID, note string) error
- func (r *Repository) UpdateProcess(id uuid.UUID, process agents.Process) error
- func (r *Repository) UpdateStatusCheckin(id uuid.UUID, t time.Time) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrAgentExists = errors.New("the agent already exists in the repository") ErrAgentNotFound = errors.New("the agent was not found in the repository") )
Functions ¶
This section is empty.
Types ¶
type Repository ¶
Repository structure implements an in-memory database that holds a map of agent's the server communicates with
func NewRepository ¶
func NewRepository() *Repository
NewRepository creates and returns a Repository structure that contains an in-memory map of agents
func (*Repository) Add ¶
func (r *Repository) Add(agent agents.Agent) error
Add locks the in-memory database and adds Agent structures to the map
func (*Repository) AddLinkedAgent ¶
AddLinkedAgent updates the Agent's linkedAgents list the contains all child agents for which it is the parent
func (*Repository) Exists ¶
func (r *Repository) Exists(id uuid.UUID) bool
Exists check's to see if the Agent is in the repository
func (*Repository) Get ¶
Get returns a COPY of the Agent entity. The caller should not try to modify the copy as it won't be updated in the repository
func (*Repository) GetAll ¶
func (r *Repository) GetAll() (agents []agents.Agent)
GetAll returns a list of all Agents in the repository
func (*Repository) Log ¶
func (r *Repository) Log(id uuid.UUID, message string) error
Log writes the provided message to the Agent's log file
func (*Repository) Remove ¶
func (r *Repository) Remove(id uuid.UUID) (err error)
Remove deletes the agent from the repository
func (*Repository) RemoveLinkedAgent ¶
RemoveLinkedAgent removed the provided link the Agent's linkedAgents list the contains all child agents for which it is the parent
func (*Repository) SetSecret ¶
func (r *Repository) SetSecret(id uuid.UUID, secret []byte) error
SetSecret updates the agent's secret key, typically derived once authentication has completed and per-agent key has been established.
func (*Repository) Update ¶
func (r *Repository) Update(agent agents.Agent) error
Update replaces the Agent in the repository with the one provided in the function call
func (*Repository) UpdateAlive ¶
func (r *Repository) UpdateAlive(id uuid.UUID, alive bool) error
UpdateAlive updates the Agent's alive field to indicate if it is actively in use or not
func (*Repository) UpdateAuthenticated ¶
func (r *Repository) UpdateAuthenticated(id uuid.UUID, authenticated bool) error
UpdateAuthenticated updates that Agent's authenticated field, typically once authentication has completed
func (*Repository) UpdateBuild ¶
UpdateBuild updates the Agent's build field with the provided Build entity structure
func (*Repository) UpdateComms ¶
UpdateComms updates the Agent's comms field with the provided Comms entity structure
func (*Repository) UpdateHost ¶
UpdateHost updates the Agent's host field with the provided Host entity structure
func (*Repository) UpdateInitial ¶
UpdateInitial updates the Agent's initial field with the provided timestamp
func (*Repository) UpdateListener ¶
func (r *Repository) UpdateListener(id, listener uuid.UUID) error
UpdateListener updates the ID of the listener the Agent is associated with
func (*Repository) UpdateNote ¶
func (r *Repository) UpdateNote(id uuid.UUID, note string) error
UpdateNote updates the Agent's note field with the provided string
func (*Repository) UpdateProcess ¶
UpdateProcess updates the Agent's process field with the provided Process entity structure
func (*Repository) UpdateStatusCheckin ¶
UpdateStatusCheckin updates the Agent's last checkin field with the provided timestamp