cache read performance improvements

This commit is contained in:
ston1th 2022-05-19 01:29:23 +02:00
commit f69d3149f3
14 changed files with 140 additions and 71 deletions

View file

@ -3,6 +3,7 @@ package crypto
import (
"cachefs/pkg/provider"
"crypto/rand"
"encoding/binary"
"io"
"math"
)
@ -29,7 +30,6 @@ func initNonce(f provider.File) (nonce []byte, err error) {
return
}
_, err = f.Write(nonce)
return
}
return
}
@ -76,3 +76,7 @@ func inc(nonce *[NonceSize]byte, n int64) {
incNonce(nonce)
}
}
func put(nonce *[NonceSize]byte, n int64) {
binary.BigEndian.PutUint64((*nonce)[3:11], uint64(n))
}