-
Notifications
You must be signed in to change notification settings - Fork 3
/
valuepullreplication_GEN_.go
582 lines (547 loc) · 19.5 KB
/
valuepullreplication_GEN_.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
package store
import (
"encoding/binary"
"io"
"math"
"sync"
"sync/atomic"
"time"
"github.com/gholt/brimtime"
"go.uber.org/zap"
)
const _VALUE_PULL_REPLICATION_MSG_TYPE = 0x579c4bd162f045b3
const _VALUE_PULL_REPLICATION_MSG_HEADER_BYTES = 44
type valuePullReplicationState struct {
inWorkers int
inMsgs int
inResponseMsgTimeout time.Duration
outInterval int
outIteration uint16
outWorkers uint64
outMsgs int
outMsgTimeout time.Duration
outBloomN uint64
outBloomP float64
inStartupShutdownLock sync.Mutex
inNotifyChan chan *bgNotification
inMsgChan chan *valuePullReplicationMsg
inFreeMsgChan chan *valuePullReplicationMsg
outStartupShutdownLock sync.Mutex
outNotifyChan chan *bgNotification
outMsgChan chan *valuePullReplicationMsg
outKTBFs []*valueKTBloomFilter
}
type valuePullReplicationMsg struct {
store *defaultValueStore
header []byte
body []byte
}
func (store *defaultValueStore) pullReplicationConfig(cfg *ValueStoreConfig) {
store.pullReplicationState.inWorkers = cfg.InPullReplicationWorkers
store.pullReplicationState.inMsgs = cfg.InPullReplicationMsgs
store.pullReplicationState.inResponseMsgTimeout = time.Duration(cfg.InPullReplicationResponseMsgTimeout) * time.Millisecond
store.pullReplicationState.outInterval = cfg.OutPullReplicationInterval
store.pullReplicationState.outIteration = uint16(cfg.Rand.Uint32())
store.pullReplicationState.outWorkers = uint64(cfg.OutPullReplicationWorkers)
store.pullReplicationState.outMsgs = cfg.OutPullReplicationMsgs
store.pullReplicationState.outMsgTimeout = time.Duration(cfg.OutPullReplicationMsgTimeout) * time.Millisecond
store.pullReplicationState.outBloomN = uint64(cfg.OutPullReplicationBloomN)
store.pullReplicationState.outBloomP = cfg.OutPullReplicationBloomP
if store.msgRing != nil {
store.msgRing.SetMsgHandler(_VALUE_PULL_REPLICATION_MSG_TYPE, store.newInPullReplicationMsg)
}
}
func (store *defaultValueStore) pullReplicationStartup() {
store.inPullReplicationStartup()
store.outPullReplicationStartup()
}
func (store *defaultValueStore) pullReplicationShutdown() {
store.inPullReplicationShutdown()
store.outPullReplicationShutdown()
}
func (store *defaultValueStore) inPullReplicationStartup() {
store.pullReplicationState.inStartupShutdownLock.Lock()
if store.pullReplicationState.inNotifyChan == nil {
store.pullReplicationState.inNotifyChan = make(chan *bgNotification, 1)
store.pullReplicationState.inMsgChan = make(chan *valuePullReplicationMsg, store.pullReplicationState.inMsgs)
store.pullReplicationState.inFreeMsgChan = make(chan *valuePullReplicationMsg, store.pullReplicationState.inMsgs)
for i := 0; i < cap(store.pullReplicationState.inFreeMsgChan); i++ {
store.pullReplicationState.inFreeMsgChan <- &valuePullReplicationMsg{
store: store,
header: make([]byte, _VALUE_KT_BLOOM_FILTER_HEADER_BYTES+_VALUE_PULL_REPLICATION_MSG_HEADER_BYTES),
}
}
go store.inPullReplicationLauncher(store.pullReplicationState.inNotifyChan)
}
store.pullReplicationState.inStartupShutdownLock.Unlock()
}
func (store *defaultValueStore) inPullReplicationShutdown() {
store.pullReplicationState.inStartupShutdownLock.Lock()
if store.pullReplicationState.inNotifyChan != nil {
c := make(chan struct{}, 1)
store.pullReplicationState.inNotifyChan <- &bgNotification{
action: _BG_DISABLE,
doneChan: c,
}
<-c
store.pullReplicationState.inNotifyChan = nil
store.pullReplicationState.inMsgChan = nil
store.pullReplicationState.inFreeMsgChan = nil
}
store.pullReplicationState.inStartupShutdownLock.Unlock()
}
func (store *defaultValueStore) outPullReplicationStartup() {
store.pullReplicationState.outStartupShutdownLock.Lock()
if store.pullReplicationState.outNotifyChan == nil {
store.outPullReplicationStartupHelper()
go store.outPullReplicationLauncher(store.pullReplicationState.outNotifyChan)
}
store.pullReplicationState.outStartupShutdownLock.Unlock()
}
func (store *defaultValueStore) outPullReplicationStartupHelper() {
store.pullReplicationState.outNotifyChan = make(chan *bgNotification, 1)
store.pullReplicationState.outMsgChan = make(chan *valuePullReplicationMsg, store.pullReplicationState.outMsgs)
store.pullReplicationState.outKTBFs = []*valueKTBloomFilter{newValueKTBloomFilter(store.pullReplicationState.outBloomN, store.pullReplicationState.outBloomP, 0)}
for i := 0; i < cap(store.pullReplicationState.outMsgChan); i++ {
store.pullReplicationState.outMsgChan <- &valuePullReplicationMsg{
store: store,
header: make([]byte, _VALUE_KT_BLOOM_FILTER_HEADER_BYTES+_VALUE_PULL_REPLICATION_MSG_HEADER_BYTES),
body: make([]byte, len(store.pullReplicationState.outKTBFs[0].bits)),
}
}
}
func (store *defaultValueStore) outPullReplicationShutdown() {
store.pullReplicationState.outStartupShutdownLock.Lock()
if store.pullReplicationState.outNotifyChan != nil {
c := make(chan struct{}, 1)
store.pullReplicationState.outNotifyChan <- &bgNotification{
action: _BG_DISABLE,
doneChan: c,
}
<-c
store.outPullReplicationShutdownHelper()
}
store.pullReplicationState.outStartupShutdownLock.Unlock()
}
func (store *defaultValueStore) outPullReplicationShutdownHelper() {
store.pullReplicationState.outNotifyChan = nil
store.pullReplicationState.outMsgChan = nil
store.pullReplicationState.outKTBFs = nil
}
func (store *defaultValueStore) OutPullReplicationPass() {
store.pullReplicationState.outStartupShutdownLock.Lock()
if store.pullReplicationState.outNotifyChan == nil {
store.outPullReplicationStartupHelper()
store.outPullReplicationPass(store.pullReplicationState.outNotifyChan)
store.outPullReplicationShutdownHelper()
} else {
c := make(chan struct{}, 1)
store.pullReplicationState.outNotifyChan <- &bgNotification{
action: _BG_PASS,
doneChan: c,
}
<-c
}
store.pullReplicationState.outStartupShutdownLock.Unlock()
}
func (store *defaultValueStore) inPullReplicationLauncher(notifyChan chan *bgNotification) {
wg := &sync.WaitGroup{}
wg.Add(store.pullReplicationState.inWorkers)
for i := 0; i < store.pullReplicationState.inWorkers; i++ {
go store.inPullReplication(wg)
}
var notification *bgNotification
running := true
for running {
notification = <-notifyChan
if notification.action == _BG_DISABLE {
for i := 0; i < store.pullReplicationState.inWorkers; i++ {
store.pullReplicationState.inMsgChan <- nil
}
wg.Wait()
running = false
} else {
store.logger.Error("invalid action requested", zap.String("name", store.loggerPrefix+"inPullReplication"), zap.Int("action", int(notification.action)))
}
notification.doneChan <- struct{}{}
}
}
// newInPullReplicationMsg reads pull-replication messages from the MsgRing and
// puts them on the inMsgChan for the inPullReplication workers to work on.
func (store *defaultValueStore) newInPullReplicationMsg(r io.Reader, l uint64) (uint64, error) {
var prm *valuePullReplicationMsg
select {
case prm = <-store.pullReplicationState.inFreeMsgChan:
default:
// If there isn't a free valuePullReplicationMsg, just read and
// discard the incoming pull-replication message.
left := l
var sn int
var err error
for left > 0 {
t := toss
if left < uint64(len(t)) {
t = t[:left]
}
sn, err = r.Read(t)
left -= uint64(sn)
if err != nil {
atomic.AddInt32(&store.inPullReplicationInvalids, 1)
return l - left, err
}
}
atomic.AddInt32(&store.inPullReplicationDrops, 1)
return l, nil
}
// TODO: We need to cap this so memory isn't abused in case someone
// accidentally sets a crazy sized bloom filter on another node. Since a
// partial pull-replication message is pretty much useless as it would drop
// a chunk of the bloom filter bitspace, we should drop oversized messages
// but report the issue.
bl := l - _VALUE_PULL_REPLICATION_MSG_HEADER_BYTES - uint64(_VALUE_KT_BLOOM_FILTER_HEADER_BYTES)
if uint64(cap(prm.body)) < bl {
prm.body = make([]byte, bl)
}
prm.body = prm.body[:bl]
var n int
var sn int
var err error
for n != len(prm.header) {
if err != nil {
store.pullReplicationState.inFreeMsgChan <- prm
atomic.AddInt32(&store.inPullReplicationInvalids, 1)
return uint64(n), err
}
sn, err = r.Read(prm.header[n:])
n += sn
}
n = 0
for n != len(prm.body) {
if err != nil {
store.pullReplicationState.inFreeMsgChan <- prm
atomic.AddInt32(&store.inPullReplicationInvalids, 1)
return uint64(len(prm.header)) + uint64(n), err
}
sn, err = r.Read(prm.body[n:])
n += sn
}
store.pullReplicationState.inMsgChan <- prm
atomic.AddInt32(&store.inPullReplications, 1)
return l, nil
}
// inPullReplication actually processes incoming pull-replication messages;
// there may be more than one of these workers.
func (store *defaultValueStore) inPullReplication(wg *sync.WaitGroup) {
k := make([]uint64, store.bulkSetState.msgCap/_VALUE_BULK_SET_MSG_MIN_ENTRY_LENGTH*2)
v := make([]byte, store.valueCap)
for {
prm := <-store.pullReplicationState.inMsgChan
if prm == nil {
break
}
if store.msgRing == nil {
store.pullReplicationState.inFreeMsgChan <- prm
continue
}
ring := store.msgRing.Ring()
if ring == nil {
store.pullReplicationState.inFreeMsgChan <- prm
continue
}
k = k[:0]
// This is what the remote system used when making its bloom filter,
// computed via its config.ReplicationIgnoreRecent setting. We want to
// use the exact same cutoff in our checks and possible response.
cutoff := prm.cutoff()
tombstoneCutoff := (uint64(brimtime.TimeToUnixMicro(time.Now())) << _TSB_UTIL_BITS) - store.tombstoneDiscardState.age
ktbf := prm.ktBloomFilter()
l := int64(store.bulkSetState.msgCap)
callback := func(keyA uint64, keyB uint64, timestampbits uint64, length uint32) bool {
if timestampbits&_TSB_DELETION == 0 || timestampbits >= tombstoneCutoff {
if !ktbf.mayHave(keyA, keyB, timestampbits) {
k = append(k, keyA, keyB)
l -= _VALUE_BULK_SET_MSG_ENTRY_HEADER_LENGTH + int64(length)
if l <= 0 {
return false
}
}
}
return true
}
// Based on the replica index for the local node, start the scan at
// different points. For example, in a three replica system the first
// replica would start scanning at the start, the second a third
// through, the last would start two thirds through. This is so that
// pull-replication messages, which are sent concurrently to all other
// replicas, will get different responses back instead of duplicate
// items if there is a lot of data to be sent.
responsibleReplica := ring.ResponsibleReplica(uint32(prm.rangeStart() >> (64 - ring.PartitionBitCount())))
if responsibleReplica < 0 {
responsibleReplica = 0
}
scanStart := prm.rangeStart() + (prm.rangeStop()-prm.rangeStart())/uint64(ring.ReplicaCount())*uint64(responsibleReplica)
scanStop := prm.rangeStop()
store.locmap.ScanCallback(scanStart, scanStop, 0, _TSB_LOCAL_REMOVAL, cutoff, math.MaxUint64, callback)
if scanStart != prm.rangeStart() && l > 0 {
scanStop = scanStart - 1
scanStart = prm.rangeStart()
store.locmap.ScanCallback(scanStart, scanStop, 0, _TSB_LOCAL_REMOVAL, cutoff, math.MaxUint64, callback)
}
nodeID := prm.nodeID()
store.pullReplicationState.inFreeMsgChan <- prm
if len(k) > 0 {
bsm := store.newOutBulkSetMsg()
// Indicate that a response to this bulk-set message is not
// necessary. If the message fails to reach its destination, that
// destination will simply resend another pull replication message
// on its next pass.
binary.BigEndian.PutUint64(bsm.header, 0)
var t uint64
var err error
for i := 0; i < len(k); i += 2 {
t, v, err = store.read(k[i], k[i+1], v[:0])
if IsNotFound(err) {
if t == 0 {
continue
}
} else if err != nil {
continue
}
if t&_TSB_LOCAL_REMOVAL == 0 {
if !bsm.add(k[i], k[i+1], t, v) {
break
}
atomic.AddInt32(&store.outBulkSetValues, 1)
}
}
if len(bsm.body) > 0 {
atomic.AddInt32(&store.outBulkSets, 1)
store.msgRing.MsgToNode(bsm, nodeID, store.pullReplicationState.inResponseMsgTimeout)
}
}
}
wg.Done()
}
func (store *defaultValueStore) outPullReplicationLauncher(notifyChan chan *bgNotification) {
interval := float64(store.pullReplicationState.outInterval) * float64(time.Second)
store.randMutex.Lock()
nextRun := time.Now().Add(time.Duration(interval + interval*store.rand.NormFloat64()*0.1))
store.randMutex.Unlock()
var notification *bgNotification
running := true
for running {
if notification == nil {
sleep := nextRun.Sub(time.Now())
if sleep > 0 {
select {
case notification = <-notifyChan:
case <-time.After(sleep):
}
} else {
select {
case notification = <-notifyChan:
default:
}
}
}
store.randMutex.Lock()
nextRun = time.Now().Add(time.Duration(interval + interval*store.rand.NormFloat64()*0.1))
store.randMutex.Unlock()
if notification != nil {
var nextNotification *bgNotification
switch notification.action {
case _BG_PASS:
nextNotification = store.outPullReplicationPass(notifyChan)
case _BG_DISABLE:
running = false
default:
store.logger.Error("invalid action requested", zap.String("name", store.loggerPrefix+"outPullReplication"), zap.Int("action", int(notification.action)))
}
notification.doneChan <- struct{}{}
notification = nextNotification
} else {
notification = store.outPullReplicationPass(notifyChan)
}
}
}
func (store *defaultValueStore) outPullReplicationPass(notifyChan chan *bgNotification) *bgNotification {
if store.msgRing == nil {
return nil
}
ring := store.msgRing.Ring()
if ring == nil || ring.ReplicaCount() < 2 || ring.NodeCount() < 2 {
return nil
}
begin := time.Now()
defer func() {
elapsed := time.Now().Sub(begin)
store.logger.Debug("pass complete", zap.String("name", store.loggerPrefix+"outPullReplication"), zap.Duration("elapsed", elapsed))
atomic.StoreInt64(&store.outPullReplicationNanoseconds, elapsed.Nanoseconds())
}()
rightwardPartitionShift := 64 - ring.PartitionBitCount()
partitionCount := uint64(1) << ring.PartitionBitCount()
if store.pullReplicationState.outIteration == math.MaxUint16 {
store.pullReplicationState.outIteration = 0
} else {
store.pullReplicationState.outIteration++
}
ringVersion := ring.Version()
ws := store.pullReplicationState.outWorkers
for uint64(len(store.pullReplicationState.outKTBFs)) < ws {
store.pullReplicationState.outKTBFs = append(store.pullReplicationState.outKTBFs, newValueKTBloomFilter(store.pullReplicationState.outBloomN, store.pullReplicationState.outBloomP, 0))
}
var abort uint32
f := func(p uint64, w uint64, ktbf *valueKTBloomFilter) {
pb := p << rightwardPartitionShift
rb := pb + ((uint64(1) << rightwardPartitionShift) / ws * w)
var re uint64
if w+1 == ws {
if p+1 == partitionCount {
re = math.MaxUint64
} else {
re = ((p + 1) << rightwardPartitionShift) - 1
}
} else {
re = pb + ((uint64(1) << rightwardPartitionShift) / ws * (w + 1)) - 1
}
timestampbitsnow := uint64(brimtime.TimeToUnixMicro(time.Now())) << _TSB_UTIL_BITS
cutoff := timestampbitsnow - store.replicationIgnoreRecent
var more bool
for atomic.LoadUint32(&abort) == 0 {
rbThis := rb
ktbf.reset(store.pullReplicationState.outIteration)
rb, more = store.locmap.ScanCallback(rb, re, 0, _TSB_LOCAL_REMOVAL, cutoff, store.pullReplicationState.outBloomN, func(keyA uint64, keyB uint64, timestampbits uint64, length uint32) bool {
ktbf.add(keyA, keyB, timestampbits)
return true
})
ring2 := store.msgRing.Ring()
if ring2 == nil || ring2.Version() != ringVersion {
break
}
reThis := re
if more {
reThis = rb - 1
}
prm := store.newOutPullReplicationMsg(ringVersion, uint32(p), cutoff, rbThis, reThis, ktbf)
atomic.AddInt32(&store.outPullReplications, 1)
store.msgRing.MsgToOtherReplicas(prm, uint32(p), store.pullReplicationState.outMsgTimeout)
if !more {
break
}
}
}
wg := &sync.WaitGroup{}
wg.Add(int(ws))
for w := uint64(0); w < ws; w++ {
go func(w uint64) {
ktbf := store.pullReplicationState.outKTBFs[w]
pb := partitionCount / ws * w
for p := pb; p < partitionCount; p++ {
if atomic.LoadUint32(&abort) != 0 {
break
}
ring2 := store.msgRing.Ring()
if ring2 == nil || ring2.Version() != ringVersion {
break
}
if ring.Responsible(uint32(p)) {
f(p, w, ktbf)
}
}
for p := uint64(0); p < pb; p++ {
if atomic.LoadUint32(&abort) != 0 {
break
}
ring2 := store.msgRing.Ring()
if ring2 == nil || ring2.Version() != ringVersion {
break
}
if ring.Responsible(uint32(p)) {
f(p, w, ktbf)
}
}
wg.Done()
}(w)
}
waitChan := make(chan struct{}, 1)
go func() {
wg.Wait()
close(waitChan)
}()
select {
case notification := <-notifyChan:
atomic.AddUint32(&abort, 1)
<-waitChan
return notification
case <-waitChan:
return nil
}
}
// newOutPullReplicationMsg gives an initialized valuePullReplicationMsg for
// filling out and eventually sending using the MsgRing. The MsgRing (or
// someone else if the message doesn't end up with the MsgRing) will call
// valuePullReplicationMsg.Free eventually and the pullReplicationMsg will
// be requeued for reuse later. There is a fixed number of outgoing
// valuePullReplicationMsg instances that can exist at any given time, capping
// memory usage. Once the limit is reached, this method will block until a
// valuePullReplicationMsg is available to return.
func (store *defaultValueStore) newOutPullReplicationMsg(ringVersion int64, partition uint32, cutoff uint64, rangeStart uint64, rangeStop uint64, ktbf *valueKTBloomFilter) *valuePullReplicationMsg {
prm := <-store.pullReplicationState.outMsgChan
if store.msgRing != nil {
if r := store.msgRing.Ring(); r != nil {
if n := r.LocalNode(); n != nil {
binary.BigEndian.PutUint64(prm.header, n.ID())
}
}
}
binary.BigEndian.PutUint64(prm.header[8:], uint64(ringVersion))
binary.BigEndian.PutUint32(prm.header[16:], partition)
binary.BigEndian.PutUint64(prm.header[20:], cutoff)
binary.BigEndian.PutUint64(prm.header[28:], rangeStart)
binary.BigEndian.PutUint64(prm.header[36:], rangeStop)
ktbf.toMsg(prm, _VALUE_PULL_REPLICATION_MSG_HEADER_BYTES)
return prm
}
func (prm *valuePullReplicationMsg) MsgType() uint64 {
return _VALUE_PULL_REPLICATION_MSG_TYPE
}
func (prm *valuePullReplicationMsg) MsgLength() uint64 {
return uint64(len(prm.header)) + uint64(len(prm.body))
}
func (prm *valuePullReplicationMsg) nodeID() uint64 {
return binary.BigEndian.Uint64(prm.header)
}
func (prm *valuePullReplicationMsg) ringVersion() int64 {
return int64(binary.BigEndian.Uint64(prm.header[8:]))
}
func (prm *valuePullReplicationMsg) partition() uint32 {
return binary.BigEndian.Uint32(prm.header[16:])
}
func (prm *valuePullReplicationMsg) cutoff() uint64 {
return binary.BigEndian.Uint64(prm.header[20:])
}
func (prm *valuePullReplicationMsg) rangeStart() uint64 {
return binary.BigEndian.Uint64(prm.header[28:])
}
func (prm *valuePullReplicationMsg) rangeStop() uint64 {
return binary.BigEndian.Uint64(prm.header[36:])
}
func (prm *valuePullReplicationMsg) ktBloomFilter() *valueKTBloomFilter {
return newValueKTBloomFilterFromMsg(prm, _VALUE_PULL_REPLICATION_MSG_HEADER_BYTES)
}
func (prm *valuePullReplicationMsg) WriteContent(w io.Writer) (uint64, error) {
var n int
var sn int
var err error
sn, err = w.Write(prm.header)
n += sn
if err != nil {
return uint64(n), err
}
sn, err = w.Write(prm.body)
n += sn
return uint64(n), err
}
func (prm *valuePullReplicationMsg) Free(successes int, failures int) {
prm.store.pullReplicationState.outMsgChan <- prm
}