outputstream

package
v0.0.0-...-e7dcbf3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOldDatabases

func DeleteOldDatabases(tmpdir string) error

Types

type Message

type Message struct {
	Id             robust.Id
	Data           string
	InterestingFor map[uint64]bool
}

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

func (os *OutputStream) GetNext(ctx context.Context, lastseen robust.Id) []Message

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

Jump to

Keyboard shortcuts

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