grpc

package
v0.55.4 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Unlicense Imports: 8 Imported by: 0

Documentation

Overview

Package grpc provides a gRPC client for the distributed sync service.

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
}

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) Close

func (c *Client) Close() error

Close closes the gRPC connection.

func (*Client) GetCurrentSerial

func (c *Client) GetCurrentSerial(ctx context.Context) (uint64, error)

GetCurrentSerial returns the current serial number.

func (*Client) GetEventIDs

func (c *Client) GetEventIDs(ctx context.Context, from, to uint64) (map[string]uint64, error)

GetEventIDs returns event IDs for a serial range.

func (*Client) GetInfo

func (c *Client) GetInfo(ctx context.Context) (*commonv1.SyncInfo, error)

GetInfo returns current sync service information.

func (*Client) GetPeerPubkey

func (c *Client) GetPeerPubkey(ctx context.Context, peerURL string) (string, error)

GetPeerPubkey fetches the pubkey for a peer relay.

func (*Client) GetPeers

func (c *Client) GetPeers(ctx context.Context) ([]string, error)

GetPeers returns the current list of sync peers.

func (*Client) GetSyncStatus

func (c *Client) GetSyncStatus(ctx context.Context) (uint64, map[string]uint64, error)

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

func (c *Client) NotifyNewEvent(ctx context.Context, eventID []byte, serial uint64) error

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

func (c *Client) TriggerSync(ctx context.Context) error

TriggerSync manually triggers a sync cycle.

func (*Client) UpdatePeers

func (c *Client) UpdatePeers(ctx context.Context, peers []string) error

UpdatePeers updates the peer list.

func (*Client) UpdateSerial

func (c *Client) UpdateSerial(ctx context.Context) error

UpdateSerial updates the current serial from database.

type ClientConfig

type ClientConfig struct {
	ServerAddress  string
	ConnectTimeout time.Duration
}

ClientConfig holds configuration for the gRPC client.

Source Files

  • client.go

Jump to

Keyboard shortcuts

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