Documentation ¶
Index ¶
- Variables
- func ServeRPC(hub *goyaad.Hub, addr string) (io.Closer, error)
- type RPCClient
- func (c *RPCClient) Cancel(id string) error
- func (c *RPCClient) Close() error
- func (c *RPCClient) Connect(addr string) error
- func (c *RPCClient) InspectN(n int, jobs *[]*RPCJob) error
- func (c *RPCClient) Next(timeout time.Duration) (string, []byte, error)
- func (c *RPCClient) Ping() error
- func (c *RPCClient) Put(body []byte, delay time.Duration) (string, error)
- func (c *RPCClient) PutWithID(id string, body []byte, delay time.Duration) error
- type RPCJob
- type RPCServer
- func (r *RPCServer) Cancel(id string, ignoredReply *int8) error
- func (r *RPCServer) InspectN(n int, rpcJobs *[]*RPCJob) error
- func (r *RPCServer) Next(timeout time.Duration, job *RPCJob) error
- func (r *RPCServer) Ping(ignore int8, pong *string) error
- func (r *RPCServer) PutWithID(job RPCJob, id *string) error
Constants ¶
This section is empty.
Variables ¶
var ErrClientDisconnected = errors.New("Client is not connected to the server")
ErrClientDisconnected means a client was used while it was disconnected from the remote server
var ErrTimeout = errors.New("No new jobs available in given timeout")
ErrTimeout indicates that no new jobs were ready to be consumed within the given timeout duration
Functions ¶
Types ¶
type RPCClient ¶ added in v1.0.0
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient communicates with the Yaad RPC server
func (*RPCClient) Cancel ¶ added in v1.0.0
Cancel deletes a job identified by the given id. Calls to cancel are idempotent
func (*RPCClient) Connect ¶ added in v1.0.0
Connect to a Yaad RCP Server and return a connected client Once connected, a client may be used by multiple goroutines simultaneously.
func (*RPCClient) InspectN ¶ added in v1.0.0
InspectN fetches upto n number of jobs from the server without consuming them
func (*RPCClient) Next ¶ added in v1.0.0
Next wait at-most timeout duration to return a ready job body from Yaad If no job is available within the timeout, ErrTimeout is returned and clients should try again later
type RPCJob ¶ added in v1.0.0
RPCJob is a light wrapper struct representing job data on the wire without extra metadata that is stored internally
type RPCServer ¶ added in v1.0.0
type RPCServer struct {
// contains filtered or unexported fields
}
RPCServer exposes a Yaad hub backed RPC endpoint
func (*RPCServer) Cancel ¶ added in v1.0.0
Cancel deletes the job pointed to by the id, reply is ignored If the job doesn't exist, no error is returned so calls to Cancel are idempotent
func (*RPCServer) InspectN ¶ added in v1.0.0
InspectN returns n jobs without removing them for ad-hoc inspection
func (*RPCServer) Next ¶ added in v1.0.0
Next sets the reply (job) to a valid job if a job is ready to be triggered If not job is ready yet, this call will wait (block) for the given duration and keep searching for ready jobs. If no job is ready by the end of the timeout, ErrTimeout is returned