Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterCollabServer(s grpc.ServiceRegistrar, srv CollabServer)
- type ClientMessage
- func (*ClientMessage) Descriptor() ([]byte, []int)deprecated
- func (x *ClientMessage) GetBody() isClientMessage_Body
- func (x *ClientMessage) GetJoin() *Join
- func (x *ClientMessage) GetOperations() *Operations
- func (x *ClientMessage) GetPresence() *Presence
- func (*ClientMessage) ProtoMessage()
- func (x *ClientMessage) ProtoReflect() protoreflect.Message
- func (x *ClientMessage) Reset()
- func (x *ClientMessage) String() string
- type ClientMessage_Join
- type ClientMessage_Operations
- type ClientMessage_Presence
- type CollabClient
- type CollabServer
- type Collab_SessionClient
- type Collab_SessionServer
- type Join
- type Operations
- type Presence
- type ServerMessage
- func (*ServerMessage) Descriptor() ([]byte, []int)deprecated
- func (x *ServerMessage) GetBody() isServerMessage_Body
- func (x *ServerMessage) GetOperations() *Operations
- func (x *ServerMessage) GetPresence() *Presence
- func (x *ServerMessage) GetWelcome() *Welcome
- func (*ServerMessage) ProtoMessage()
- func (x *ServerMessage) ProtoReflect() protoreflect.Message
- func (x *ServerMessage) Reset()
- func (x *ServerMessage) String() string
- type ServerMessage_Operations
- type ServerMessage_Presence
- type ServerMessage_Welcome
- type UnimplementedCollabServer
- type UnsafeCollabServer
- type Welcome
- func (*Welcome) Descriptor() ([]byte, []int)deprecated
- func (x *Welcome) GetOperations() []byte
- func (x *Welcome) GetPresence() [][]byte
- func (x *Welcome) GetSnapshot() []byte
- func (x *Welcome) GetVersion() []byte
- func (*Welcome) ProtoMessage()
- func (x *Welcome) ProtoReflect() protoreflect.Message
- func (x *Welcome) Reset()
- func (x *Welcome) String() string
Constants ¶
const (
Collab_Session_FullMethodName = "/collab.v1.Collab/Session"
)
Variables ¶
var Collab_ServiceDesc = grpc.ServiceDesc{ ServiceName: "collab.v1.Collab", HandlerType: (*CollabServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "Session", Handler: _Collab_Session_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "collab.proto", }
Collab_ServiceDesc is the grpc.ServiceDesc for Collab service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_collab_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCollabServer ¶
func RegisterCollabServer(s grpc.ServiceRegistrar, srv CollabServer)
Types ¶
type ClientMessage ¶
type ClientMessage struct {
// Types that are valid to be assigned to Body:
//
// *ClientMessage_Join
// *ClientMessage_Operations
// *ClientMessage_Presence
Body isClientMessage_Body `protobuf_oneof:"body"`
// contains filtered or unexported fields
}
ClientMessage is anything a participant sends.
func (*ClientMessage) Descriptor
deprecated
func (*ClientMessage) Descriptor() ([]byte, []int)
Deprecated: Use ClientMessage.ProtoReflect.Descriptor instead.
func (*ClientMessage) GetBody ¶
func (x *ClientMessage) GetBody() isClientMessage_Body
func (*ClientMessage) GetJoin ¶
func (x *ClientMessage) GetJoin() *Join
func (*ClientMessage) GetOperations ¶
func (x *ClientMessage) GetOperations() *Operations
func (*ClientMessage) GetPresence ¶
func (x *ClientMessage) GetPresence() *Presence
func (*ClientMessage) ProtoMessage ¶
func (*ClientMessage) ProtoMessage()
func (*ClientMessage) ProtoReflect ¶
func (x *ClientMessage) ProtoReflect() protoreflect.Message
func (*ClientMessage) Reset ¶
func (x *ClientMessage) Reset()
func (*ClientMessage) String ¶
func (x *ClientMessage) String() string
type ClientMessage_Join ¶
type ClientMessage_Join struct {
Join *Join `protobuf:"bytes,1,opt,name=join,proto3,oneof"`
}
type ClientMessage_Operations ¶
type ClientMessage_Operations struct {
Operations *Operations `protobuf:"bytes,2,opt,name=operations,proto3,oneof"`
}
type ClientMessage_Presence ¶
type ClientMessage_Presence struct {
Presence *Presence `protobuf:"bytes,3,opt,name=presence,proto3,oneof"`
}
type CollabClient ¶
type CollabClient interface {
// Session carries a participant's whole involvement with one document: it
// opens with a Join, and from then on operations and presence flow both ways
// until either side hangs up.
Session(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientMessage, ServerMessage], error)
}
CollabClient is the client API for Collab service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
Collab is one bidirectional stream per participant per document.
func NewCollabClient ¶
func NewCollabClient(cc grpc.ClientConnInterface) CollabClient
type CollabServer ¶
type CollabServer interface {
// Session carries a participant's whole involvement with one document: it
// opens with a Join, and from then on operations and presence flow both ways
// until either side hangs up.
Session(grpc.BidiStreamingServer[ClientMessage, ServerMessage]) error
// contains filtered or unexported methods
}
CollabServer is the server API for Collab service. All implementations must embed UnimplementedCollabServer for forward compatibility.
Collab is one bidirectional stream per participant per document.
type Collab_SessionClient ¶
type Collab_SessionClient = grpc.BidiStreamingClient[ClientMessage, ServerMessage]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Collab_SessionServer ¶
type Collab_SessionServer = grpc.BidiStreamingServer[ClientMessage, ServerMessage]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Join ¶
type Join struct {
// document names the document to edit. It is opened if it does not exist.
Document string `protobuf:"bytes,1,opt,name=document,proto3" json:"document,omitempty"`
// site is the participant's replica identity, which must be distinct from
// every other participant's. See crdt.DeriveSiteID.
Site uint64 `protobuf:"varint,2,opt,name=site,proto3" json:"site,omitempty"`
// have is the participant's encoded version vector, sent when rejoining a
// document it already holds. The server then replies with only the operations
// that are missing, instead of the whole document. Empty means "send
// everything".
Have []byte `protobuf:"bytes,3,opt,name=have,proto3" json:"have,omitempty"`
// contains filtered or unexported fields
}
Join opens a session. It must be the first message, and it must not be sent twice.
func (*Join) Descriptor
deprecated
func (*Join) GetDocument ¶
func (*Join) ProtoMessage ¶
func (*Join) ProtoMessage()
func (*Join) ProtoReflect ¶
func (x *Join) ProtoReflect() protoreflect.Message
type Operations ¶
type Operations struct {
Operations []byte `protobuf:"bytes,1,opt,name=operations,proto3" json:"operations,omitempty"`
// contains filtered or unexported fields
}
Operations carries a batch of CRDT operations, encoded by crdt.AppendOps. Applying them is idempotent and order-independent, so this message needs no sequencing of its own.
func (*Operations) Descriptor
deprecated
func (*Operations) Descriptor() ([]byte, []int)
Deprecated: Use Operations.ProtoReflect.Descriptor instead.
func (*Operations) GetOperations ¶
func (x *Operations) GetOperations() []byte
func (*Operations) ProtoMessage ¶
func (*Operations) ProtoMessage()
func (*Operations) ProtoReflect ¶
func (x *Operations) ProtoReflect() protoreflect.Message
func (*Operations) Reset ¶
func (x *Operations) Reset()
func (*Operations) String ¶
func (x *Operations) String() string
type Presence ¶
type Presence struct {
Update []byte `protobuf:"bytes,1,opt,name=update,proto3" json:"update,omitempty"`
// contains filtered or unexported fields
}
Presence carries one encoded awareness update: a cursor, a selection, or a departure. It is never persisted.
func (*Presence) Descriptor
deprecated
func (*Presence) ProtoMessage ¶
func (*Presence) ProtoMessage()
func (*Presence) ProtoReflect ¶
func (x *Presence) ProtoReflect() protoreflect.Message
type ServerMessage ¶
type ServerMessage struct {
// Types that are valid to be assigned to Body:
//
// *ServerMessage_Welcome
// *ServerMessage_Operations
// *ServerMessage_Presence
Body isServerMessage_Body `protobuf_oneof:"body"`
// contains filtered or unexported fields
}
ServerMessage is anything the server sends back.
func (*ServerMessage) Descriptor
deprecated
func (*ServerMessage) Descriptor() ([]byte, []int)
Deprecated: Use ServerMessage.ProtoReflect.Descriptor instead.
func (*ServerMessage) GetBody ¶
func (x *ServerMessage) GetBody() isServerMessage_Body
func (*ServerMessage) GetOperations ¶
func (x *ServerMessage) GetOperations() *Operations
func (*ServerMessage) GetPresence ¶
func (x *ServerMessage) GetPresence() *Presence
func (*ServerMessage) GetWelcome ¶
func (x *ServerMessage) GetWelcome() *Welcome
func (*ServerMessage) ProtoMessage ¶
func (*ServerMessage) ProtoMessage()
func (*ServerMessage) ProtoReflect ¶
func (x *ServerMessage) ProtoReflect() protoreflect.Message
func (*ServerMessage) Reset ¶
func (x *ServerMessage) Reset()
func (*ServerMessage) String ¶
func (x *ServerMessage) String() string
type ServerMessage_Operations ¶
type ServerMessage_Operations struct {
Operations *Operations `protobuf:"bytes,2,opt,name=operations,proto3,oneof"`
}
type ServerMessage_Presence ¶
type ServerMessage_Presence struct {
Presence *Presence `protobuf:"bytes,3,opt,name=presence,proto3,oneof"`
}
type ServerMessage_Welcome ¶
type ServerMessage_Welcome struct {
Welcome *Welcome `protobuf:"bytes,1,opt,name=welcome,proto3,oneof"`
}
type UnimplementedCollabServer ¶
type UnimplementedCollabServer struct{}
UnimplementedCollabServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedCollabServer) Session ¶
func (UnimplementedCollabServer) Session(grpc.BidiStreamingServer[ClientMessage, ServerMessage]) error
type UnsafeCollabServer ¶
type UnsafeCollabServer interface {
// contains filtered or unexported methods
}
UnsafeCollabServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CollabServer will result in compilation errors.
type Welcome ¶
type Welcome struct {
// snapshot is the whole document, sent when the participant is new to it or
// too far behind to catch up cheaply. Empty when operations were sent instead.
Snapshot []byte `protobuf:"bytes,1,opt,name=snapshot,proto3" json:"snapshot,omitempty"`
// operations catches up a participant that supplied a version vector.
Operations []byte `protobuf:"bytes,2,opt,name=operations,proto3" json:"operations,omitempty"`
// presence is the state of everyone already in the document.
Presence [][]byte `protobuf:"bytes,3,rep,name=presence,proto3" json:"presence,omitempty"`
// version is the server's encoded version vector. A participant answers with
// whatever the server is missing, which is what lets work done while
// disconnected reach everyone else rather than being stranded.
Version []byte `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
// contains filtered or unexported fields
}
Welcome answers a Join with the state of the document at that moment.
func (*Welcome) Descriptor
deprecated
func (*Welcome) GetOperations ¶
func (*Welcome) GetPresence ¶
func (*Welcome) GetSnapshot ¶
func (*Welcome) GetVersion ¶
func (*Welcome) ProtoMessage ¶
func (*Welcome) ProtoMessage()
func (*Welcome) ProtoReflect ¶
func (x *Welcome) ProtoReflect() protoreflect.Message