mirror of
https://github.com/logos-messaging/go-zerokit-rln.git
synced 2026-01-08 16:13:08 +00:00
chore: use flush_every_ms and change datatype to time.Duration
This commit is contained in:
parent
8167006b94
commit
a706089284
28
rln/types.go
28
rln/types.go
@ -3,6 +3,7 @@ package rln
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -80,11 +81,28 @@ const (
|
||||
)
|
||||
|
||||
type TreeConfig struct {
|
||||
CacheCapacity int `json:"cache_capacity"`
|
||||
Mode TreeMode `json:"mode"`
|
||||
Compression bool `json:"compression"`
|
||||
FlushInterval int `json:"flush_interval"`
|
||||
Path string `json:"path"`
|
||||
CacheCapacity int
|
||||
Mode TreeMode
|
||||
Compression bool
|
||||
FlushInterval time.Duration
|
||||
Path string
|
||||
}
|
||||
|
||||
func (t TreeConfig) MarshalJSON() ([]byte, error) {
|
||||
output := struct {
|
||||
CacheCapacity int `json:"cache_capacity"`
|
||||
Mode TreeMode `json:"mode"`
|
||||
Compression bool `json:"compression"`
|
||||
FlushInterval uint `json:"flush_every_ms"`
|
||||
Path string `json:"path"`
|
||||
}{
|
||||
CacheCapacity: t.CacheCapacity,
|
||||
Mode: t.Mode,
|
||||
Compression: t.Compression,
|
||||
FlushInterval: uint(t.FlushInterval) / uint(time.Millisecond),
|
||||
Path: t.Path,
|
||||
}
|
||||
return json.Marshal(output)
|
||||
}
|
||||
|
||||
type config struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user