github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/iprocbusmem/impl.go (about) 1 /* 2 * Copyright (c) 2021-present unTill Pro, Ltd. 3 */ 4 5 package iprocbusmem 6 7 import ( 8 "github.com/voedger/voedger/pkg/iprocbus" 9 ) 10 11 type implIProcBus struct { 12 // protected by VVM lifecycle: write only on wiring stage, read only after start 13 chans [][]iprocbus.ServiceChannel 14 } 15 16 func (b *implIProcBus) ServiceChannel(groupIdx int, channelIdx int) (res iprocbus.ServiceChannel) { 17 return b.chans[groupIdx][channelIdx] 18 } 19 20 func (b *implIProcBus) Submit(groupIdx int, channelIdx int, msg interface{}) (ok bool) { 21 select { 22 case b.chans[groupIdx][channelIdx] <- msg: 23 return true 24 default: 25 return false 26 } 27 }