agents

package
v0.2.4-rc5 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: BSD-2-Clause, Unlicense Imports: 19 Imported by: 0

Documentation

Overview

A simple agent that notices blackboard changing

Concludes by putting a future call to itself back into the slipnet controller A more general, non slipnet specific version may be better in the future. for now we stay narrow. Cognitive clock?

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchA2ALatency100MiB

func BenchA2ALatency100MiB(b *B)

func BenchA2ALatency10MiB

func BenchA2ALatency10MiB(b *B)

func BenchA2ALatency1GiB

func BenchA2ALatency1GiB(b *B)

func BenchA2ALatency1KiB

func BenchA2ALatency1KiB(b *B)

func BenchA2ALatency1MiB

func BenchA2ALatency1MiB(b *B)

func BenchA2ALatency4KiB

func BenchA2ALatency4KiB(b *B)

func BenchAgentBBLatency

func BenchAgentBBLatency(b *B)

Benchmark 2: Agent to BB latency

func BenchAgentOverhead

func BenchAgentOverhead(b *B)

func GetAgentPipe

func GetAgentPipe(bb_addr string, tags ...string) (snd *PipeSender, rcv *PipeReceiver)

Get sender and receiver connected by the provided tags

func RandStringRunes

func RandStringRunes(n int) string

Types

type B

type B struct {
	Name string
	N    int           // the number of iterations
	T    time.Duration // total time taken
	Err  error         // any returned errors
	// contains filtered or unexported fields
}

type BFunc

type BFunc func(b *B)

We roughly mimic the basics of Go's benchmarking structure

type BufferedMessage

type BufferedMessage struct {
	Sender  string
	Message string
	Tags    []string
}

type ChangeAgent

type ChangeAgent struct {
	LastHash string
	*client.BasicAgent
	// contains filtered or unexported fields
}

func NewChangeAgent

func NewChangeAgent(addr string, n_msg int) *ChangeAgent

Change agent is a "meta" agent monitoring blackboard state

func (*ChangeAgent) Loop

func (agt *ChangeAgent) Loop() (cont bool, err error)

This agent starts, does it job, then dies

func (*ChangeAgent) Setup

func (agt *ChangeAgent) Setup() error

type ChatAgent

type ChatAgent struct {
	*client.BasicAgent
	// contains filtered or unexported fields
}

func (*ChatAgent) GUICompleted

func (c *ChatAgent) GUICompleted() chan struct{}

func (*ChatAgent) Loop

func (c *ChatAgent) Loop() (bool, error)

func (*ChatAgent) SetModeLine

func (c *ChatAgent) SetModeLine(msg string)

func (*ChatAgent) SetTags

func (c *ChatAgent) SetTags(tags []string)

func (*ChatAgent) Setup

func (c *ChatAgent) Setup() error

func (*ChatAgent) TriggerRedraw

func (c *ChatAgent) TriggerRedraw()

type NetworkBenchmarkAgent

type NetworkBenchmarkAgent struct {
	*client.BasicAgent
	// contains filtered or unexported fields
}

func (*NetworkBenchmarkAgent) Loop

func (a *NetworkBenchmarkAgent) Loop() (cont bool, err error)

NetworkBenchmarkAgent runs all of our network benchmarks and reports results to the blackboard No statistics possible with this approach though (just tracking total time)

func (*NetworkBenchmarkAgent) Setup

func (a *NetworkBenchmarkAgent) Setup() error

type PingAgent

type PingAgent struct {
	*client.BasicAgent
	// contains filtered or unexported fields
}

func (*PingAgent) Loop

func (a *PingAgent) Loop() (cont bool, err error)

In this low-level implementation, we don't **need** to use the ManagedAgent loop to handle anything, other than to keep the program running. However, if you'd like a more "well-behaved" Agent that shuts down nicely, you have to include a select statement for the done channel as is done below.

func (*PingAgent) OnNewMessage

func (a *PingAgent) OnNewMessage(msg *core.Message)

Downside: exposes users to the proto interface (was trying to keep more high level, restrict to just the Post type)

Downside: Loop and Setup don't really do anything since OnNewMessage is just invoked whenever a message arrives. Kind of obviates the need for a "ManagedAgent" style interface in the Go API. Definitely feels "lower level" than the ListenFor approach.

func (*PingAgent) Setup

func (a *PingAgent) Setup() error

type PingAgent2

type PingAgent2 struct {
	*client.BasicAgent
	// contains filtered or unexported fields
}

func (*PingAgent2) Loop

func (a *PingAgent2) Loop() (cont bool, err error)

In this low-level implementation, we don't need to use the ManagedAgent loop to handle anything, other than to keep the program running.

func (*PingAgent2) Setup

func (a *PingAgent2) Setup() error

type PipeReceiver

type PipeReceiver struct {
	*client.BasicAgent
	// contains filtered or unexported fields
}

func (*PipeReceiver) Receive

func (a *PipeReceiver) Receive(timeout time.Duration) ([]byte, error)

type PipeSender

type PipeSender struct {
	*client.BasicAgent
	// contains filtered or unexported fields
}

This agent pipe structure is supposed to be a super lightweight set of connected agents with send and receive tags already set up. It's more "udp" in nature in that we eschew error handling and let it fly

I think these agents will leak goroutines TODO: we need a way pass anything that inherits from a BasicAgent and kill any running goroutines

func (*PipeSender) Send

func (a *PipeSender) Send(data []byte)

type PongAgent

type PongAgent struct {
	*client.BasicAgent
	// contains filtered or unexported fields
}

func (*PongAgent) Loop

func (a *PongAgent) Loop() (cont bool, err error)

Pong listens for Pings and replies with pongs

func (*PongAgent) Setup

func (a *PongAgent) Setup() error

Jump to

Keyboard shortcuts

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