hub

package
v0.0.0-...-a57c2c0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadChange = errors.New("hub: invalid change")

Functions

This section is empty.

Types

type AttachIn

type AttachIn struct {
	Socket *glue.Socket

	Token string
}

type AttachOut

type AttachOut struct {
	Socket *glue.Socket
}

type Change

type Change struct {
	ID   string
	Root int
	Ops  ot.Ops
}

type ChangeData

type ChangeData struct {
	ID   string        `json:"id"`
	Root int           `json:"root"`
	Ops  []interface{} `json:"ops"`
}

func NewChangeData

func NewChangeData(ch Change) ChangeData

func (ChangeData) Change

func (d ChangeData) Change() Change

type ChangeIn

type ChangeIn struct {
	Socket *glue.Socket

	Change Change
}

type ChangeOut

type ChangeOut struct {
	Socket *glue.Socket

	Change Change
}

type Doc

type Doc struct {
	ID      string
	Blob    ot.Blob
	History []Change
}

func (*Doc) Apply

func (d *Doc) Apply(ch Change) (Change, error)

func (*Doc) Head

func (d *Doc) Head() Change

type ErrorOut

type ErrorOut struct {
	Socket *glue.Socket

	Error   error
	Message string
}

type Hub

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

func New

func New(repo Repo) *Hub

func (*Hub) HandleSocket

func (h *Hub) HandleSocket(sock *glue.Socket)

type Repo

type Repo interface {
	Get(string) (*Doc, error)
	Put(string, *Doc) error
}

Jump to

Keyboard shortcuts

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