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

29 lines
828 B
Go

package producer
import (
"context"
"github.com/milvus-io/milvus/pkg/v2/streaming/util/message"
"github.com/milvus-io/milvus/pkg/v2/streaming/util/types"
)
var _ Producer = (*producerImpl)(nil)
// Producer is the interface that wraps the basic produce method on grpc stream.
// Producer is work on a single stream on grpc,
// so Producer cannot recover from failure because of the stream is broken.
type Producer interface {
// Append sends the produce message to server.
// TODO: Support Batch produce here.
Append(ctx context.Context, msg message.MutableMessage) (*types.AppendResult, error)
// Check if a producer is available.
IsAvailable() bool
// Available returns a channel that will be closed when the producer is unavailable.
Available() <-chan struct{}
// Close close the producer client.
Close()
}