types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package types contains the interface and concrete types used for interoperability within all of the modules of muscadine. Wherever possible, we do not rely on a specific implementation of functionality, but rather an interface. Having a separate package that defines those interfaces makes importing them anywhere within the codebase simpler (avoids weird circular imports).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

type Archive interface {
	Last(n int) []*arbor.ChatMessage
	Needed(n int) []string
	Has(id string) bool
	Get(id string) *arbor.ChatMessage
	Root() (string, error)
	Add(message *arbor.ChatMessage) error
	Persist(storage io.Writer) error
	Load(storage io.Reader) error
}

Archive stores and retrieves messages

type Client

type Client interface {
	Composer
	Archive
	Connection
}

Client manages the connection between a TUI and a specific server

type Composer

type Composer interface {
	Reply(string, string) error
	Query(string)
}

Composer writes and sends protocol messages

type Connection

type Connection interface {
	OnDisconnect(handler func(Connection))
	OnReceive(handler func(*arbor.ChatMessage))
	Connect() error
	Disconnect() error
}

Connection models a live connection to a server

type UI

type UI interface {
	Display(*arbor.ChatMessage) // adds a chat message to the UI
	AwaitExit()                 // blocks until UI exit
}

UI is all of the operations that an Arbor client front-end needs to support in order to be a drop-in replacement for the default.

Jump to

Keyboard shortcuts

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