Commit bce42a37 authored by ethfoo's avatar ethfoo
Browse files

Fix(grpc source): move private fields from header to meta

parent e24884f9
Showing with 10 additions and 8 deletions
+10 -8
......@@ -8,7 +8,7 @@ ARG TARGETOS
WORKDIR /
COPY . .
# Build
#RUN CGO_ENABLED=1 go build -mod=vendor -a -o loggie cmd/loggie/main.go
#RUN make build
RUN if [ "$TARGETARCH" = "arm64" ]; then apt-get update && apt-get install -y gcc-aarch64-linux-gnu && export CC=aarch64-linux-gnu-gcc && export CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi \
&& GOOS=$TARGETOS GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET make build
......
......@@ -65,16 +65,19 @@ func (b *batch) size() int {
func (b *batch) append(e api.Event) {
currentIndex := b.eventIndex
header := e.Header()
header[batchEventIndexKey] = currentIndex
header[batchIndexKey] = b.index
e.Meta().Set(batchEventIndexKey, currentIndex)
e.Meta().Set(batchIndexKey, b.index)
b.events[currentIndex] = e
b.eventIndex++
}
func (b *batch) ack(e api.Event) {
header := e.Header()
index := header[batchEventIndexKey].(int32)
indexRaw, exist := e.Meta().Get(batchEventIndexKey)
if !exist {
return
}
index := indexRaw.(int32)
delete(b.events, index)
if len(b.events) == 0 {
......@@ -166,8 +169,7 @@ func (bc *batchChain) run() {
}
case es := <-bc.ackEvents:
for _, e := range es {
header := e.Header()
if batchIndex, ok := header[batchIndexKey]; ok {
if batchIndex, ok := e.Meta().Get(batchIndexKey); ok {
if b, exist := bs[batchIndex.(uint32)]; exist {
b.ack(e)
if b.isDone() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment