Strip event content Raw fields before storing
This commit is contained in:
parent
f668faa894
commit
6a907354e2
@ -265,9 +265,18 @@ func btoi(b []byte) uint64 {
|
|||||||
return binary.BigEndian.Uint64(b)
|
return binary.BigEndian.Uint64(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stripRaw(evt *muksevt.Event) {
|
||||||
|
evtCopy := *evt.Event
|
||||||
|
evtCopy.Content = event.Content{
|
||||||
|
Parsed: evt.Content.Parsed,
|
||||||
|
}
|
||||||
|
evt.Event = &evtCopy
|
||||||
|
}
|
||||||
|
|
||||||
func marshalEvent(evt *muksevt.Event) ([]byte, error) {
|
func marshalEvent(evt *muksevt.Event) ([]byte, error) {
|
||||||
|
stripRaw(evt)
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
enc := gzip.NewWriter(&buf)
|
enc, _ := gzip.NewWriterLevel(&buf, gzip.BestSpeed)
|
||||||
if err := gob.NewEncoder(enc).Encode(evt); err != nil {
|
if err := gob.NewEncoder(enc).Encode(evt); err != nil {
|
||||||
_ = enc.Close()
|
_ = enc.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user