congqixia cb7f2fa6fd
enhance: Use v2 package name for pkg module (#39990)
Related to #39095

https://go.dev/doc/modules/version-numbers

Update pkg version according to golang dep version convention

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2025-02-22 23:15:58 +08:00

32 lines
897 B
Go

package adaptor
import (
"fmt"
"github.com/milvus-io/milvus/internal/streamingnode/server/wal"
"github.com/milvus-io/milvus/pkg/v2/streaming/util/types"
"github.com/milvus-io/milvus/pkg/v2/util/typeutil"
)
type scannerRegistry struct {
channel types.PChannelInfo
idAllocator *typeutil.IDAllocator
}
// AllocateScannerName a scanner name for a scanner.
// The scanner name should be persistent on meta for garbage clean up.
func (m *scannerRegistry) AllocateScannerName() (string, error) {
name := m.newSubscriptionName()
// TODO: persistent the subscription name on meta.
return name, nil
}
func (m *scannerRegistry) RegisterNewScanner(string, wal.Scanner) {
}
// newSubscriptionName generates a new subscription name.
func (m *scannerRegistry) newSubscriptionName() string {
id := m.idAllocator.Allocate()
return fmt.Sprintf("%s/%d/%d", m.channel.Name, m.channel.Term, id)
}