func (wp *writePacket) WritableSize() int {
	res := xbinary.WritableStringSize(wp.tags)
	res += xbinary.WritableStringSize(wp.fields)
	res += 4
	for _, ev := range wp.events {
		res += getLogEventSize(ev)
	}
	return res
}
EncodedSize part of rrpc.Encoder interface
package rpc
import (
	"context"
	"fmt"
	"github.com/logrange/logrange/api"
	"github.com/logrange/logrange/pkg/model"
	"github.com/logrange/logrange/pkg/model/field"
	"github.com/logrange/logrange/pkg/model/tag"
	"github.com/logrange/logrange/pkg/partition"
	"github.com/logrange/range/pkg/records"
	rrpc "github.com/logrange/range/pkg/rpc"
	"github.com/logrange/range/pkg/utils/bytes"
	"github.com/logrange/range/pkg/utils/encoding/xbinary"
	"github.com/pkg/errors"
	"io"
	"sync"
)
type (
	ServerIngestor struct {
		Journals *partition.Service `inject:""`
		MainCtx  context.Context    `inject:"mainCtx"`
		wg sync.WaitGroup
	}
	clntIngestor struct {
		rc rrpc.Client
	}
	writePacket struct {
		tags   string
		fields string
		events []*api.LogEvent
	}
	wpIterator struct {
		tags       string
		lge        model.LogEvent
		flds       field.Fields
		fldsWriter bytes.Writer
		buf        []byte
		read       bool
		pos        int
		recs       int
		cur        int
	}
)
type emptyResponse int
func (er emptyResponse) WritableSize() int {
	return 0
}
func (er emptyResponse) WriteTo(ow *xbinary.ObjectsWriter) (int, error) {
	return 0, nil
}
const cEmptyResponse = emptyResponse(0)
func NewServerIngestor() *ServerIngestor {
	return new(ServerIngestor)
}
func (si *ServerIngestor) Init(ctx context.Context) error {
	return nil
}
func (si *ServerIngestor) Shutdown() {
	si.wg.Wait()
}
func (ci *clntIngestor) Write(ctx context.Context, tags, fields string, evs []*api.LogEvent, res *api.WriteResult) error {
	var wp writePacket
	wp.tags = tags
	wp.fields = fields
	wp.events = evs
	buf, errOp, err := ci.rc.Call(ctx, cRpcEpIngestorWrite, &wp)
	if res != nil {
		res.Err = errOp
	}
	ci.rc.Collect(buf)
	return err
}
func (si *ServerIngestor) write(reqId int32, reqBody []byte, sc *rrpc.ServerConn) {
	si.wg.Add(1)
	defer si.wg.Done()
	var wpi wpIterator
	err := wpi.init(reqBody)
	if err == nil {
		err = si.Journals.Write(si.MainCtx, wpi.tags, &wpi, false)
	}
	sc.SendResponse(reqId, err, cEmptyResponse)
}