Documentation ¶
Index ¶
- Constants
- type Action
- type BootstrapWSResponse
- type Callback
- type Capabilities
- type CapabilityComponent
- type Client
- func (c *Client) CanDo(action Action, docId sharedTypes.UUID) error
- func (c *Client) CheckHasCapability(component CapabilityComponent) error
- func (c *Client) EnsureQueueMessage(msg WriteQueueEntry) bool
- func (c *Client) EnsureQueueResponse(response RPCResponse) bool
- func (c *Client) ForceDisconnect()
- func (c *Client) HasCapability(component CapabilityComponent) bool
- func (c *Client) HasJoinedDoc(id sharedTypes.UUID) bool
- func (c *Client) MarkAsJoined(id sharedTypes.UUID)
- func (c *Client) MarkAsLeftDoc()
- func (c *Client) ProcessQueuedMessages()
- func (c *Client) ResolveCapabilities(privilegeLevel sharedTypes.PrivilegeLevel, ...)
- func (c *Client) String() string
- func (c *Client) TriggerDisconnect()
- func (c *Client) TryWriteResponseOrQueue(response RPCResponse) bool
- type ClientPosition
- type Clients
- type ConnectedClient
- type ConnectedClients
- type ConnectingConnectedClient
- type GetConnectedUsersResponse
- type GracefulShutdownOptions
- type JoinDocRequest
- type JoinDocResponse
- type LazySuccessResponse
- type Options
- type ProjectDetails
- type RPC
- type RPCRequest
- type RPCResponse
- type RoomChange
- type RoomChanges
- type WriteQueue
- type WriteQueueEntry
Constants ¶
View Source
const ( NoCapabilities = Capabilities(0) CanEditContent = CapabilityComponent(2) CanSeeOtherClients = CapabilityComponent(3) CanSeeNonRestrictedEvents = CapabilityComponent(5) CanSeeAllEditorEvents = CapabilityComponent(7) )
View Source
const ( PublicIdLength = 22 PublicIdTsPrefixLength = 11 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootstrapWSResponse ¶
type BootstrapWSResponse struct { // Project contains (cached) serialized types.ProjectDetails Project json.RawMessage `json:"project"` PrivilegeLevel sharedTypes.PrivilegeLevel `json:"privilegeLevel"` // ConnectedClients contains (shared) serialized types.ConnectedClients ConnectedClients json.RawMessage `json:"connectedClients"` PublicId sharedTypes.PublicId `json:"publicId"` }
func (*BootstrapWSResponse) WriteInto ¶
func (b *BootstrapWSResponse) WriteInto(resp *RPCResponse)
type Capabilities ¶
type Capabilities uint8
func (Capabilities) CheckIncludes ¶
func (c Capabilities) CheckIncludes(action CapabilityComponent) error
func (Capabilities) Includes ¶
func (c Capabilities) Includes(action CapabilityComponent) bool
func (Capabilities) TakeAway ¶
func (c Capabilities) TakeAway(action CapabilityComponent) Capabilities
type CapabilityComponent ¶
type CapabilityComponent uint8
type Client ¶
type Client struct { HasEmitted bool // only read after disconnect PublicId sharedTypes.PublicId ProjectId sharedTypes.UUID UserId sharedTypes.UUID DisplayName string // contains filtered or unexported fields }
func (*Client) CheckHasCapability ¶
func (c *Client) CheckHasCapability(component CapabilityComponent) error
func (*Client) EnsureQueueMessage ¶
func (c *Client) EnsureQueueMessage(msg WriteQueueEntry) bool
func (*Client) EnsureQueueResponse ¶
func (c *Client) EnsureQueueResponse(response RPCResponse) bool
func (*Client) ForceDisconnect ¶
func (c *Client) ForceDisconnect()
func (*Client) HasCapability ¶
func (c *Client) HasCapability(component CapabilityComponent) bool
func (*Client) HasJoinedDoc ¶
func (c *Client) HasJoinedDoc(id sharedTypes.UUID) bool
func (*Client) MarkAsJoined ¶
func (c *Client) MarkAsJoined(id sharedTypes.UUID)
func (*Client) MarkAsLeftDoc ¶
func (c *Client) MarkAsLeftDoc()
func (*Client) ProcessQueuedMessages ¶
func (c *Client) ProcessQueuedMessages()
func (*Client) ResolveCapabilities ¶
func (c *Client) ResolveCapabilities(privilegeLevel sharedTypes.PrivilegeLevel, isRestrictedUser project.IsRestrictedUser, editable bool)
func (*Client) TriggerDisconnect ¶
func (c *Client) TriggerDisconnect()
func (*Client) TryWriteResponseOrQueue ¶
func (c *Client) TryWriteResponseOrQueue(response RPCResponse) bool
type ClientPosition ¶
type ClientPosition struct { Row int64 `json:"r,omitempty"` Column int64 `json:"c,omitempty"` EntityId sharedTypes.UUID `json:"e"` }
type ConnectedClient ¶
type ConnectedClient struct { ClientId sharedTypes.PublicId `json:"i,omitempty"` DisplayName string `json:"n,omitempty"` ClientPosition }
type ConnectedClients ¶
type ConnectedClients []ConnectedClient
type ConnectingConnectedClient ¶
type ConnectingConnectedClient struct {
DisplayName string `json:"n,omitempty"`
}
func (ConnectingConnectedClient) Append ¶
func (c ConnectingConnectedClient) Append(p []byte) []byte
type GetConnectedUsersResponse ¶
type GetConnectedUsersResponse struct { // ConnectedClients contains (shared) serialized types.ConnectedClients ConnectedClients json.RawMessage `json:"connectedClients"` }
func (*GetConnectedUsersResponse) MarshalJSON ¶
func (g *GetConnectedUsersResponse) MarshalJSON() ([]byte, error)
type GracefulShutdownOptions ¶
type GracefulShutdownOptions struct { Delay time.Duration `json:"delay"` Timeout time.Duration `json:"timeout"` CleanupTimeout time.Duration `json:"cleanup_timeout"` }
func (*GracefulShutdownOptions) Validate ¶
func (o *GracefulShutdownOptions) Validate() error
type JoinDocRequest ¶
type JoinDocRequest struct {
FromVersion sharedTypes.Version `json:"fromVersion"`
}
type JoinDocResponse ¶
type JoinDocResponse struct { Snapshot sharedTypes.Snapshot `json:"snapshot"` Version sharedTypes.Version `json:"version"` Updates []sharedTypes.DocumentUpdate `json:"updates"` }
type LazySuccessResponse ¶
type LazySuccessResponse struct { Callback Callback `json:"c"` Latency sharedTypes.Timed `json:"l"` }
type Options ¶
type Options struct { GracefulShutdown GracefulShutdownOptions `json:"graceful_shutdown"` WriteQueueDepth int `json:"write_queue_depth"` BootstrapWorker int `json:"bootstrap_worker"` WriteWorker int `json:"write_worker"` JWT struct { Project jwtOptions.JWTOptions `json:"project"` } `json:"jwt"` }
func (*Options) FillFromEnv ¶
func (o *Options) FillFromEnv()
type ProjectDetails ¶
type ProjectDetails struct { project.ForBootstrapWS project.OwnerFeaturesField project.TokensField // stub RootFolder []*project.Folder `json:"rootFolder"` }
type RPC ¶
type RPC struct { Client *Client Request *RPCRequest Response *RPCResponse }
type RPCRequest ¶
type RPCRequest struct { Action Action `json:"a"` Body json.RawMessage `json:"b"` Callback Callback `json:"c"` DocId sharedTypes.UUID `json:"d"` }
type RPCResponse ¶
type RPCResponse struct { /* "h" is a virtual field indicating the length of Body */ Body json.RawMessage `json:"b,omitempty"` Callback Callback `json:"c,omitempty"` Error *errors.JavaScriptError `json:"e,omitempty"` Name sharedTypes.EditorEventMessage `json:"n,omitempty"` Latency sharedTypes.Timed `json:"l,omitempty"` ProcessedBy string `json:"p,omitempty"` LazySuccessResponses []LazySuccessResponse `json:"s,omitempty"` FatalError bool `json:"-"` // contains filtered or unexported fields }
func (*RPCResponse) FastUnmarshalJSON ¶
func (r *RPCResponse) FastUnmarshalJSON(p []byte) error
func (*RPCResponse) IsLazySuccessResponse ¶
func (r *RPCResponse) IsLazySuccessResponse() bool
func (*RPCResponse) MarshalJSON ¶
func (r *RPCResponse) MarshalJSON() ([]byte, error)
func (*RPCResponse) ReleaseBuffer ¶
func (r *RPCResponse) ReleaseBuffer()
type RoomChange ¶
type RoomChange struct { PublicId sharedTypes.PublicId `json:"i"` DisplayName string `json:"n,omitempty"` IsJoin uint8 `json:"j,omitempty"` HasEmitted bool `json:"-"` }
func (RoomChange) Append ¶
func (r RoomChange) Append(p []byte) []byte
type RoomChanges ¶
type RoomChanges []RoomChange
type WriteQueue ¶
type WriteQueue chan WriteQueueEntry
type WriteQueueEntry ¶
type WriteQueueEntry struct { RPCResponse *RPCResponse Msg *websocket.PreparedMessage FatalError bool }
func PrepareBulkMessage ¶
func PrepareBulkMessage(response *RPCResponse) (WriteQueueEntry, error)
Click to show internal directories.
Click to hide internal directories.