Documentation ¶
Overview ¶
Package storage defines the interface to the message log.
irc-idler must store messages when the user is disconnected; this package defines the interfaces required for a storage backend. It does not itself provide impelmentations of Stores (but see EmptyCursor). Various backends can be found in the subdirectories of this package.
No requirements for thread safety are imposed on implementations; Clients of these interfaces must handle synchronization themselves.
In general, if error is non-nil then any other return values may be nil.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelLog ¶
type ChannelLog interface { // Append a message to the end of log. LogMessage(msg *irc.Message) error // Replay the log. Returns a cursor pointing at the first message in the log Replay() (LogCursor, error) // Delete all of the messages in the log Clear() error }
A ChannelLog is a (sequential) log for a particular channel.
type LogCursor ¶
type LogCursor interface { // Get the current message pointed to by the cursor. If the cursor is past the end of the // log, returns (nil, io.EOF). Get() (*irc.Message, error) // Advance the cursor to the next message in the log. Next() // Destroy the cursor and clean up any associated resources. Close() error }
A LogCursor is a cursor into a ChannelLog.
var ( // EmptyCursor is an "empty" cursor, whose Get() method always // returns (nil, io.EOF). Its Close() returns nil and does nothing. EmptyCursor LogCursor = emptyCursor{} )
type Store ¶
type Store interface { // Get a ChannelLog for the named channel GetChannel(name string) (ChannelLog, error) }
A Store is a data store for logged messages
Directories ¶
Path | Synopsis |
---|---|
Package ephemeral defines a storage.Store implementation that stores messages in an in-memory data structure.
|
Package ephemeral defines a storage.Store implementation that stores messages in an in-memory data structure. |
Package sql provides an implementation of storage.Store on top of an SQL database.
|
Package sql provides an implementation of storage.Store on top of an SQL database. |
Package testing provides utilities for testing implementations of Store
|
Package testing provides utilities for testing implementations of Store |