wal_helper.go 738 B

123456789101112131415161718192021222324252627282930313233
  1. package helper
  2. import (
  3. "go.uber.org/zap"
  4. "github.com/milvus-io/milvus/pkg/log"
  5. "github.com/milvus-io/milvus/pkg/streaming/util/types"
  6. "github.com/milvus-io/milvus/pkg/streaming/walimpls"
  7. )
  8. // NewWALHelper creates a new WALHelper.
  9. func NewWALHelper(opt *walimpls.OpenOption) *WALHelper {
  10. return &WALHelper{
  11. logger: log.With(zap.Any("channel", opt.Channel)),
  12. channel: opt.Channel,
  13. }
  14. }
  15. // WALHelper is a helper for WAL implementation.
  16. type WALHelper struct {
  17. logger *log.MLogger
  18. channel types.PChannelInfo
  19. }
  20. // Channel returns the channel of the WAL.
  21. func (w *WALHelper) Channel() types.PChannelInfo {
  22. return w.channel
  23. }
  24. // Log returns the logger of the WAL.
  25. func (w *WALHelper) Log() *log.MLogger {
  26. return w.logger
  27. }