diff --git a/api/converter/from_pb.go b/api/converter/from_pb.go index a1b3f623e..b05098ba2 100644 --- a/api/converter/from_pb.go +++ b/api/converter/from_pb.go @@ -210,6 +210,8 @@ func FromEventType(pbDocEventType api.DocEventType) (types.DocEventType, error) return types.DocumentWatchedEvent, nil case api.DocEventType_DOC_EVENT_TYPE_DOCUMENT_UNWATCHED: return types.DocumentUnwatchedEvent, nil + case api.DocEventType_DOC_EVENT_TYPE_DOCUMENT_BROADCAST: + return types.DocumentBroadcastEvent, nil } return "", fmt.Errorf("%v: %w", pbDocEventType, ErrUnsupportedEventType) } diff --git a/api/converter/to_pb.go b/api/converter/to_pb.go index 7a603157e..4772936f6 100644 --- a/api/converter/to_pb.go +++ b/api/converter/to_pb.go @@ -207,6 +207,8 @@ func ToDocEventType(eventType types.DocEventType) (api.DocEventType, error) { return api.DocEventType_DOC_EVENT_TYPE_DOCUMENT_WATCHED, nil case types.DocumentUnwatchedEvent: return api.DocEventType_DOC_EVENT_TYPE_DOCUMENT_UNWATCHED, nil + case types.DocumentBroadcastEvent: + return api.DocEventType_DOC_EVENT_TYPE_DOCUMENT_BROADCAST, nil default: return 0, fmt.Errorf("%s: %w", eventType, ErrUnsupportedEventType) } diff --git a/api/types/auth_webhook.go b/api/types/auth_webhook.go index 46fc678d1..841e672f4 100644 --- a/api/types/auth_webhook.go +++ b/api/types/auth_webhook.go @@ -57,6 +57,7 @@ const ( RemoveDocument Method = "RemoveDocument" PushPull Method = "PushPull" WatchDocuments Method = "WatchDocuments" + Broadcast Method = "Broadcast" ) // IsAuthMethod returns whether the given method can be used for authorization. @@ -79,6 +80,7 @@ func AuthMethods() []Method { RemoveDocument, PushPull, WatchDocuments, + Broadcast, } } diff --git a/api/types/event.go b/api/types/event.go index dc4a2baba..f0d2b160b 100644 --- a/api/types/event.go +++ b/api/types/event.go @@ -15,4 +15,14 @@ const ( // DocumentUnwatchedEvent is an event that occurs when document is // unwatched by other clients. DocumentUnwatchedEvent DocEventType = "document-unwatched" + + // DocumentBroadcastEvent is an event that occurs when a payload is broadcasted + // on a specific topic. + DocumentBroadcastEvent DocEventType = "document-broadcast" ) + +// DocEventBody includes additional data specific to the DocEvent. +type DocEventBody struct { + Topic string + Payload []byte +} diff --git a/api/yorkie/v1/resources.pb.go b/api/yorkie/v1/resources.pb.go index 77c2f9696..01b1ba359 100644 --- a/api/yorkie/v1/resources.pb.go +++ b/api/yorkie/v1/resources.pb.go @@ -90,18 +90,21 @@ const ( DocEventType_DOC_EVENT_TYPE_DOCUMENT_CHANGED DocEventType = 0 DocEventType_DOC_EVENT_TYPE_DOCUMENT_WATCHED DocEventType = 1 DocEventType_DOC_EVENT_TYPE_DOCUMENT_UNWATCHED DocEventType = 2 + DocEventType_DOC_EVENT_TYPE_DOCUMENT_BROADCAST DocEventType = 3 ) var DocEventType_name = map[int32]string{ 0: "DOC_EVENT_TYPE_DOCUMENT_CHANGED", 1: "DOC_EVENT_TYPE_DOCUMENT_WATCHED", 2: "DOC_EVENT_TYPE_DOCUMENT_UNWATCHED", + 3: "DOC_EVENT_TYPE_DOCUMENT_BROADCAST", } var DocEventType_value = map[string]int32{ "DOC_EVENT_TYPE_DOCUMENT_CHANGED": 0, "DOC_EVENT_TYPE_DOCUMENT_WATCHED": 1, "DOC_EVENT_TYPE_DOCUMENT_UNWATCHED": 2, + "DOC_EVENT_TYPE_DOCUMENT_BROADCAST": 3, } func (x DocEventType) String() string { @@ -3274,19 +3277,75 @@ func (m *TimeTicket) GetActorId() []byte { return nil } +type DocEventBody struct { + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` + Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DocEventBody) Reset() { *m = DocEventBody{} } +func (m *DocEventBody) String() string { return proto.CompactTextString(m) } +func (*DocEventBody) ProtoMessage() {} +func (*DocEventBody) Descriptor() ([]byte, []int) { + return fileDescriptor_36361b2f5d0f0896, []int{25} +} +func (m *DocEventBody) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DocEventBody) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DocEventBody.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DocEventBody) XXX_Merge(src proto.Message) { + xxx_messageInfo_DocEventBody.Merge(m, src) +} +func (m *DocEventBody) XXX_Size() int { + return m.Size() +} +func (m *DocEventBody) XXX_DiscardUnknown() { + xxx_messageInfo_DocEventBody.DiscardUnknown(m) +} + +var xxx_messageInfo_DocEventBody proto.InternalMessageInfo + +func (m *DocEventBody) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *DocEventBody) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + type DocEvent struct { - Type DocEventType `protobuf:"varint,1,opt,name=type,proto3,enum=yorkie.v1.DocEventType" json:"type,omitempty"` - Publisher string `protobuf:"bytes,2,opt,name=publisher,proto3" json:"publisher,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Type DocEventType `protobuf:"varint,1,opt,name=type,proto3,enum=yorkie.v1.DocEventType" json:"type,omitempty"` + Publisher string `protobuf:"bytes,2,opt,name=publisher,proto3" json:"publisher,omitempty"` + Body *DocEventBody `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DocEvent) Reset() { *m = DocEvent{} } func (m *DocEvent) String() string { return proto.CompactTextString(m) } func (*DocEvent) ProtoMessage() {} func (*DocEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_36361b2f5d0f0896, []int{25} + return fileDescriptor_36361b2f5d0f0896, []int{26} } func (m *DocEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3329,6 +3388,13 @@ func (m *DocEvent) GetPublisher() string { return "" } +func (m *DocEvent) GetBody() *DocEventBody { + if m != nil { + return m.Body + } + return nil +} + func init() { proto.RegisterEnum("yorkie.v1.ValueType", ValueType_name, ValueType_value) proto.RegisterEnum("yorkie.v1.DocEventType", DocEventType_name, DocEventType_value) @@ -3385,177 +3451,182 @@ func init() { proto.RegisterType((*Checkpoint)(nil), "yorkie.v1.Checkpoint") proto.RegisterType((*TextNodePos)(nil), "yorkie.v1.TextNodePos") proto.RegisterType((*TimeTicket)(nil), "yorkie.v1.TimeTicket") + proto.RegisterType((*DocEventBody)(nil), "yorkie.v1.DocEventBody") proto.RegisterType((*DocEvent)(nil), "yorkie.v1.DocEvent") } func init() { proto.RegisterFile("yorkie/v1/resources.proto", fileDescriptor_36361b2f5d0f0896) } var fileDescriptor_36361b2f5d0f0896 = []byte{ - // 2620 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0xdb, 0x6f, 0xdb, 0xc8, - 0xd5, 0x37, 0x29, 0xea, 0xc2, 0xe3, 0xc4, 0x56, 0xc6, 0xb9, 0x28, 0x4a, 0xe2, 0x4d, 0xb4, 0xdf, - 0xee, 0xe7, 0x4d, 0x5a, 0xf9, 0xb2, 0x97, 0x6e, 0x77, 0x9b, 0xb6, 0xb2, 0xc4, 0xc4, 0xca, 0x3a, - 0xb2, 0x4b, 0xc9, 0xd9, 0x66, 0xd1, 0x82, 0xa0, 0xc9, 0xb1, 0xcd, 0xb5, 0x44, 0x6a, 0x49, 0x4a, - 0x1b, 0x01, 0x05, 0x0a, 0x14, 0x2d, 0xd0, 0xd7, 0xbe, 0xf5, 0x5f, 0x28, 0x0a, 0xf4, 0x7d, 0x1f, - 0xdb, 0x87, 0xa2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0x8c, 0x7b, 0x74, 0x78, 0x59, 0x25, 0x9f, 0xe8, - 0x35, 0x48, 0x76, 0xf5, 0x66, 0x07, 0xe7, 0x44, 0xaa, 0xd2, 0x52, 0x64, 0x84, 0x40, 0x56, 0x65, - 0x88, 0x77, 0xc4, 0xb7, 0x85, 0xc2, 0xcf, 0x44, 0x80, 0xf2, 0x91, 0x6e, 0x1f, 0xe2, 0x5d, 0xdd, - 0x38, 0x46, 0xb7, 0xe0, 0x9c, 0xe9, 0x18, 0x1d, 0xa2, 0xb5, 0xd6, 0xef, 0x78, 0x3e, 0xa8, 0x7b, - 0x0f, 0xf7, 0xd0, 0x9b, 0x00, 0xc6, 0x11, 0x36, 0x8e, 0xdb, 0x8e, 0x65, 0xfb, 0x7c, 0x94, 0x4b, - 0x91, 0x51, 0xca, 0x61, 0xa3, 0x1a, 0x01, 0xa2, 0x3c, 0x64, 0x3c, 0x6e, 0x61, 0x2e, 0x71, 0x53, - 0x58, 0x39, 0xa7, 0x86, 0x65, 0x74, 0x07, 0xd2, 0x06, 0xd5, 0xc1, 0xcb, 0x49, 0x74, 0x5e, 0x2e, - 0x0c, 0xf4, 0x47, 0x5a, 0xd4, 0x00, 0x81, 0x4a, 0x70, 0xa1, 0x65, 0xd9, 0x9a, 0xd7, 0xb3, 0x0d, - 0x6c, 0x6a, 0xbe, 0x65, 0x1c, 0x63, 0x3f, 0x97, 0x1c, 0x51, 0xa3, 0x61, 0xb5, 0x70, 0x83, 0x36, - 0xaa, 0x8b, 0x2d, 0xcb, 0xae, 0x53, 0x38, 0xab, 0x40, 0x37, 0x00, 0x2c, 0x4f, 0x73, 0x71, 0xcb, - 0xe9, 0x62, 0x33, 0x97, 0xba, 0x29, 0xac, 0x64, 0x54, 0xd9, 0xf2, 0x54, 0x56, 0x51, 0xf8, 0xb5, - 0x00, 0x29, 0x36, 0x2a, 0x7a, 0x19, 0x44, 0xcb, 0xe4, 0xde, 0x5d, 0x1a, 0x51, 0xaa, 0x5a, 0x51, -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 0xc7, 0x02, 0xcc, 0x47, 0xae, 0x3b, 0xce, 0x76, 0x3f, 0x44, 0xff, 0x0f, 0x8b, - 0x2e, 0x6e, 0xea, 0xe4, 0x40, 0xae, 0x71, 0x40, 0x82, 0x02, 0x16, 0x82, 0xea, 0x1d, 0xb6, 0x71, - 0x1a, 0x00, 0xfd, 0x9e, 0xa3, 0xcf, 0x60, 0x84, 0xd1, 0x67, 0x30, 0xd7, 0x41, 0x36, 0x71, 0x93, - 0x9c, 0xf3, 0xb1, 0x1b, 0x18, 0x14, 0x56, 0x0c, 0x3c, 0x92, 0x49, 0x0c, 0x3e, 0x92, 0xd9, 0x83, - 0x4c, 0xc5, 0x31, 0x94, 0x2e, 0xb6, 0x7d, 0x74, 0x67, 0x80, 0x99, 0x57, 0x22, 0x16, 0x06, 0x90, - 0x08, 0x19, 0xaf, 0x03, 0xdb, 0xa7, 0xbc, 0x23, 0x3e, 0x62, 0xb0, 0x71, 0x91, 0x8a, 0xdb, 0x9f, - 0x89, 0x20, 0x87, 0xe7, 0x52, 0x42, 0xae, 0x47, 0xa5, 0xed, 0x3d, 0x4e, 0x97, 0xda, 0xde, 0xf6, - 0x76, 0x76, 0x8e, 0x90, 0x2b, 0x52, 0xb9, 0xb9, 0xb3, 0xb3, 0xad, 0x94, 0x6a, 0x8c, 0x74, 0x91, - 0xfa, 0x6a, 0xad, 0xa1, 0xdc, 0x57, 0xd4, 0xac, 0x38, 0xd4, 0xc9, 0xf6, 0x4e, 0xed, 0x7e, 0x36, - 0x41, 0x98, 0x18, 0xa9, 0xac, 0xec, 0xec, 0x6d, 0x6e, 0x2b, 0x59, 0x69, 0xa8, 0xba, 0xde, 0x50, - 0xab, 0xb5, 0xfb, 0xd9, 0x24, 0xba, 0x08, 0xd9, 0xe8, 0x90, 0x8f, 0x1b, 0x4a, 0x3d, 0x9b, 0x1a, - 0xea, 0xb8, 0x52, 0x6a, 0x28, 0xd9, 0x34, 0xca, 0xc3, 0xe5, 0x48, 0x25, 0x39, 0x25, 0x69, 0x3b, - 0x9b, 0x0f, 0x94, 0x72, 0x23, 0x9b, 0x41, 0x57, 0xe1, 0xd2, 0x70, 0x5b, 0x49, 0x55, 0x4b, 0x8f, - 0xb3, 0xf2, 0x50, 0x5f, 0x0d, 0xe5, 0xbb, 0x8d, 0x2c, 0x0c, 0xf5, 0xc5, 0x2d, 0xd2, 0xca, 0xb5, - 0x46, 0x76, 0x1e, 0x5d, 0x81, 0xa5, 0x21, 0xab, 0x68, 0xc3, 0xb9, 0xe1, 0x9e, 0x54, 0x45, 0xc9, - 0x9e, 0xbf, 0xfd, 0x43, 0x38, 0x17, 0x75, 0x05, 0x7a, 0x19, 0x5e, 0xaa, 0xec, 0x94, 0x35, 0xe5, - 0x91, 0x52, 0x6b, 0x04, 0x53, 0x50, 0xde, 0x7b, 0x48, 0x4a, 0x2c, 0x40, 0x49, 0x68, 0x4f, 0x00, - 0xbd, 0x5f, 0x6a, 0x94, 0xb7, 0x94, 0x4a, 0x56, 0x40, 0xaf, 0xc0, 0xad, 0x71, 0xa0, 0xbd, 0x5a, - 0x00, 0x13, 0x37, 0xef, 0xfc, 0xee, 0xe9, 0xb2, 0xf0, 0xe9, 0xd3, 0x65, 0xe1, 0x2f, 0x4f, 0x97, - 0x85, 0x9f, 0x7f, 0xbe, 0x3c, 0x07, 0x17, 0x4c, 0xdc, 0x0d, 0x98, 0xa2, 0xb7, 0xad, 0x62, 0x77, - 0x7d, 0x57, 0xf8, 0x40, 0x2a, 0xbe, 0xdb, 0x5d, 0xdf, 0x4f, 0xd1, 0xb5, 0xf1, 0xf5, 0xff, 0x06, - 0x00, 0x00, 0xff, 0xff, 0xcd, 0x66, 0xbf, 0x7b, 0x1e, 0x29, 0x00, 0x00, + // 2677 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0xdb, 0x8f, 0x23, 0x47, + 0xd5, 0x9f, 0x6e,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 0x20, 0x27, 0xdd, 0x91, 0x56, 0x17, 0x37, 0xaf, + 0x15, 0xc3, 0x71, 0x8a, 0x6f, 0xd6, 0x77, 0x6b, 0x5a, 0x13, 0xb7, 0x70, 0x3b, 0xd0, 0x29, 0x06, + 0x7d, 0x07, 0xd4, 0x8e, 0x87, 0x7d, 0xdc, 0xb6, 0xb0, 0x9f, 0x93, 0xef, 0x24, 0x56, 0x17, 0x37, + 0x0b, 0x11, 0x01, 0xd1, 0x67, 0x71, 0x4f, 0x80, 0xb4, 0x76, 0xe0, 0xf5, 0xf5, 0x81, 0x50, 0xfe, + 0xbb, 0x70, 0x69, 0xb8, 0x11, 0x65, 0x21, 0x71, 0x82, 0xfb, 0x74, 0x78, 0x55, 0x27, 0x9f, 0xe8, + 0x39, 0x48, 0xf6, 0xcc, 0x66, 0x17, 0xe7, 0x64, 0xaa, 0xd2, 0x72, 0x64, 0x04, 0x21, 0xab, 0x33, + 0xc4, 0x2b, 0xf2, 0xcb, 0x52, 0xe1, 0xa7, 0x32, 0x40, 0xf9, 0xd8, 0x6c, 0x1f, 0xe1, 0x3d, 0xd3, + 0x3a, 0x41, 0x77, 0xe1, 0x82, 0xed, 0x5a, 0x5d, 0xa2, 0xb5, 0x31, 0xe8, 0x78, 0x51, 0xd4, 0xbd, + 0x85, 0xfb, 0xe8, 0x45, 0x00, 0xeb, 0x18, 0x5b, 0x27, 0x1d, 0xd7, 0x69, 0x07, 0x7c, 0x94, 0xab, + 0x91, 0x51, 0xca, 0x61, 0xa3, 0x1e, 0x01, 0xa2, 0x3c, 0x64, 0x7c, 0x6e, 0x61, 0x2e, 0x71, 0x47, + 0x5a, 0xbd, 0xa0, 0x87, 0x65, 0x74, 0x1f, 0xd2, 0x16, 0xd5, 0xc1, 0xcf, 0x29, 0x74, 0x5e, 0x2e, + 0x0f, 0xf5, 0x47, 0x5a, 0x74, 0x81, 0x40, 0x25, 0xb8, 0xdc, 0x72, 0xda, 0x86, 0xdf, 0x6f, 0x5b, + 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x8d, 0x0f, + 0x5a, 0xf4, 0x7b, 0x97, 0x02, 0xb7, 0x17, 0x74, 0x20, 0x72, 0xac, 0x84, 0x4a, 0x40, 0x4b, 0x86, + 0xe9, 0x79, 0x66, 0x9f, 0xdb, 0x7f, 0x67, 0x4a, 0x27, 0x25, 0x82, 0x23, 0x07, 0x49, 0x22, 0x45, + 0x0b, 0xec, 0x3f, 0x9b, 0xd3, 0x72, 0x02, 0x27, 0xfc, 0x1b, 0x30, 0xa9, 0x87, 0x3d, 0x81, 0x23, + 0x3d, 0x84, 0x42, 0x68, 0x03, 0x94, 0x00, 0x3f, 0x16, 0x34, 0xba, 0x39, 0x41, 0x98, 0x6c, 0xc6, + 0xe4, 0x90, 0x4f, 0xa0, 0xe8, 0x15, 0x92, 0x3f, 0x76, 0xdb, 0x01, 0xf6, 0x78, 0x00, 0x58, 0x99, + 0x20, 0x55, 0x66, 0xa8, 0xed, 0x05, 0x5d, 0x08, 0xd0, 0xe1, 0x3c, 0x2c, 0x0e, 0xfa, 0x13, 0x87, + 0xf3, 0x30, 0xfd, 0x77, 0x41, 0xa0, 0xf9, 0x4f, 0x24, 0x80, 0xc1, 0x1c, 0xa2, 0x55, 0x48, 0xb6, + 0x49, 0x54, 0xca, 0x49, 0x74, 0x25, 0x45, 0x57, 0x9d, 0xbe, 0xdd, 0x20, 0x01, 0x4b, 0x67, 0x80, + 0x39, 0xcf, 0x17, 0x51, 0x4e, 0x26, 0xe6, 0xe0, 0xa4, 0x32, 0x1b, 0x27, 0xf3, 0x7f, 0x92, 0x40, + 0x0d, 0xbd, 0x3a, 0xd5, 0xaa, 0x07, 0xa5, 0xaf, 0x8e, 0x55, 0x7f, 0x97, 0x40, 0x0d, 0x99, 0x16, + 0xae, 0x3b, 0x69, 0xf6, 0x75, 0x27, 0x47, 0xd6, 0xdd, 0x9c, 0xa7, 0xdb, 0xa8, 0xad, 0xca, 0x1c, + 0xb6, 0x26, 0x67, 0xb4, 0xf5, 0x8f, 0x12, 0x28,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a, + 0x62, 0x0e, 0xca, 0xfb, 0x0f, 0x49, 0x89, 0xc5, 0x03, 0x12, 0x49, 0xa6, 0x80, 0xde, 0x2e, 0x35, + 0xca, 0xdb, 0x5a, 0x25, 0x2b, 0xa1, 0x67, 0xe0, 0xee, 0x24, 0xd0, 0x7e, 0x4d, 0xc0, 0xe4, 0x69, + 0xb0, 0x2d, 0x7d, 0xb7, 0x54, 0x29, 0x97, 0xea, 0x8d, 0x6c, 0x62, 0xeb, 0xfe, 0xef, 0x3e, 0x5d, + 0x91, 0x3e, 0xfe, 0x74, 0x45, 0xfa, 0xcb, 0xa7, 0x2b, 0xd2, 0xcf, 0x3e, 0x5b, 0x59, 0x80, 0xcb, + 0x36, 0xee, 0x09, 0xce, 0x98, 0x1d, 0xa7, 0xd8, 0xdb, 0xd8, 0x93, 0xde, 0x55, 0x8a, 0xaf, 0xf6, + 0x36, 0x0e, 0x52, 0x34, 0x62, 0x3f, 0xff, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x49, 0x47, + 0x88, 0xb4, 0x29, 0x00, 0x00, } func (m *Snapshot) Marshal() (dAtA []byte, err error) { @@ -6760,6 +6831,47 @@ func (m *TimeTicket) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DocEventBody) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DocEventBody) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DocEventBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintResources(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x12 + } + if len(m.Topic) > 0 { + i -= len(m.Topic) + copy(dAtA[i:], m.Topic) + i = encodeVarintResources(dAtA, i, uint64(len(m.Topic))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *DocEvent) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -6784,6 +6896,18 @@ func (m *DocEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintResources(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if len(m.Publisher) > 0 { i -= len(m.Publisher) copy(dAtA[i:], m.Publisher) @@ -8197,6 +8321,26 @@ func (m *TimeTicket) Size() (n int) { return n } +func (m *DocEventBody) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Topic) + if l > 0 { + n += 1 + l + sovResources(uint64(l)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovResources(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *DocEvent) Size() (n int) { if m == nil { return 0 @@ -8210,6 +8354,10 @@ func (m *DocEvent) Size() (n int) { if l > 0 { n += 1 + l + sovResources(uint64(l)) } + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovResources(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -16950,6 +17098,123 @@ func (m *TimeTicket) Unmarshal(dAtA []byte) error { } return nil } +func (m *DocEventBody) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResources + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DocEventBody: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DocEventBody: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResources + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthResources + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthResources + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topic = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResources + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthResources + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthResources + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipResources(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthResources + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *DocEvent) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -17030,6 +17295,42 @@ func (m *DocEvent) Unmarshal(dAtA []byte) error { } m.Publisher = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResources + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthResources + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthResources + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &DocEventBody{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipResources(dAtA[iNdEx:]) diff --git a/api/yorkie/v1/resources.proto b/api/yorkie/v1/resources.proto index 75947b1df..8c896bf80 100644 --- a/api/yorkie/v1/resources.proto +++ b/api/yorkie/v1/resources.proto @@ -358,9 +358,16 @@ enum DocEventType { DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; + DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; +} + +message DocEventBody { + string topic = 1; + bytes payload = 2; } message DocEvent { DocEventType type = 1; string publisher = 2; + DocEventBody body = 3; } diff --git a/api/yorkie/v1/yorkie.pb.go b/api/yorkie/v1/yorkie.pb.go index 8af66bd68..5e71c30ca 100644 --- a/api/yorkie/v1/yorkie.pb.go +++ b/api/yorkie/v1/yorkie.pb.go @@ -852,6 +852,116 @@ func (m *PushPullChangesResponse) GetChangePack() *ChangePack { return nil } +type BroadcastRequest struct { + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + DocumentId string `protobuf:"bytes,2,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty"` + Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` + Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BroadcastRequest) Reset() { *m = BroadcastRequest{} } +func (m *BroadcastRequest) String() string { return proto.CompactTextString(m) } +func (*BroadcastRequest) ProtoMessage() {} +func (*BroadcastRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_40070c858814ab24, []int{14} +} +func (m *BroadcastRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BroadcastRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BroadcastRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BroadcastRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BroadcastRequest.Merge(m, src) +} +func (m *BroadcastRequest) XXX_Size() int { + return m.Size() +} +func (m *BroadcastRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BroadcastRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BroadcastRequest proto.InternalMessageInfo + +func (m *BroadcastRequest) GetClientId() string { + if m != nil { + return m.ClientId + } + return "" +} + +func (m *BroadcastRequest) GetDocumentId() string { + if m != nil { + return m.DocumentId + } + return "" +} + +func (m *BroadcastRequest) GetTopic() string { + if m != nil { + return m.Topic + } + return "" +} + +func (m *BroadcastRequest) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +type BroadcastResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BroadcastResponse) Reset() { *m = BroadcastResponse{} } +func (m *BroadcastResponse) String() string { return proto.CompactTextString(m) } +func (*BroadcastResponse) ProtoMessage() {} +func (*BroadcastResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_40070c858814ab24, []int{15} +} +func (m *BroadcastResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BroadcastResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BroadcastResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BroadcastResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BroadcastResponse.Merge(m, src) +} +func (m *BroadcastResponse) XXX_Size() int { + return m.Size() +} +func (m *BroadcastResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BroadcastResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BroadcastResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*ActivateClientRequest)(nil), "yorkie.v1.ActivateClientRequest") proto.RegisterType((*ActivateClientResponse)(nil), "yorkie.v1.ActivateClientResponse") @@ -868,53 +978,59 @@ func init() { proto.RegisterType((*RemoveDocumentResponse)(nil), "yorkie.v1.RemoveDocumentResponse") proto.RegisterType((*PushPullChangesRequest)(nil), "yorkie.v1.PushPullChangesRequest") proto.RegisterType((*PushPullChangesResponse)(nil), "yorkie.v1.PushPullChangesResponse") + proto.RegisterType((*BroadcastRequest)(nil), "yorkie.v1.BroadcastRequest") + proto.RegisterType((*BroadcastResponse)(nil), "yorkie.v1.BroadcastResponse") } func init() { proto.RegisterFile("yorkie/v1/yorkie.proto", fileDescriptor_40070c858814ab24) } var fileDescriptor_40070c858814ab24 = []byte{ - // 650 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xce, 0xf6, 0x9f, 0x9a, 0x89, 0xda, 0xdf, 0x8f, 0x2d, 0x49, 0x43, 0x2a, 0x52, 0xb3, 0x5c, - 0x2a, 0x55, 0x72, 0x48, 0x2b, 0x7a, 0xe1, 0xd4, 0x36, 0x48, 0x8d, 0x90, 0x20, 0x18, 0x44, 0xd5, - 0x4a, 0xc8, 0x72, 0xed, 0x2d, 0x59, 0xc5, 0xf5, 0xa6, 0xf6, 0xda, 0x92, 0x79, 0x00, 0x6e, 0xdc, - 0x79, 0x07, 0xde, 0x82, 0x13, 0x47, 0x8e, 0x1c, 0x51, 0x79, 0x11, 0x14, 0xdb, 0x4d, 0xbd, 0xee, - 0x92, 0x16, 0x8a, 0x04, 0xb7, 0xcd, 0xec, 0x37, 0xdf, 0x7c, 0x3b, 0x99, 0xf9, 0x64, 0xa8, 0xc5, - 0xdc, 0x1f, 0x30, 0xda, 0x8a, 0xda, 0xad, 0xf4, 0xa4, 0x0f, 0x7d, 0x2e, 0x38, 0x2e, 0x67, 0xbf, - 0xa2, 0x76, 0xe3, 0xce, 0x05, 0xc4, 0xa7, 0x01, 0x0f, 0x7d, 0x9b, 0x06, 0x29, 0x8a, 0x6c, 0x41, - 0x75, 0xdb, 0x16, 0x2c, 0xb2, 0x04, 0xdd, 0x75, 0x19, 0xf5, 0x84, 0x41, 0x4f, 0x43, 0x1a, 0x08, - 0x7c, 0x17, 0xc0, 0x4e, 0x02, 0xe6, 0x80, 0xc6, 0x75, 0xa4, 0xa1, 0xb5, 0xb2, 0x51, 0x4e, 0x23, - 0x4f, 0x68, 0x4c, 0x1e, 0x42, 0xad, 0x98, 0x17, 0x0c, 0xb9, 0x17, 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0x74, 0x4a, 0x2c, 0x1b, 0x91, 0x44, 0xac, 0xf4, 0x59, - 0x89, 0x58, 0xed, 0x62, 0x29, 0xb1, 0x3c, 0xce, 0x12, 0xb1, 0x72, 0xf1, 0x24, 0x62, 0xf5, 0x2e, - 0x90, 0x12, 0x3e, 0x84, 0xff, 0x0a, 0x73, 0x82, 0xf3, 0x79, 0xea, 0x81, 0x6f, 0x90, 0x49, 0x90, - 0x31, 0xf7, 0x2b, 0x58, 0x90, 0x3c, 0x0b, 0xaf, 0xfe, 0xdc, 0xcd, 0x52, 0x5e, 0xed, 0x2a, 0xbb, - 0x23, 0xa5, 0x07, 0x68, 0x67, 0xfd, 0xf3, 0x59, 0x13, 0x7d, 0x39, 0x6b, 0xa2, 0x6f, 0x67, 0x4d, - 0xf4, 0xe1, 0x7b, 0xb3, 0x04, 0xb7, 0x1c, 0x1a, 0x9d, 0xa7, 0x5a, 0x43, 0xa6, 0x47, 0xed, 0x1e, - 0x3a, 0x9c, 0xd1, 0x1f, 0x45, 0xed, 0xa3, 0xb9, 0xe4, 0x5b, 0x64, 0xf3, 0x47, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x8c, 0xb9, 0x33, 0xc1, 0xcb, 0x08, 0x00, 0x00, + // 715 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x4f, 0xdb, 0x4a, + 0x10, 0xcf, 0xf2, 0xef, 0x91, 0xc9, 0x83, 0x07, 0x0b, 0x09, 0x79, 0xe1, 0xbd, 0x90, 0x6e, 0x2f, + 0x48, 0x48, 0x49, 0x03, 0x2a, 0x97, 0x9e, 0x80, 0x54, 0x22, 0xaa, 0xd4, 0xa6, 0x6e, 0x55, 0x04, + 0x52, 0x65, 0x2d, 0xf6, 0xd2, 0xac, 0x62, 0xbc, 0xc6, 0xde, 0x58, 0x72, 0x4f, 0xfd, 0x02, 0xbd, + 0xf7, 0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 0xe4, 0xf0, 0x11, 0xfc, 0x93, 0xea, 0x5f, 0x1c, 0x8f, 0xcb, 0x16, 0x62, 0x85, 0x8c, 0x73, + 0x19, 0x61, 0xbf, 0x82, 0xb9, 0xc4, 0x2c, 0xc5, 0x6b, 0x3f, 0x9e, 0xb2, 0x0a, 0xb7, 0x76, 0xdd, + 0x18, 0x26, 0xb9, 0x07, 0x08, 0xef, 0x43, 0x7e, 0xd4, 0x9d, 0x78, 0x35, 0x16, 0x92, 0x56, 0x4d, + 0xe5, 0xbf, 0xec, 0xcb, 0x21, 0xd6, 0xee, 0xc6, 0xe7, 0x8b, 0x2a, 0x3a, 0xbf, 0xa8, 0xa2, 0xaf, + 0x17, 0x55, 0xf4, 0xe1, 0x5b, 0x35, 0x07, 0x8b, 0x26, 0xf3, 0x87, 0x41, 0xd4, 0xe1, 0x75, 0xbf, + 0xd9, 0x41, 0x47, 0x53, 0xf5, 0x47, 0x7e, 0xf3, 0x78, 0x26, 0xfc, 0xb7, 0xb5, 0xf5, 0x3d, 0x00, + 0x00, 0xff, 0xff, 0x99, 0x77, 0x1a, 0xa9, 0xad, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -936,6 +1052,7 @@ type YorkieServiceClient interface { RemoveDocument(ctx context.Context, in *RemoveDocumentRequest, opts ...grpc.CallOption) (*RemoveDocumentResponse, error) PushPullChanges(ctx context.Context, in *PushPullChangesRequest, opts ...grpc.CallOption) (*PushPullChangesResponse, error) WatchDocument(ctx context.Context, in *WatchDocumentRequest, opts ...grpc.CallOption) (YorkieService_WatchDocumentClient, error) + Broadcast(ctx context.Context, in *BroadcastRequest, opts ...grpc.CallOption) (*BroadcastResponse, error) } type yorkieServiceClient struct { @@ -1032,6 +1149,15 @@ func (x *yorkieServiceWatchDocumentClient) Recv() (*WatchDocumentResponse, error return m, nil } +func (c *yorkieServiceClient) Broadcast(ctx context.Context, in *BroadcastRequest, opts ...grpc.CallOption) (*BroadcastResponse, error) { + out := new(BroadcastResponse) + err := c.cc.Invoke(ctx, "/yorkie.v1.YorkieService/Broadcast", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // YorkieServiceServer is the server API for YorkieService service. type YorkieServiceServer interface { ActivateClient(context.Context, *ActivateClientRequest) (*ActivateClientResponse, error) @@ -1041,6 +1167,7 @@ type YorkieServiceServer interface { RemoveDocument(context.Context, *RemoveDocumentRequest) (*RemoveDocumentResponse, error) PushPullChanges(context.Context, *PushPullChangesRequest) (*PushPullChangesResponse, error) WatchDocument(*WatchDocumentRequest, YorkieService_WatchDocumentServer) error + Broadcast(context.Context, *BroadcastRequest) (*BroadcastResponse, error) } // UnimplementedYorkieServiceServer can be embedded to have forward compatible implementations. @@ -1068,6 +1195,9 @@ func (*UnimplementedYorkieServiceServer) PushPullChanges(ctx context.Context, re func (*UnimplementedYorkieServiceServer) WatchDocument(req *WatchDocumentRequest, srv YorkieService_WatchDocumentServer) error { return status.Errorf(codes.Unimplemented, "method WatchDocument not implemented") } +func (*UnimplementedYorkieServiceServer) Broadcast(ctx context.Context, req *BroadcastRequest) (*BroadcastResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Broadcast not implemented") +} func RegisterYorkieServiceServer(s *grpc.Server, srv YorkieServiceServer) { s.RegisterService(&_YorkieService_serviceDesc, srv) @@ -1202,6 +1332,24 @@ func (x *yorkieServiceWatchDocumentServer) Send(m *WatchDocumentResponse) error return x.ServerStream.SendMsg(m) } +func _YorkieService_Broadcast_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BroadcastRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(YorkieServiceServer).Broadcast(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/yorkie.v1.YorkieService/Broadcast", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(YorkieServiceServer).Broadcast(ctx, req.(*BroadcastRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _YorkieService_serviceDesc = grpc.ServiceDesc{ ServiceName: "yorkie.v1.YorkieService", HandlerType: (*YorkieServiceServer)(nil), @@ -1230,6 +1378,10 @@ var _YorkieService_serviceDesc = grpc.ServiceDesc{ MethodName: "PushPullChanges", Handler: _YorkieService_PushPullChanges_Handler, }, + { + MethodName: "Broadcast", + Handler: _YorkieService_Broadcast_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -1913,6 +2065,88 @@ func (m *PushPullChangesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *BroadcastRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BroadcastRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BroadcastRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintYorkie(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x22 + } + if len(m.Topic) > 0 { + i -= len(m.Topic) + copy(dAtA[i:], m.Topic) + i = encodeVarintYorkie(dAtA, i, uint64(len(m.Topic))) + i-- + dAtA[i] = 0x1a + } + if len(m.DocumentId) > 0 { + i -= len(m.DocumentId) + copy(dAtA[i:], m.DocumentId) + i = encodeVarintYorkie(dAtA, i, uint64(len(m.DocumentId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintYorkie(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BroadcastResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BroadcastResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BroadcastResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + func encodeVarintYorkie(dAtA []byte, offset int, v uint64) int { offset -= sovYorkie(v) base := offset @@ -2227,6 +2461,46 @@ func (m *PushPullChangesResponse) Size() (n int) { return n } +func (m *BroadcastRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovYorkie(uint64(l)) + } + l = len(m.DocumentId) + if l > 0 { + n += 1 + l + sovYorkie(uint64(l)) + } + l = len(m.Topic) + if l > 0 { + n += 1 + l + sovYorkie(uint64(l)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovYorkie(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BroadcastResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovYorkie(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3844,6 +4118,238 @@ func (m *PushPullChangesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *BroadcastRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYorkie + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BroadcastRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BroadcastRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYorkie + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthYorkie + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYorkie + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DocumentId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYorkie + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthYorkie + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYorkie + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DocumentId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYorkie + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthYorkie + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthYorkie + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topic = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYorkie + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthYorkie + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthYorkie + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipYorkie(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthYorkie + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BroadcastResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowYorkie + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BroadcastResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BroadcastResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipYorkie(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthYorkie + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipYorkie(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/api/yorkie/v1/yorkie.proto b/api/yorkie/v1/yorkie.proto index 639ddd37d..da71d6a11 100644 --- a/api/yorkie/v1/yorkie.proto +++ b/api/yorkie/v1/yorkie.proto @@ -35,6 +35,8 @@ service YorkieService { rpc PushPullChanges (PushPullChangesRequest) returns (PushPullChangesResponse) {} rpc WatchDocument (WatchDocumentRequest) returns (stream WatchDocumentResponse) {} + + rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {} } message ActivateClientRequest { @@ -109,3 +111,13 @@ message PushPullChangesRequest { message PushPullChangesResponse { ChangePack change_pack = 1; } + +message BroadcastRequest { + string client_id = 1; + string document_id = 2; + string topic = 3; + bytes payload = 4; +} + +message BroadcastResponse { +} diff --git a/client/client.go b/client/client.go index 453fccbb6..63e65054c 100644 --- a/client/client.go +++ b/client/client.go @@ -98,6 +98,7 @@ const ( DocumentWatched WatchResponseType = "document-watched" DocumentUnwatched WatchResponseType = "document-unwatched" PresenceChanged WatchResponseType = "presence-changed" + DocumentBroadcast WatchResponseType = "document-broadcast" ) // WatchResponse is a structure representing response of Watch. @@ -420,69 +421,11 @@ func (c *Client) Watch( return nil, err } - handleResponse := func(pbResp *api.WatchDocumentResponse) (*WatchResponse, error) { - switch resp := pbResp.Body.(type) { - case *api.WatchDocumentResponse_Initialization_: - var clientIDs []string - for _, clientID := range resp.Initialization.ClientIds { - id, err := time.ActorIDFromHex(clientID) - if err != nil { - return nil, err - } - clientIDs = append(clientIDs, id.String()) - } - - doc.SetOnlineClients(clientIDs...) - return nil, nil - case *api.WatchDocumentResponse_Event: - eventType, err := converter.FromEventType(resp.Event.Type) - if err != nil { - return nil, err - } - - cli, err := time.ActorIDFromHex(resp.Event.Publisher) - if err != nil { - return nil, err - } - - switch eventType { - case types.DocumentChangedEvent: - return &WatchResponse{Type: DocumentChanged}, nil - case types.DocumentWatchedEvent: - doc.AddOnlineClient(cli.String()) - if doc.Presence(cli.String()) == nil { - return nil, nil - } - - return &WatchResponse{ - Type: DocumentWatched, - Presences: map[string]innerpresence.Presence{ - cli.String(): doc.Presence(cli.String()), - }, - }, nil - case types.DocumentUnwatchedEvent: - p := doc.Presence(cli.String()) - doc.RemoveOnlineClient(cli.String()) - if p == nil { - return nil, nil - } - - return &WatchResponse{ - Type: DocumentUnwatched, - Presences: map[string]innerpresence.Presence{ - cli.String(): p, - }, - }, nil - } - } - return nil, ErrUnsupportedWatchResponseType - } - pbResp, err := stream.Recv() if err != nil { return nil, err } - if _, err := handleResponse(pbResp); err != nil { + if _, err := handleResponse(pbResp, doc); err != nil { return nil, err } @@ -494,7 +437,7 @@ func (c *Client) Watch( close(rch) return } - resp, err := handleResponse(pbResp) + resp, err := handleResponse(pbResp, doc) if err != nil { rch <- WatchResponse{Err: err} close(rch) @@ -534,10 +477,96 @@ func (c *Client) Watch( } }() + go func() { + for { + select { + case r := <-doc.BroadcastRequests(): + doc.BroadcastResponses() <- c.broadcast(ctx, doc, r.Topic, r.Payload) + case <-ctx.Done(): + return + } + } + }() + return rch, nil } -func (c *Client) findDocKey(docID string) (key.Key, error) { +func handleResponse( + pbResp *api.WatchDocumentResponse, + doc *document.Document, +) (*WatchResponse, error) { + switch resp := pbResp.Body.(type) { + case *api.WatchDocumentResponse_Initialization_: + var clientIDs []string + for _, clientID := range resp.Initialization.ClientIds { + id, err := time.ActorIDFromHex(clientID) + if err != nil { + return nil, err + } + clientIDs = append(clientIDs, id.String()) + } + + doc.SetOnlineClients(clientIDs...) + return nil, nil + case *api.WatchDocumentResponse_Event: + eventType, err := converter.FromEventType(resp.Event.Type) + if err != nil { + return nil, err + } + + cli, err := time.ActorIDFromHex(resp.Event.Publisher) + if err != nil { + return nil, err + } + + switch eventType { + case types.DocumentChangedEvent: + return &WatchResponse{Type: DocumentChanged}, nil + case types.DocumentWatchedEvent: + doc.AddOnlineClient(cli.String()) + if doc.Presence(cli.String()) == nil { + return nil, nil + } + + return &WatchResponse{ + Type: DocumentWatched, + Presences: map[string]innerpresence.Presence{ + cli.String(): doc.Presence(cli.String()), + }, + }, nil + case types.DocumentUnwatchedEvent: + p := doc.Presence(cli.String()) + doc.RemoveOnlineClient(cli.String()) + if p == nil { + return nil, nil + } + + return &WatchResponse{ + Type: DocumentUnwatched, + Presences: map[string]innerpresence.Presence{ + cli.String(): p, + }, + }, nil + case types.DocumentBroadcastEvent: + eventBody := resp.Event.Body + // If the handler exists, it means that the broadcast topic has been subscribed to. + if handler, ok := doc.BroadcastEventHandlers()[eventBody.Topic]; ok && handler != nil { + err := handler(eventBody.Topic, resp.Event.Publisher, eventBody.Payload) + if err != nil { + return &WatchResponse{ + Type: DocumentBroadcast, + Err: err, + }, nil + } + } + return nil, nil + } + } + return nil, ErrUnsupportedWatchResponseType +} + +// FindDocKey returns the document key of the given document id. +func (c *Client) FindDocKey(docID string) (key.Key, error) { for _, attachment := range c.attachments { if attachment.docID.String() == docID { return attachment.doc.Key(), nil @@ -650,6 +679,32 @@ func (c *Client) Remove(ctx context.Context, doc *document.Document) error { return nil } +func (c *Client) broadcast(ctx context.Context, doc *document.Document, topic string, payload []byte) error { + if c.status != activated { + return ErrClientNotActivated + } + + attachment, ok := c.attachments[doc.Key()] + if !ok { + return ErrDocumentNotAttached + } + + _, err := c.client.Broadcast( + withShardKey(ctx, c.options.APIKey, doc.Key().String()), + &api.BroadcastRequest{ + ClientId: c.id.String(), + DocumentId: attachment.docID.String(), + Topic: topic, + Payload: payload, + }, + ) + if err != nil { + return err + } + + return nil +} + /** * withShardKey returns a context with the given shard key in metadata. */ diff --git a/pkg/document/document.go b/pkg/document/document.go index d9ca6b2dd..347b25507 100644 --- a/pkg/document/document.go +++ b/pkg/document/document.go @@ -18,6 +18,8 @@ package document import ( + gojson "encoding/json" + "errors" "fmt" "github.com/yorkie-team/yorkie/pkg/document/change" @@ -29,6 +31,11 @@ import ( "github.com/yorkie-team/yorkie/pkg/document/time" ) +var ( + // ErrUnsupportedPayloadType is returned when the payload is unserializable to JSON. + ErrUnsupportedPayloadType = errors.New("unsupported payload type") +) + // DocEvent represents the event that occurred in the document. type DocEvent struct { Type DocEventType @@ -52,6 +59,12 @@ const ( PresenceChangedEvent DocEventType = "presence-changed" ) +// BroadcastRequest represents a broadcast request that will be delivered to the client. +type BroadcastRequest struct { + Topic string + Payload []byte +} + // Document represents a document accessible to the user. // // How document works: @@ -73,13 +86,29 @@ type Document struct { // events is the channel to send events that occurred in the document. events chan DocEvent + + // broadcastRequests is the send-only channel to send broadcast requests. + broadcastRequests chan BroadcastRequest + + // broadcastResponses is the receive-only channel to receive broadcast responses. + broadcastResponses chan error + + // broadcastEventHandlers is a map of registered event handlers for events. + broadcastEventHandlers map[string]func( + topic, publisher string, + payload []byte) error } // New creates a new instance of Document. func New(key key.Key) *Document { return &Document{ - doc: NewInternalDocument(key), - events: make(chan DocEvent, 1), + doc: NewInternalDocument(key), + events: make(chan DocEvent, 1), + broadcastRequests: make(chan BroadcastRequest, 1), + broadcastResponses: make(chan error, 1), + broadcastEventHandlers: make(map[string]func( + topic, publisher string, + payload []byte) error), } } @@ -335,6 +364,56 @@ func (d *Document) Events() <-chan DocEvent { return d.events } +// BroadcastRequests returns the broadcast requests of this document. +func (d *Document) BroadcastRequests() <-chan BroadcastRequest { + return d.broadcastRequests +} + +// BroadcastResponses returns the broadcast responses of this document. +func (d *Document) BroadcastResponses() chan error { + return d.broadcastResponses +} + +// Broadcast encodes the given payload and sends a Broadcast request. +func (d *Document) Broadcast(topic string, payload any) error { + marshaled, err := gojson.Marshal(payload) + if err != nil { + return ErrUnsupportedPayloadType + } + + d.broadcastRequests <- BroadcastRequest{ + Topic: topic, + Payload: marshaled, + } + return <-d.broadcastResponses +} + +// SubscribeBroadcastEvent subscribes to the given topic and registers +// an event handler. +func (d *Document) SubscribeBroadcastEvent( + topic string, + handler func(topic, publisher string, payload []byte) error, +) { + d.broadcastEventHandlers[topic] = handler +} + +// UnsubscribeBroadcastEvent unsubscribes to the given topic and deregisters +// the event handler. +func (d *Document) UnsubscribeBroadcastEvent( + topic string, +) { + delete(d.broadcastEventHandlers, topic) +} + +// BroadcastEventHandlers returns the registered handlers for broadcast events. +func (d *Document) BroadcastEventHandlers() map[string]func( + topic string, + publisher string, + payload []byte, +) error { + return d.broadcastEventHandlers +} + func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { if len(msgAndArgs) == 0 { return "" diff --git a/pkg/document/time/actor_id.go b/pkg/document/time/actor_id.go index 98d1da177..a2bcb61f6 100644 --- a/pkg/document/time/actor_id.go +++ b/pkg/document/time/actor_id.go @@ -56,8 +56,10 @@ var ( ErrInvalidActorID = errors.New("invalid actor id") ) -// ActorID is bytes represented by the hexadecimal string. -// It should be generated by unique value. +// ActorID represents the unique ID of the client. It is composed of 12 bytes. +// It caches the string representation of ActorID to reduce the number of calls +// to hex.EncodeToString. This causes a multi-routine problem, so it is +// recommended to use it in a single routine or to use it after locking. type ActorID struct { bytes [actorIDSize]byte diff --git a/server/backend/sync/coordinator.go b/server/backend/sync/coordinator.go index deab2105c..764a942d6 100644 --- a/server/backend/sync/coordinator.go +++ b/server/backend/sync/coordinator.go @@ -54,9 +54,6 @@ type Coordinator interface { // Publish publishes the given event. Publish(ctx context.Context, publisherID *time.ActorID, event DocEvent) - // PublishToLocal publishes the given event. - PublishToLocal(ctx context.Context, publisherID *time.ActorID, event DocEvent) - // Members returns the members of this cluster. Members() map[string]*ServerInfo diff --git a/server/backend/sync/memory/coordinator.go b/server/backend/sync/memory/coordinator.go index 57b6ca909..dfc0e1542 100644 --- a/server/backend/sync/memory/coordinator.go +++ b/server/backend/sync/memory/coordinator.go @@ -85,15 +85,9 @@ func (c *Coordinator) Publish( publisherID *time.ActorID, event sync.DocEvent, ) { - c.pubSub.Publish(ctx, publisherID, event) -} - -// PublishToLocal publishes the given event. -func (c *Coordinator) PublishToLocal( - ctx context.Context, - publisherID *time.ActorID, - event sync.DocEvent, -) { + // NOTE(hackerwins): String() triggers the cache of ActorID to avoid + // race condition of concurrent access to the cache. + _ = event.Publisher.String() c.pubSub.Publish(ctx, publisherID, event) } diff --git a/server/backend/sync/pubsub.go b/server/backend/sync/pubsub.go index 80ce74164..c4551b176 100644 --- a/server/backend/sync/pubsub.go +++ b/server/backend/sync/pubsub.go @@ -50,6 +50,7 @@ type DocEvent struct { Type types.DocEventType Publisher *time.ActorID DocumentID types.ID + Body types.DocEventBody } // Events returns the DocEvent channel of this subscription. diff --git a/server/rpc/yorkie_server.go b/server/rpc/yorkie_server.go index c0c2aef09..f3fa6bc67 100644 --- a/server/rpc/yorkie_server.go +++ b/server/rpc/yorkie_server.go @@ -422,6 +422,10 @@ func (s *yorkieServer) WatchDocument( Event: &api.DocEvent{ Type: eventType, Publisher: event.Publisher.String(), + Body: &api.DocEventBody{ + Topic: event.Body.Topic, + Payload: event.Body.Payload, + }, }, }, }); err != nil { @@ -542,3 +546,57 @@ func (s *yorkieServer) unwatchDoc( }, ) } + +func (s *yorkieServer) Broadcast( + ctx context.Context, + req *api.BroadcastRequest, +) (*api.BroadcastResponse, error) { + clientID, err := time.ActorIDFromHex(req.ClientId) + if err != nil { + return nil, err + } + + docID, err := converter.FromDocumentID(req.DocumentId) + if err != nil { + return nil, err + } + + docInfo, err := documents.FindDocInfo( + ctx, + s.backend, + projects.From(ctx), + docID, + ) + if err != nil { + return nil, err + } + + // TODO(sejongk): It seems better to use a separate auth attributes for broadcast later + if err := auth.VerifyAccess(ctx, s.backend, &types.AccessInfo{ + Method: types.Broadcast, + Attributes: types.NewAccessAttributes([]key.Key{docInfo.Key}, types.Read), + }); err != nil { + return nil, err + } + + project := projects.From(ctx) + if _, err = clients.FindClientInfo(ctx, s.backend.DB, project, clientID); err != nil { + return nil, err + } + + s.backend.Coordinator.Publish( + ctx, + clientID, + sync.DocEvent{ + Type: types.DocumentBroadcastEvent, + Publisher: clientID, + DocumentID: docID, + Body: types.DocEventBody{ + Topic: req.Topic, + Payload: req.Payload, + }, + }, + ) + + return &api.BroadcastResponse{}, nil +} diff --git a/test/integration/document_test.go b/test/integration/document_test.go index c190fe9ae..84c49d66d 100644 --- a/test/integration/document_test.go +++ b/test/integration/document_test.go @@ -20,9 +20,12 @@ package integration import ( "context" + gojson "encoding/json" + "errors" "io" "sync" "testing" + "time" "github.com/stretchr/testify/assert" @@ -35,8 +38,8 @@ import ( ) func TestDocument(t *testing.T) { - clients := activeClients(t, 2) - c1, c2 := clients[0], clients[1] + clients := activeClients(t, 3) + c1, c2, c3 := clients[0], clients[1], clients[2] defer deactivateAndCloseClients(t, clients) t.Run("attach/detach test", func(t *testing.T) { @@ -418,6 +421,252 @@ func TestDocument(t *testing.T) { _, err = c1.Watch(watchCtx, d1) assert.ErrorIs(t, err, client.ErrDocumentNotAttached) }) + + t.Run("broadcast to subscribers except publisher test", func(t *testing.T) { + bch := make(chan string) + ctx := context.Background() + handler := func(topic, publisher string, payload []byte) error { + var mentionedBy string + assert.Equal(t, topic, "mention") + assert.NoError(t, gojson.Unmarshal(payload, &mentionedBy)) + // Send the unmarshaled payload to the channel to notify that this + // subscriber receives the event. + bch <- mentionedBy + return nil + } + + d1 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c1.Attach(ctx, d1)) + rch1, err := c1.Watch(ctx, d1) + assert.NoError(t, err) + d1.SubscribeBroadcastEvent("mention", handler) + + d2 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c2.Attach(ctx, d2)) + rch2, err := c2.Watch(ctx, d2) + assert.NoError(t, err) + d2.SubscribeBroadcastEvent("mention", handler) + + d3 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c3.Attach(ctx, d3)) + rch3, err := c3.Watch(ctx, d3) + assert.NoError(t, err) + d3.SubscribeBroadcastEvent("mention", handler) + + err = d3.Broadcast("mention", "yorkie") + assert.NoError(t, err) + + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + rcv := 0 + for { + select { + case <-rch1: + case <-rch2: + case <-rch3: + case m := <-bch: + assert.Equal(t, "yorkie", m) + rcv++ + case <-time.After(1 * time.Second): + // Assuming that every subscriber can receive the broadcast + // event within this timeout period, check if every subscriber, + // except the publisher, successfully receives the event. + assert.Equal(t, 2, rcv) + return + case <-ctx.Done(): + return + } + } + }() + + wg.Wait() + }) + + t.Run("no broadcasts to unsubscribers", func(t *testing.T) { + bch := make(chan string) + ctx := context.Background() + handler := func(topic, publisher string, payload []byte) error { + var mentionedBy string + assert.Equal(t, topic, "mention") + assert.NoError(t, gojson.Unmarshal(payload, &mentionedBy)) + // Send the unmarshaled payload to the channel to notify that this + // subscriber receives the event. + bch <- mentionedBy + return nil + } + + d1 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c1.Attach(ctx, d1)) + rch1, err := c1.Watch(ctx, d1) + assert.NoError(t, err) + d1.SubscribeBroadcastEvent("mention", handler) + + d2 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c2.Attach(ctx, d2)) + rch2, err := c2.Watch(ctx, d2) + assert.NoError(t, err) + d2.SubscribeBroadcastEvent("mention", handler) + + // d1 unsubscribes to the broadcast event. + d1.UnsubscribeBroadcastEvent("mention") + + err = d2.Broadcast("mention", "yorkie") + assert.NoError(t, err) + + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + rcv := 0 + for { + select { + case <-rch1: + case <-rch2: + case m := <-bch: + assert.Equal(t, "yorkie", m) + rcv++ + case <-time.After(1 * time.Second): + // Assuming that every subscriber can receive the broadcast + // event within this timeout period, check if both the unsubscriber + // and the publisher don't receive the event. + assert.Equal(t, 0, rcv) + return + case <-ctx.Done(): + return + } + } + }() + + wg.Wait() + }) + + t.Run("unsubscriber can broadcast", func(t *testing.T) { + bch := make(chan string) + ctx := context.Background() + handler := func(topic, publisher string, payload []byte) error { + var mentionedBy string + assert.Equal(t, topic, "mention") + assert.NoError(t, gojson.Unmarshal(payload, &mentionedBy)) + // Send the unmarshaled payload to the channel to notify that this + // subscriber receives the event. + bch <- mentionedBy + return nil + } + + d1 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c1.Attach(ctx, d1)) + rch1, err := c1.Watch(ctx, d1) + assert.NoError(t, err) + d1.SubscribeBroadcastEvent("mention", handler) + + // c2 doesn't subscribe to the "mention" broadcast event. + d2 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c2.Attach(ctx, d2)) + rch2, err := c2.Watch(ctx, d2) + assert.NoError(t, err) + + // The unsubscriber c2 broadcasts the "mention" event. + err = d2.Broadcast("mention", "yorkie") + assert.NoError(t, err) + + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + rcv := 0 + for { + select { + case <-rch1: + case <-rch2: + case m := <-bch: + assert.Equal(t, "yorkie", m) + rcv++ + case <-time.After(1 * time.Second): + // Assuming that every subscriber can receive the broadcast + // event within this timeout period, check if every subscriber + // receives the unsubscriber's event. + assert.Equal(t, 1, rcv) + return + case <-ctx.Done(): + return + } + } + }() + + wg.Wait() + }) + + t.Run("reject to broadcast unserializable payload", func(t *testing.T) { + ctx := context.Background() + + d1 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c1.Attach(ctx, d1)) + _, err := c1.Watch(ctx, d1) + assert.NoError(t, err) + d1.SubscribeBroadcastEvent("mention", nil) + + // Try to broadcast an unserializable payload. + ch := make(chan string) + err = d1.Broadcast("mention", ch) + assert.ErrorIs(t, document.ErrUnsupportedPayloadType, err) + }) + + t.Run("error occurs while handling broadcast event", func(t *testing.T) { + var ErrBroadcastEventHandlingError = errors.New("") + + ctx := context.Background() + handler := func(topic, publisher string, payload []byte) error { + var mentionedBy string + assert.Equal(t, topic, "mention") + assert.NoError(t, gojson.Unmarshal(payload, &mentionedBy)) + return ErrBroadcastEventHandlingError + } + + d1 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c1.Attach(ctx, d1)) + rch1, err := c1.Watch(ctx, d1) + assert.NoError(t, err) + d1.SubscribeBroadcastEvent("mention", handler) + + d2 := document.New(helper.TestDocKey(t)) + assert.NoError(t, c2.Attach(ctx, d2)) + rch2, err := c2.Watch(ctx, d2) + assert.NoError(t, err) + d2.SubscribeBroadcastEvent("mention", handler) + + err = d2.Broadcast("mention", "yorkie") + assert.NoError(t, err) + + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + rcv := 0 + for { + select { + case resp := <-rch1: + if resp.Err != nil { + assert.Equal(t, resp.Type, client.DocumentBroadcast) + assert.ErrorIs(t, resp.Err, ErrBroadcastEventHandlingError) + rcv++ + } + case <-rch2: + case <-time.After(1 * time.Second): + // Assuming that every subscriber can receive the broadcast + // event within this timeout period, check if every subscriber + // successfully receives the event. + assert.Equal(t, 1, rcv) + return + case <-ctx.Done(): + return + } + } + }() + + wg.Wait() + }) } func TestDocumentWithProjects(t *testing.T) {