Documentation
¶
Overview ¶
Package grpc provides a gRPC client for the distributed sync service.
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) GetCurrentSerial(ctx context.Context) (uint64, error)
- func (c *Client) GetEventIDs(ctx context.Context, from, to uint64) (map[string]uint64, error)
- func (c *Client) GetInfo(ctx context.Context) (*commonv1.SyncInfo, error)
- func (c *Client) GetPeerPubkey(ctx context.Context, peerURL string) (string, error)
- func (c *Client) GetPeers(ctx context.Context) ([]string, error)
- func (c *Client) GetSyncStatus(ctx context.Context) (uint64, map[string]uint64, error)
- func (c *Client) HandleCurrentRequest(ctx context.Context, method string, body []byte, headers map[string]string) (int, []byte, map[string]string, error)
- func (c *Client) HandleEventIDsRequest(ctx context.Context, method string, body []byte, headers map[string]string) (int, []byte, map[string]string, error)
- func (c *Client) IsAuthorizedPeer(ctx context.Context, peerURL, expectedPubkey string) (bool, error)
- func (c *Client) NotifyNewEvent(ctx context.Context, eventID []byte, serial uint64) error
- func (c *Client) Ready() <-chan struct{}
- func (c *Client) TriggerSync(ctx context.Context) error
- func (c *Client) UpdatePeers(ctx context.Context, peers []string) error
- func (c *Client) UpdateSerial(ctx context.Context) error
- type ClientConfig
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
}
Client is a gRPC client for the distributed sync service.
func New ¶
func New(ctx context.Context, cfg *ClientConfig) (*Client, error)
New creates a new gRPC distributed sync client.
func (*Client) GetCurrentSerial ¶
GetCurrentSerial returns the current serial number.
func (*Client) GetEventIDs ¶
GetEventIDs returns event IDs for a serial range.
func (*Client) GetInfo ¶
GetInfo returns current sync service information.
func (*Client) GetPeerPubkey ¶
GetPeerPubkey fetches the pubkey for a peer relay.
func (*Client) GetPeers ¶
GetPeers returns the current list of sync peers.
func (*Client) GetSyncStatus ¶
GetSyncStatus returns current sync status.
func (*Client) HandleCurrentRequest ¶
func (c *Client) HandleCurrentRequest(ctx context.Context, method string, body []byte, headers map[string]string) (int, []byte, map[string]string, error)
HandleCurrentRequest proxies an HTTP current request.
func (*Client) HandleEventIDsRequest ¶
func (c *Client) HandleEventIDsRequest(ctx context.Context, method string, body []byte, headers map[string]string) (int, []byte, map[string]string, error)
HandleEventIDsRequest proxies an HTTP event-ids request.
func (*Client) IsAuthorizedPeer ¶
func (c *Client) IsAuthorizedPeer(ctx context.Context, peerURL, expectedPubkey string) (bool, error)
IsAuthorizedPeer checks if a peer is authorized.
func (*Client) NotifyNewEvent ¶
NotifyNewEvent notifies the service of a new event.
func (*Client) Ready ¶
func (c *Client) Ready() <-chan struct{}
Ready returns a channel that closes when the client is ready.
func (*Client) TriggerSync ¶
TriggerSync manually triggers a sync cycle.
func (*Client) UpdatePeers ¶
UpdatePeers updates the peer list.
Source Files
¶
- client.go