participant

package
v0.0.0-...-7ec57c3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_CLIENTS = 1 // Maximum clients the server can have
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Participant

type Participant interface {
	// Registers a client with this participant
	RegisterClient(client ParticipantClient) (xid.ID, error)

	// Unregisters a client with this participant
	UnregisterClient(clientID xid.ID) error

	// Adds a change to the doc via the operation
	AddDocChange(clientID xid.ID, docID string, op ot.Operation) error

	// Updates the stored client info
	UpdateClient(clientID xid.ID, client ParticipantClient) error

	// Responds with the necessary list of operations in order to catch up
	// to the current document state
	DocCatchUp(clientID xid.ID, docID string) ([]ot.Operation, error)
}

Participant is a reader/writer participating in a Partner workspace

func NewParticipant

func NewParticipant(myHostPort string, hostMap map[int]string, numParticipants, myID, numRetries int, replace bool, serverConstructor func(p Participant) ParticipantServer) (Participant, error)

type ParticipantClient

type ParticipantClient struct {
	ID        xid.ID
	Name      string
	DocID     string
	CursorPos int
}

type ParticipantServer

type ParticipantServer interface {
	BroadcastDocChange(docID string, op ot.Operation) error
	BroadcastClientUpdate(clientID xid.ID, client ParticipantClient) error
	BroadcastClientRemove(clientID xid.ID) error
}

Jump to

Keyboard shortcuts

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