Documentation
¶
Index ¶
- Constants
- Variables
- func UserError(err error) bool
- type Conflict
- type HistoryRecorder
- type Manager
- func (m *Manager) ApplyUpdate(connectionID uuid.UUID, rawPath string, finished bool, chunk, editor string) error
- func (m *Manager) Disconnect(connectionID uuid.UUID)
- func (m *Manager) Register(connectionID uuid.UUID, sender Sender)
- func (m *Manager) RelayAwareness(connectionID uuid.UUID, rawPath, payload string) error
- func (m *Manager) Reload(connectionID uuid.UUID, rawPath string) error
- func (m *Manager) Save(connectionID uuid.UUID, userUUID, rawPath string, force bool, ...) error
- func (m *Manager) Subscribe(connectionID uuid.UUID, userUUID, userName string, avatar *string, ...) error
- func (m *Manager) Unsubscribe(connectionID uuid.UUID, rawPath, editor string) error
- type Message
- type Participant
- type Saved
- type Sender
- type SyncMeta
Constants ¶
View Source
const ( EventSync = "file collab sync" EventUpdate = "file collab update" EventAwareness = "file collab awareness" EventParticipants = "file collab participants" EventSaved = "file collab saved" EventConflict = "file collab conflict" EventError = "file collab error" )
Outbound message events (Calagopus-compatible names).
View Source
const ( EventSubscribe = "file collab subscribe" EventUnsubscribe = "file collab unsubscribe" EventUpdateIn = "file collab update" EventAwarenessIn = "file collab awareness" EventSave = "file collab save" EventReload = "file collab reload" )
Inbound message events.
View Source
const ( PermissionReadContent = "file.read-content" PermissionUpdate = "file.update" )
Permission strings expected on the websocket JWT.
Variables ¶
View Source
var ( ErrDisabled = errors.New("collaborative editing is disabled") ErrNotSubscribed = errors.New("not subscribed to this file") ErrFileNotFound = errors.New("file not found") ErrNotAFile = errors.New("file is not a file") ErrNotEditable = errors.New("file is not editable as text") ErrTooLarge = errors.New("file is too large for collaborative editing") ErrInvalidUpdate = errors.New("invalid update encoding") ErrTooManySessions = errors.New("too many collaborative sessions open on this server") ErrTooManyConnSubs = errors.New("too many collaborative sessions open on this connection") ErrTooManyEditors = errors.New("too many editors open for this file on this connection") ErrEditorIDTooLong = errors.New("editor id is too long") ErrNoParent = errors.New("file has no parent") ErrInvalidFileName = errors.New("invalid file name") ErrAllocateSpace = errors.New("failed to allocate space") ErrMissingPermission = errors.New("missing permission") )
Functions ¶
Types ¶
type HistoryRecorder ¶
type HistoryRecorder interface {
RecordEdit(path string, before, after []byte, userUUID string) (int64, error)
Enabled() bool
FileSizeCap() uint64
}
HistoryRecorder receives successful collaborative file saves.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager hosts collaborative editing sessions for one game server.
func NewManager ¶
func NewManager(serverUUID string, fs *filesystem.Filesystem, ctx context.Context, logger *log.Entry, history HistoryRecorder) *Manager
func (*Manager) ApplyUpdate ¶
func (m *Manager) ApplyUpdate(connectionID uuid.UUID, rawPath string, finished bool, chunk, editor string) error
ApplyUpdate applies a (possibly chunked) Yjs update from a client.
func (*Manager) Disconnect ¶
Disconnect removes a connection and leaves all of its collab sessions.
func (*Manager) RelayAwareness ¶
RelayAwareness relays cursor/presence awareness to other editors.
func (*Manager) Save ¶
func (m *Manager) Save(connectionID uuid.UUID, userUUID, rawPath string, force bool, expectedHash string) error
Save writes the collaborative document to disk.
type Participant ¶
type Participant struct {
User string `json:"user"`
Name string `json:"name"`
Avatar *string `json:"avatar"`
}
Participant is someone currently editing a file.
Click to show internal directories.
Click to hide internal directories.