Documentation ¶
Index ¶
- type Broker
- func (b *Broker) Append(srv pb.Journal_AppendServer) error
- func (b *Broker) Apply(ctx context.Context, req *pb.ApplyRequest) (*pb.ApplyResponse, error)
- func (b *Broker) Cleanup()
- func (b *Broker) Client() pb.RoutedJournalClient
- func (b *Broker) Endpoint() pb.Endpoint
- func (b *Broker) List(ctx context.Context, req *pb.ListRequest) (*pb.ListResponse, error)
- func (b *Broker) ListFragments(ctx context.Context, req *pb.FragmentsRequest) (*pb.FragmentsResponse, error)
- func (b *Broker) Read(req *pb.ReadRequest, srv pb.Journal_ReadServer) error
- func (b *Broker) Replicate(srv pb.Journal_ReplicateServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct { ReadLoopErrCh chan error // Chan from which tests read final read-loop errors. WriteLoopErrCh chan error // Chan to which tests write final write-loop error (or nil). ReplReqCh chan pb.ReplicateRequest // Chan from which tests read ReplicateRequest. ReplRespCh chan pb.ReplicateResponse // Chan to which tests write ReplicateResponse. ReadReqCh chan pb.ReadRequest // Chan from which tests read ReadRequest. ReadRespCh chan pb.ReadResponse // Chan to which tests write ReadResponse. AppendReqCh chan pb.AppendRequest // Chan from which tests read AppendRequest. AppendRespCh chan pb.AppendResponse // Chan to which tests write AppendResponse. ListFunc func(context.Context, *pb.ListRequest) (*pb.ListResponse, error) // List implementation. ApplyFunc func(context.Context, *pb.ApplyRequest) (*pb.ApplyResponse, error) // Apply implementation. ListFragmentsFunc func(context.Context, *pb.FragmentsRequest) (*pb.FragmentsResponse, error) // ListFragments implementation. // contains filtered or unexported fields }
Broker stubs the read and write loops of broker RPCs, routing them onto channels which can be synchronously read and written within test bodies.
func (*Broker) Append ¶
func (b *Broker) Append(srv pb.Journal_AppendServer) error
Append implements the JournalServer interface by proxying requests & responses through channels AppendReqCh & AppendRespCh.
func (*Broker) Apply ¶
func (b *Broker) Apply(ctx context.Context, req *pb.ApplyRequest) (*pb.ApplyResponse, error)
Apply implements the JournalServer interface by proxying through ApplyFunc.
func (*Broker) Cleanup ¶
func (b *Broker) Cleanup()
Cleanup cancels the Broker tasks.Group and asserts that it exits cleanly.
func (*Broker) Client ¶
func (b *Broker) Client() pb.RoutedJournalClient
Client returns a RoutedJournalClient wrapping the GRPCLoopback.
func (*Broker) List ¶
func (b *Broker) List(ctx context.Context, req *pb.ListRequest) (*pb.ListResponse, error)
List implements the JournalServer interface by proxying through ListFunc.
func (*Broker) ListFragments ¶
func (b *Broker) ListFragments(ctx context.Context, req *pb.FragmentsRequest) (*pb.FragmentsResponse, error)
ListFragments implements the JournalServer interface by proxying through FragmentsFunc.
func (*Broker) Read ¶
func (b *Broker) Read(req *pb.ReadRequest, srv pb.Journal_ReadServer) error
Read implements the JournalServer interface by proxying requests & responses through channels ReadReqCh & ReadResponseCh.