mirror of
https://github.com/minio/minio.git
synced 2026-02-09 04:10:15 -05:00
use unixNanoTime instead of time.Time in lockRequestorInfo (#20140)
Bonus: Skip Source, Quorum fields in lockArgs that are never sent during Unlock() phase.
This commit is contained in:
@@ -34,6 +34,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
"unsafe"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/klauspost/compress/s2"
|
||||
@@ -246,6 +247,24 @@ func pathsJoinPrefix(prefix string, elem ...string) (paths []string) {
|
||||
return paths
|
||||
}
|
||||
|
||||
// string concat alternative to s1 + s2 with low overhead.
|
||||
func concat(ss ...string) string {
|
||||
length := len(ss)
|
||||
if length == 0 {
|
||||
return ""
|
||||
}
|
||||
// create & allocate the memory in advance.
|
||||
n := 0
|
||||
for i := 0; i < length; i++ {
|
||||
n += len(ss[i])
|
||||
}
|
||||
b := make([]byte, 0, n)
|
||||
for i := 0; i < length; i++ {
|
||||
b = append(b, ss[i]...)
|
||||
}
|
||||
return unsafe.String(unsafe.SliceData(b), n)
|
||||
}
|
||||
|
||||
// pathJoin - like path.Join() but retains trailing SlashSeparator of the last element
|
||||
func pathJoin(elem ...string) string {
|
||||
sb := bytebufferpool.Get()
|
||||
|
||||
Reference in New Issue
Block a user