mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
outlet/flow: persist decoders' state
Currently, for NetFlow, persist data/options templates and options. This should allow the outlet to restart without loosing any message. Fix #2100
This commit is contained in:
5
common/helpers/cache/persist.go
vendored
5
common/helpers/cache/persist.go
vendored
@@ -42,7 +42,7 @@ func (c *Cache[K, V]) Load(cacheFile string) error {
|
||||
|
||||
// currentVersionNumber should be increased each time we change the way we
|
||||
// encode the cache.
|
||||
var currentVersionNumber = 11
|
||||
const currentVersionNumber = 11
|
||||
|
||||
// GobEncode encodes the cache
|
||||
func (c *Cache[K, V]) GobEncode() ([]byte, error) {
|
||||
@@ -50,7 +50,8 @@ func (c *Cache[K, V]) GobEncode() ([]byte, error) {
|
||||
encoder := gob.NewEncoder(&buf)
|
||||
|
||||
// Encode version
|
||||
if err := encoder.Encode(¤tVersionNumber); err != nil {
|
||||
version := currentVersionNumber
|
||||
if err := encoder.Encode(&version); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Encode a representation of K and V. Gob decoding is pretty forgiving, we
|
||||
|
||||
Reference in New Issue
Block a user