mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 11:29:48 +08:00
e9d777b336
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
19 lines
503 B
Go
19 lines
503 B
Go
package storage
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
// ParseSegmentIDByBinlog parse segment id from binlog paths
|
|
// if path format is not expected, returns error
|
|
func ParseSegmentIDByBinlog(path string) (UniqueID, error) {
|
|
// binlog path should consist of "[prefix]/insertLog/collID/partID/segID/fieldID/fileName"
|
|
keyStr := strings.Split(path, "/")
|
|
if len(keyStr) != 7 {
|
|
return 0, fmt.Errorf("%s is not a valid binlog path", path)
|
|
}
|
|
return strconv.ParseInt(keyStr[len(keyStr)-3], 10, 64)
|
|
}
|