mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
issue: #33285 - add two grpc resolver (by session and by streaming coord assignment service) - add one grpc balancer (by serverID and roundrobin) - add lazy conn to avoid block by first service discovery - add some utility function for streaming service Signed-off-by: chyezh <chyezh@outlook.com>
32 lines
891 B
Go
32 lines
891 B
Go
package adaptor
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/milvus-io/milvus/internal/streamingnode/server/wal"
|
|
"github.com/milvus-io/milvus/pkg/streaming/util/types"
|
|
"github.com/milvus-io/milvus/pkg/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)
|
|
}
|