Documentation
¶
Index ¶
- Constants
- func ChatTime() string
- func Colorize(color int, text string) string
- func LogLevel() string
- func Prompt(prompt string) string
- func SetLogLevel(level uint8)
- func SetLogger(l *log.Logger)
- func ShutdownSignal(shutdown func() error)
- type Benchmark
- type ChatBox
- type Console
- type HelpWidget
- type Messages
- type Ramble
- type Widget
Constants ¶
const ( LogTrace uint8 = iota LogDebug LogInfo LogCaution LogStatus LogWarn LogSilent )
Levels for implementing the debug and trace message functionality.
const ( MsgsView = "messages" ChatView = "chatbox" HelpView = "helpbox" HistorySize = 150 )
View names for the major layout components
const CautionThreshold = 5
CautionThreshold for issuing caution logs after accumulating cautions.
const PackageVersion = "1.1"
PackageVersion of the Ramble app
const ServerName = "server"
ServerName is reserved for use by system messages
Variables ¶
This section is empty.
Functions ¶
func ChatTime ¶
func ChatTime() string
ChatTime returns the current timestamp formatted for the chat window.
func LogLevel ¶
func LogLevel() string
LogLevel returns a string representation of the current level
func SetLogLevel ¶
func SetLogLevel(level uint8)
SetLogLevel modifies the log level for messages at runtime. Ensures that the highest level that can be set is the trace level.
func SetLogger ¶
SetLogger sets the logger for writing output to. Can set to a noplog to remove all log messages (or set the log level to silent).
func ShutdownSignal ¶
func ShutdownSignal(shutdown func() error)
ShutdownSignal allows the registration of a a function to be called when SIGINT (CTRL+C) or SIGTERM is sent to the process, after which os.Exit is called with 0 if the function does not return an error or 1 if it does.
Types ¶
type Benchmark ¶
type Benchmark struct {
// contains filtered or unexported fields
}
Benchmark implements several go routines sending chat messages in their own connections concurrently for a fixed number of messages, then returns the observed throughput from the client side.
func NewBenchmark ¶
NewBenchmark creates the benchmark for the specified number of clients and number of messages per client, then runs the benchmark.
func (*Benchmark) NumClients ¶
NumClients returns the number of concurrent clients.
func (*Benchmark) NumMessages ¶
NumMessages returns the total number of messages sent.
func (*Benchmark) String ¶
String returns a CSV string of the benchmark data. n_clients,n_messages,duration,throughput
func (*Benchmark) Throughput ¶
Throughput returns the number of operations per second.
type ChatBox ¶
type ChatBox struct {
// contains filtered or unexported fields
}
ChatBox implements the editable box to write messages in
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
Console implments a terminal UI client to the chat server.
func NewConsole ¶
NewConsole creates the terminal UI in 256 colors, instantiates the layout and widgets, and binds the keys to event handlers. Not thread safe!
func (*Console) CreateLayout ¶
func (c *Console) CreateLayout()
CreateLayout creates the messages and chatbox widgets then sets the layout manager on the GUI application.
type HelpWidget ¶
type HelpWidget struct {
// contains filtered or unexported fields
}
HelpWidget displays the help text at the bottom of the screen.
type Messages ¶
Messages implements the message reader interface
func (*Messages) Append ¶
func (w *Messages) Append(msg *pb.ChatMessage) (err error)
Append a message to the messages window, limiting the history size.
func (*Messages) Layout ¶
Layout draws a full width and tall height box, leaving room only for the chatbox and helpbox widgets at the bottom of the screen.
func (*Messages) ScrollDown ¶
ScrollDown scrolls the messages down by one line
type Ramble ¶
type Ramble struct {
sync.Mutex // Protect concurrent access to sequence and client manager
// contains filtered or unexported fields
}
Ramble implements the RambleService
func NewServer ¶
NewServer creates a chat server to distribute messages to all streaming clients that connect via gRPC.

