Documentation ¶
Overview ¶
Package outputstream represents the messages which the ircserver package generates in response to what is being sent to RobustIRC.
Data is stored in a temporary LevelDB database so that not all data is kept in main memory at all times. The working set we are talking about is ≈100M, but using LevelDB (with its default Snappy compression), that gets compressed down to ≈35M.
Index ¶
- func DeleteOldDatabases(tmpdir string) error
- type Message
- type OutputStream
- func (os *OutputStream) Add(msgs []Message) error
- func (o *OutputStream) Close() error
- func (os *OutputStream) Delete(inputID robust.Id) error
- func (os *OutputStream) Get(input robust.Id) ([]Message, bool)
- func (os *OutputStream) GetNext(ctx context.Context, lastseen robust.Id) []Message
- func (os *OutputStream) InterruptGetNext()
- func (os *OutputStream) LastSeen() robust.Id
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteOldDatabases ¶
Types ¶
type Message ¶
Message is similar to robust.Message, but more compact. This speeds up (de)serialization, which is useful for storing messages outside of main memory.
type OutputStream ¶
type OutputStream struct {
// contains filtered or unexported fields
}
func NewOutputStream ¶
func NewOutputStream(tmpdir string) (*OutputStream, error)
func (*OutputStream) Add ¶
func (os *OutputStream) Add(msgs []Message) error
Add adds messages to the output stream. The Id.Id field of all messages must be identical, i.e. they must all be replies to the same input IRC message.
func (*OutputStream) Close ¶
func (o *OutputStream) Close() error
func (*OutputStream) Delete ¶
func (os *OutputStream) Delete(inputID robust.Id) error
Delete deletes all IRC output messages that were generated in reply to the input message with inputID.
func (*OutputStream) Get ¶
func (os *OutputStream) Get(input robust.Id) ([]Message, bool)
Get returns the next IRC output message for 'input', if present.
func (*OutputStream) GetNext ¶
GetNext returns the next IRC output message after lastseen, even if lastseen was deleted in the meanwhile. In case there is no next message yet, GetNext blocks until it appears. GetNext(types.RobustId{Id: 0}) returns the first message.
func (*OutputStream) InterruptGetNext ¶
func (os *OutputStream) InterruptGetNext()
InterruptGetNext interrupts any running GetNext() calls so that they return if |cancelled| is specified and true in the GetNext() call.
func (*OutputStream) LastSeen ¶
func (os *OutputStream) LastSeen() robust.Id