chyezh 7611128e57
enhance: wal adaptor implementation (#34122)
issue: #33285

- add adaptor to implement walimpls into wal interface.
- implement timetick sorted and filtering scanner.
- add test for wal.

---------

Signed-off-by: chyezh <chyezh@outlook.com>
2024-07-04 15:23:08 +08:00

32 lines
902 B
Go

package adaptor
import (
"fmt"
"github.com/milvus-io/milvus/internal/streamingnode/server/wal"
"github.com/milvus-io/milvus/internal/util/streamingutil/util"
"github.com/milvus-io/milvus/pkg/streaming/util/types"
)
type scannerRegistry struct {
channel types.PChannelInfo
idAllocator *util.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)
}