event

package
v0.0.0-...-996fa4a Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ban

type Ban string

Ban represents a banned key event.

func (Ban) Key

func (e Ban) Key() string

Key returns the event key.

func (Ban) Val

func (e Ban) Val() []byte

Val returns the event value.

type Connection

type Connection struct {
	Peer        uint64      `binary:"-"` // The name of the peer. This must be first, since we're doing prefix search.
	Conn        security.ID `binary:"-"` // The connection identifier.
	WillFlag    bool
	WillRetain  bool
	WillQoS     uint8
	WillTopic   []byte
	WillMessage []byte
	ClientID    []byte
	Username    []byte
}

Connection represents a banned key event.

func (Connection) Key

func (e Connection) Key() string

Key returns the event key.

func (Connection) Val

func (e Connection) Val() []byte

Val returns the event value.

type Event

type Event interface {
	Key() string
	Val() []byte
	// contains filtered or unexported methods
}

Event represents an encodable event that happened at some point in time.

type State

type State struct {
	// contains filtered or unexported fields
}

State represents globally synchronised state.

func DecodeState

func DecodeState(buf []byte) (out *State, err error)

DecodeState decodes the replicated state.

func NewState

func NewState(dir string) *State

NewState creates a new replicated state.

func (*State) Add

func (st *State) Add(ev Event)

Add adds the unit to the state.

func (*State) Close

func (st *State) Close() error

Close closes the set gracefully.

func (*State) ConnectionsOf

func (st *State) ConnectionsOf(name mesh.PeerName, f func(*Connection))

ConnectionsOf iterates through the connection events for a specific peer.

func (*State) Del

func (st *State) Del(ev Event)

Del removes the unit from the state.

func (*State) Encode

func (st *State) Encode() [][]byte

Encode serializes our complete state to a slice of byte-slices.

func (*State) Has

func (st *State) Has(ev Event) bool

Has checks if the state contains an event.

func (*State) Merge

func (st *State) Merge(other mesh.GossipData) mesh.GossipData

Merge merges the other GossipData into this one, and returns our resulting, complete state.

func (*State) Subscriptions

func (st *State) Subscriptions(f func(*Subscription, Value))

Subscriptions iterates through all of the subscription units. This call is blocking and will lock the entire set of subscriptions while iterating.

func (*State) SubscriptionsOf

func (st *State) SubscriptionsOf(name mesh.PeerName, f func(*Subscription))

SubscriptionsOf iterates through the subscription events for a specific peer.

type Subscription

type Subscription struct {
	Peer    uint64        `binary:"-"` // The name of the peer. This must be first, since we're doing prefix search.
	Conn    security.ID   `binary:"-"` // The connection identifier.
	Ssid    message.Ssid  `binary:"-"` // The SSID for the subscription.
	User    nocopy.String // The connection username.
	Channel nocopy.Bytes  // The channel string.
}

Subscription represents a subscription event.

func (*Subscription) ConnID

func (e *Subscription) ConnID() string

ConnID returns globally-unique identifier for the connection.

func (*Subscription) Key

func (e *Subscription) Key() string

Key returns the event key.

func (*Subscription) Val

func (e *Subscription) Val() []byte

Val returns the event value.

type Value

type Value = crdt.Value

Value represents an event time & value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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