client

package
v0.0.0-...-ca9423e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package client defines a client for the dependency service defined by the service package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client implements a JSON-RPC client to the dependency service exported by the service package.

func Dial

func Dial(ctx context.Context, addr string) (*Client, error)

Dial establishes a connection to the dependency service at addr. If ctx contains a deadline, that timeout governs the dial operation and not the operation of the resulting client.

func (*Client) Close

func (c *Client) Close() error

Close shuts down the client, terminating any pending calls.

func (*Client) Match

func (c *Client) Match(ctx context.Context, req *service.MatchReq, f func(*graph.Row) error) (int, error)

Match calls the eponymous method of the service and delivers a response to f for each result row. If f reports an error, pagination stops and that error is reported to the caller of Match. The total number of matching rows is returned.

func (*Client) Rank

func (c *Client) Rank(ctx context.Context, req *service.RankReq) (*service.RankRsp, error)

Rank calls the eponymous method of the service. If the server requires a write token, the caller must provide one via SetToken.

func (*Client) Receive

func (c *Client) Receive(ctx context.Context, f func(*jrpc2.Request))

Receive calls f with each server notification received by c as long as ctx is active. Calls to f are synchronous with request processing.

func (*Client) RepoStatus

func (c *Client) RepoStatus(ctx context.Context, repo string) (*service.RepoStatusRsp, error)

RepoStatus calls the eponymous method of the service.

func (*Client) Resolve

func (c *Client) Resolve(ctx context.Context, pkg string) (*service.ResolveRsp, error)

Resolve calls the eponymous method of the service.

func (*Client) Reverse

func (c *Client) Reverse(ctx context.Context, req *service.ReverseReq, f func(*service.ReverseDep) error) (int, error)

Reverse calls the eponymous method of the service and delivers a result to f for each reverse dependency found. If f reports an error, pagination stops and that error is reported to the caller of Reverse. The total number of matching rows is returned.

func (*Client) Scan

func (c *Client) Scan(ctx context.Context, req *service.ScanReq) (*service.ScanRsp, error)

Scan calls the eponymous method of the service. If the server requires a write token, the caller must provide one via SetToken.

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken sets a write token that will be passed to the server during requests that modify data.

func (*Client) Update

func (c *Client) Update(ctx context.Context, req *service.UpdateReq) (*service.UpdateRsp, error)

Update calls the eponymous method of the service. If the server requires a write token, the caller must provide one via SetToken.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL