未验证 提交 13c1a1c7 编写于 作者: G godchen 提交者: GitHub

Add joinIDPath for reuse (#9650)

Signed-off-by: Ngodchen <qingxiang.chen@zilliz.com>
上级 f85271cf
......@@ -68,7 +68,7 @@ func (alloc *allocator) allocID() (UniqueID, error) {
// genKey gives a valid key string for lists of UniqueIDs:
// if alloc is true, the returned keys will have a generated-unique ID at the end.
// if alloc is false, the returned keys will only consist of provided ids.
func (alloc *allocator) genKey(isalloc bool, ids ...UniqueID) (key string, err error) {
func (alloc *allocator) genKey(isalloc bool, ids ...UniqueID) (string, error) {
if isalloc {
idx, err := alloc.allocID()
if err != nil {
......@@ -76,12 +76,13 @@ func (alloc *allocator) genKey(isalloc bool, ids ...UniqueID) (key string, err e
}
ids = append(ids, idx)
}
return JoinIDPath(ids...), nil
}
func JoinIDPath(ids ...UniqueID) string {
idStr := make([]string, len(ids))
for _, id := range ids {
idStr = append(idStr, strconv.FormatInt(id, 10))
}
key = path.Join(idStr...)
return
return path.Join(idStr...)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册