18
18
19
19
% % API
20
20
-export ([enforce_correct_name /1 ,
21
- <<<<<<< HEAD
22
- write_messages /4,
23
- =======
24
- write_messages /6,
25
- >>>>>>> 42 bdcfb8e4 (Add incremental ID for non - dedup stream publishers )
21
+ write_messages /5 ,
26
22
parse_map /2 ,
27
23
auth_mechanisms /1 ,
28
24
auth_mechanism_to_module /2 ,
@@ -58,30 +54,26 @@ check_name(<<"">>) ->
58
54
check_name (_Name ) ->
59
55
ok .
60
56
61
- <<<<<<< HEAD
62
- write_messages (_ClusterLeader , undefined , _PublisherId , <<>>) ->
63
- =======
64
- write_messages (_Version , _ClusterLeader , _PublisherRef , _PublisherId , _InternalId , <<>>) ->
65
- >>>>>>> 42 bdcfb8e4 (Add incremental ID for non - dedup stream publishers )
57
+ write_messages (_ClusterLeader , undefined , _PublisherId , _InternalId , <<>>) ->
66
58
ok ;
67
59
write_messages (ClusterLeader ,
68
60
undefined ,
69
61
PublisherId ,
62
+ InternalId ,
70
63
<<PublishingId :64 ,
71
64
0 :1 ,
72
65
MessageSize :31 ,
73
66
Message :MessageSize /binary ,
74
67
Rest /binary >>) ->
75
- % FIXME handle write error
76
- ok =
77
- osiris :write (ClusterLeader ,
78
- undefined ,
79
- {PublisherId , PublishingId },
80
- Message ),
81
- write_messages (ClusterLeader , undefined , PublisherId , Rest );
68
+ ok = osiris :write (ClusterLeader ,
69
+ undefined ,
70
+ {PublisherId , InternalId , PublishingId },
71
+ Message ),
72
+ write_messages (ClusterLeader , undefined , PublisherId , InternalId , Rest );
82
73
write_messages (ClusterLeader ,
83
74
undefined ,
84
75
PublisherId ,
76
+ InternalId ,
85
77
<<PublishingId :64 ,
86
78
1 :1 ,
87
79
CompressionType :3 ,
@@ -91,18 +83,16 @@ write_messages(ClusterLeader,
91
83
BatchSize :32 ,
92
84
Batch :BatchSize /binary ,
93
85
Rest /binary >>) ->
94
- % FIXME handle write error
95
- ok =
96
- osiris :write (ClusterLeader ,
97
- undefined ,
98
- {PublisherId , PublishingId },
99
- {batch ,
100
- MessageCount ,
101
- CompressionType ,
102
- UncompressedSize ,
103
- Batch }),
104
- write_messages (ClusterLeader , undefined , PublisherId , Rest );
105
- write_messages (_ClusterLeader , _PublisherRef , _PublisherId , <<>>) ->
86
+ ok = osiris :write (ClusterLeader ,
87
+ undefined ,
88
+ {PublisherId , InternalId , PublishingId },
89
+ {batch ,
90
+ MessageCount ,
91
+ CompressionType ,
92
+ UncompressedSize ,
93
+ Batch }),
94
+ write_messages (ClusterLeader , undefined , PublisherId , InternalId , Rest );
95
+ write_messages (_ClusterLeader , _PublisherRef , _PublisherId , _InternalId , <<>>) ->
106
96
ok ;
107
97
write_messages (ClusterLeader ,
108
98
PublisherRef ,
@@ -113,16 +103,9 @@ write_messages(ClusterLeader,
113
103
MessageSize :31 ,
114
104
Message :MessageSize /binary ,
115
105
Rest /binary >>) ->
116
- <<<<<<< HEAD
117
- % FIXME handle write error
118
106
ok = osiris :write (ClusterLeader , PublisherRef , PublishingId , Message ),
119
- write_messages (ClusterLeader , PublisherRef , PublisherId , Rest );
107
+ write_messages (ClusterLeader , PublisherRef , PublisherId , InternalId , Rest );
120
108
write_messages (ClusterLeader ,
121
- =======
122
- write_messages0 (V , ClusterLeader , PublisherRef , PublisherId , InternalId ,
123
- PublishingId , Message , Rest );
124
- write_messages (? VERSION_1 = V , ClusterLeader ,
125
- >>>>>>> 42 bdcfb8e4 (Add incremental ID for non - dedup stream publishers )
126
109
PublisherRef ,
127
110
PublisherId ,
128
111
InternalId ,
@@ -135,60 +118,15 @@ write_messages(?VERSION_1 = V, ClusterLeader,
135
118
BatchSize :32 ,
136
119
Batch :BatchSize /binary ,
137
120
Rest /binary >>) ->
138
- <<<<<<< HEAD
139
- % FIXME handle write error
140
- ok =
141
- osiris :write (ClusterLeader ,
142
- PublisherRef ,
143
- PublishingId ,
144
- {batch ,
145
- MessageCount ,
146
- CompressionType ,
147
- UncompressedSize ,
148
- Batch }),
149
- write_messages (ClusterLeader , PublisherRef , PublisherId , Rest ).
150
- =======
151
- Data = {batch , MessageCount , CompressionType , UncompressedSize , Batch },
152
- write_messages0 (V , ClusterLeader , PublisherRef , PublisherId , InternalId ,
153
- PublishingId , Data , Rest );
154
- write_messages (? VERSION_2 = V , ClusterLeader ,
155
- PublisherRef ,
156
- PublisherId ,
157
- InternalId ,
158
- <<PublishingId :64 ,
159
- - 1 :16 /signed ,
160
- 0 :1 ,
161
- MessageSize :31 ,
162
- Message :MessageSize /binary ,
163
- Rest /binary >>) ->
164
- write_messages0 (V , ClusterLeader , PublisherRef , PublisherId , InternalId ,
165
- PublishingId , Message , Rest );
166
- write_messages (? VERSION_2 = V , ClusterLeader ,
167
- PublisherRef ,
168
- PublisherId ,
169
- InternalId ,
170
- <<PublishingId :64 ,
171
- FilterValueLength :16 , FilterValue :FilterValueLength /binary ,
172
- 0 :1 ,
173
- MessageSize :31 ,
174
- Message :MessageSize /binary ,
175
- Rest /binary >>) ->
176
- write_messages0 (V , ClusterLeader , PublisherRef , PublisherId , InternalId ,
177
- PublishingId , {FilterValue , Message }, Rest ).
178
-
179
- write_messages0 (Vsn , ClusterLeader , PublisherRef , PublisherId , InternalId , PublishingId , Data , Rest ) ->
180
- Corr = case PublisherRef of
181
- undefined ->
182
- % % we add the internal ID to detect late confirms from a stale publisher
183
- {PublisherId , InternalId , PublishingId };
184
- _ ->
185
- % % we cannot add the internal ID because the correlation ID must be an integer
186
- % % when deduplication is activated.
187
- PublishingId
188
- end ,
189
- ok = osiris :write (ClusterLeader , PublisherRef , Corr , Data ),
190
- write_messages (Vsn , ClusterLeader , PublisherRef , PublisherId , InternalId , Rest ).
191
- >>>>>>> 42 bdcfb8e4 (Add incremental ID for non - dedup stream publishers )
121
+ ok = osiris :write (ClusterLeader ,
122
+ PublisherRef ,
123
+ PublishingId ,
124
+ {batch ,
125
+ MessageCount ,
126
+ CompressionType ,
127
+ UncompressedSize ,
128
+ Batch }),
129
+ write_messages (ClusterLeader , PublisherRef , PublisherId , InternalId , Rest ).
192
130
193
131
parse_map (<<>>, _Count ) ->
194
132
{#{}, <<>>};
0 commit comments