Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInterruptedFuture = errors.New("connection closed before future completion")
)
var (
ErrNoLeader = errors.New("leader not found")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to the features of a z4 server.
func (*Client) StreamingProducer ¶
func (c *Client) StreamingProducer(ctx context.Context) (*StreamingProducer, error)
func (*Client) UnaryProducer ¶
func (c *Client) UnaryProducer() *UnaryProducer
type ClientOptions ¶
type ClientOptions struct { // Addrs is a list of host:port targets that identify members // of a z4 cluster. Addrs []string }
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer reads tasks as they become available for consumption.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a task that is ready for consumption.
The Ack method must be invoked once the task is successfully processed. Failure to acknowledge a task will result in it being redelivered.
type StreamingProducer ¶
type StreamingProducer struct {
// contains filtered or unexported fields
}
StreamingProducer supports the creation of tasks using bidirectional streaming.
StreamingProducer offers better performance than UnaryProducer but at the cost of weaker consistency and a more complex interface.
Close() should be called when the producer object is no longer needed.
func (*StreamingProducer) Close ¶
func (p *StreamingProducer) Close() error
Close releases resources allocated to the producer.
This method should be called when the producer is no longer needed.
func (*StreamingProducer) CreateTask ¶
func (p *StreamingProducer) CreateTask(req *proto.PushTaskRequest) *TaskFuture
CreateTask sends a request to create a task to the stream.
Because this is a streaming producer, the server response may not be immediately available. The returned future will provide access to the task (or an error upon failure) once the response is received.
type TaskCreationError ¶
TaskCreationError represents an error encountered by the server while creating a task.
func (TaskCreationError) Error ¶
func (e TaskCreationError) Error() string
type TaskFuture ¶
type TaskFuture struct {
// contains filtered or unexported fields
}
TaskFuture is an async response to creating a task.
To use objects of this type, first invoke the Error method. It will block until a response is received from the server. If the error is nil, the Task method will provide a non-nil task.
func (*TaskFuture) Error ¶
func (f *TaskFuture) Error() error
func (*TaskFuture) Task ¶
func (f *TaskFuture) Task() *proto.Task
type UnaryProducer ¶
type UnaryProducer struct {
// contains filtered or unexported fields
}
UnaryProducer supports the creation of tasks using the unary rpc.
This type is ideal for cases where the caller must immediately know whether a request succeeded or failed. Stronger consistency comes at the cost of slower performance. For high performance use cases, consider using StreamingProducer instead.
func (*UnaryProducer) CreateTask ¶
func (p *UnaryProducer) CreateTask(ctx context.Context, req *proto.PushTaskRequest) (*proto.Task, error)