collabpb

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Collab_Session_FullMethodName = "/collab.v1.Collab/Session"
)

Variables

View Source
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)

View Source
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, 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".
	//
	// A document is a set of named parts, so this is a version per part —
	// crdt.CompositeVersion, not one vector.
	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) Descriptor() ([]byte, []int)

Deprecated: Use Join.ProtoReflect.Descriptor instead.

func (*Join) GetDocument

func (x *Join) GetDocument() string

func (*Join) GetHave

func (x *Join) GetHave() []byte

func (*Join) GetSite

func (x *Join) GetSite() uint64

func (*Join) ProtoMessage

func (*Join) ProtoMessage()

func (*Join) ProtoReflect

func (x *Join) ProtoReflect() protoreflect.Message

func (*Join) Reset

func (x *Join) Reset()

func (*Join) String

func (x *Join) String() string

type Operations

type Operations struct {
	Operations []byte `protobuf:"bytes,1,opt,name=operations,proto3" json:"operations,omitempty"`
	// contains filtered or unexported fields
}

Operations carries operations addressed to the parts of a document, encoded by crdt.AppendPartOps. Applying them is idempotent and order-independent, so this message needs no sequencing of its own.

The part each operation belongs to travels inside those bytes rather than in a field here, which is why holding several structures in one document changed nothing about this message. It is also what lets one message carry an edit to the text and an edit to a comment on it: they arrive together or not at all.

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) Descriptor() ([]byte, []int)

Deprecated: Use Presence.ProtoReflect.Descriptor instead.

func (*Presence) GetUpdate

func (x *Presence) GetUpdate() []byte

func (*Presence) ProtoMessage

func (*Presence) ProtoMessage()

func (*Presence) ProtoReflect

func (x *Presence) ProtoReflect() protoreflect.Message

func (*Presence) Reset

func (x *Presence) Reset()

func (*Presence) String

func (x *Presence) String() string

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

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, per part. 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) Descriptor() ([]byte, []int)

Deprecated: Use Welcome.ProtoReflect.Descriptor instead.

func (*Welcome) GetOperations

func (x *Welcome) GetOperations() []byte

func (*Welcome) GetPresence

func (x *Welcome) GetPresence() [][]byte

func (*Welcome) GetSnapshot

func (x *Welcome) GetSnapshot() []byte

func (*Welcome) GetVersion

func (x *Welcome) GetVersion() []byte

func (*Welcome) ProtoMessage

func (*Welcome) ProtoMessage()

func (*Welcome) ProtoReflect

func (x *Welcome) ProtoReflect() protoreflect.Message

func (*Welcome) Reset

func (x *Welcome) Reset()

func (*Welcome) String

func (x *Welcome) String() string

Jump to

Keyboard shortcuts

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